Changeset

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
parents 8474:7ad9d7c4161c
children 8476:082d12728645
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Sat Dec 09 17:36:47 2017 +0100
+++ b/plugins/muc/muc.lib.lua	Sat Dec 09 17:57:14 2017 +0100
@@ -122,6 +122,22 @@
 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;