aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-12-10 22:23:32 +0100
committerKim Alvefur <zash@zash.se>2017-12-10 22:23:32 +0100
commitacc624e5f59d91f6dba1b077746019b11ebe4005 (patch)
treea2aa21291ef6b870f4e68cb2a3cf56f968594342 /plugins/muc/muc.lib.lua
parent6e38411b1617de60d6e700aab4de874118863451 (diff)
parent173196f0768840086608655323c9978a73eef859 (diff)
downloadprosody-acc624e5f59d91f6dba1b077746019b11ebe4005.tar.gz
prosody-acc624e5f59d91f6dba1b077746019b11ebe4005.zip
Merge 0.9->0.10
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 807fb2c3..8930feeb 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -99,6 +99,22 @@ function room_mt:broadcast_presence(stanza, sid, code, nick)
end
function room_mt:broadcast_message(stanza, historic)
local to = stanza.attr.to;
+ local room_jid = self.jid;
+
+ stanza:maptags(function (child)
+ if child.name == "delay" and child.attr["xmlns"] == "urn:xmpp:delay" then
+ if child.attr["from"] == room_jid then
+ return nil;
+ end
+ end
+ if child.name == "x" and child.attr["xmlns"] == "jabber:x:delay" then
+ if child.attr["from"] == room_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;
@@ -116,8 +132,8 @@ function room_mt:save_to_history(stanza)
stanza = st.clone(stanza);
stanza.attr.to = "";
local stamp = datetime.datetime();
- stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = stamp}):up(); -- XEP-0203
- stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
+ stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = self.jid, stamp = stamp}):up(); -- XEP-0203
+ stanza:tag("x", {xmlns = "jabber:x:delay", from = self.jid, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
local entry = { stanza = stanza, stamp = stamp };
t_insert(history, entry);
while #history > (self._data.history_length or default_history_length) do t_remove(history, 1) end