Software / code / prosody
Comparison
plugins/muc/muc.lib.lua @ 8477:597c23e1c38e
Merge 0.9->0.10
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 10 Dec 2017 22:23:32 +0100 |
| parent | 8466:df970f76c720 |
| parent | 8476:082d12728645 |
| child | 8480:3d3706147174 |
| child | 8578:cf10cd3eb728 |
comparison
equal
deleted
inserted
replaced
| 8466:df970f76c720 | 8477:597c23e1c38e |
|---|---|
| 97 self:_route_stanza(stanza); | 97 self:_route_stanza(stanza); |
| 98 end | 98 end |
| 99 end | 99 end |
| 100 function room_mt:broadcast_message(stanza, historic) | 100 function room_mt:broadcast_message(stanza, historic) |
| 101 local to = stanza.attr.to; | 101 local to = stanza.attr.to; |
| 102 local room_jid = self.jid; | |
| 103 | |
| 104 stanza:maptags(function (child) | |
| 105 if child.name == "delay" and child.attr["xmlns"] == "urn:xmpp:delay" then | |
| 106 if child.attr["from"] == room_jid then | |
| 107 return nil; | |
| 108 end | |
| 109 end | |
| 110 if child.name == "x" and child.attr["xmlns"] == "jabber:x:delay" then | |
| 111 if child.attr["from"] == room_jid then | |
| 112 return nil; | |
| 113 end | |
| 114 end | |
| 115 return child; | |
| 116 end) | |
| 117 | |
| 102 for occupant, o_data in pairs(self._occupants) do | 118 for occupant, o_data in pairs(self._occupants) do |
| 103 for jid in pairs(o_data.sessions) do | 119 for jid in pairs(o_data.sessions) do |
| 104 stanza.attr.to = jid; | 120 stanza.attr.to = jid; |
| 105 self:_route_stanza(stanza); | 121 self:_route_stanza(stanza); |
| 106 end | 122 end |
| 114 local history = self._data['history']; | 130 local history = self._data['history']; |
| 115 if not history then history = {}; self._data['history'] = history; end | 131 if not history then history = {}; self._data['history'] = history; end |
| 116 stanza = st.clone(stanza); | 132 stanza = st.clone(stanza); |
| 117 stanza.attr.to = ""; | 133 stanza.attr.to = ""; |
| 118 local stamp = datetime.datetime(); | 134 local stamp = datetime.datetime(); |
| 119 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = stamp}):up(); -- XEP-0203 | 135 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = self.jid, stamp = stamp}):up(); -- XEP-0203 |
| 120 stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated) | 136 stanza:tag("x", {xmlns = "jabber:x:delay", from = self.jid, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated) |
| 121 local entry = { stanza = stanza, stamp = stamp }; | 137 local entry = { stanza = stanza, stamp = stamp }; |
| 122 t_insert(history, entry); | 138 t_insert(history, entry); |
| 123 while #history > (self._data.history_length or default_history_length) do t_remove(history, 1) end | 139 while #history > (self._data.history_length or default_history_length) do t_remove(history, 1) end |
| 124 end | 140 end |
| 125 function room_mt:broadcast_except_nick(stanza, nick) | 141 function room_mt:broadcast_except_nick(stanza, nick) |