Comparison

plugins/muc/muc.lib.lua @ 8475:eb85b10e1fea

MUC: Ensure that <delay/> elements which match our from are stripped (fixes #1055)
author Jonas Wielicki <jonas@wielicki.name>
date Sat, 09 Dec 2017 17:57:14 +0100
parent 8474:7ad9d7c4161c
child 8476:082d12728645
comparison
equal deleted inserted replaced
8474:7ad9d7c4161c 8475:eb85b10e1fea
120 self:_route_stanza(stanza); 120 self:_route_stanza(stanza);
121 end 121 end
122 end 122 end
123 function room_mt:broadcast_message(stanza, historic) 123 function room_mt:broadcast_message(stanza, historic)
124 local to = stanza.attr.to; 124 local to = stanza.attr.to;
125 local muc_jid = self.jid;
126
127 stanza:maptags(function (child)
128 if child.name == "delay" and child.attr["xmlns"] == "urn:xmpp:delay" then
129 if child.attr["from"] == muc_jid then
130 return nil;
131 end
132 end
133 if child.name == "x" and child.attr["xmlns"] == "jabber:x:delay" then
134 if child.attr["from"] == muc_jid then
135 return nil;
136 end
137 end
138 return child;
139 end)
140
125 for occupant, o_data in pairs(self._occupants) do 141 for occupant, o_data in pairs(self._occupants) do
126 for jid in pairs(o_data.sessions) do 142 for jid in pairs(o_data.sessions) do
127 stanza.attr.to = jid; 143 stanza.attr.to = jid;
128 self:_route_stanza(stanza); 144 self:_route_stanza(stanza);
129 end 145 end