From 9b16be0675e3b7ee8a68f3851b2e1323e5003db3 Mon Sep 17 00:00:00 2001 From: Jonas Wielicki Date: Sat, 9 Dec 2017 17:57:14 +0100 Subject: MUC: Ensure that elements which match our from are stripped (fixes #1055) --- plugins/muc/muc.lib.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'plugins/muc/muc.lib.lua') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 0dfdd1aa..0040b99c 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -122,6 +122,22 @@ function room_mt:broadcast_presence(stanza, sid, code, nick) end function room_mt:broadcast_message(stanza, historic) local to = stanza.attr.to; + local muc_jid = self.jid; + + stanza:maptags(function (child) + if child.name == "delay" and child.attr["xmlns"] == "urn:xmpp:delay" then + if child.attr["from"] == muc_jid then + return nil; + end + end + if child.name == "x" and child.attr["xmlns"] == "jabber:x:delay" then + if child.attr["from"] == muc_jid then + return nil; + end + end + return child; + end) + for occupant, o_data in pairs(self._occupants) do for jid in pairs(o_data.sessions) do stanza.attr.to = jid; -- cgit v1.2.3