aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_muc_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-04-28 00:47:08 +0200
committerKim Alvefur <zash@zash.se>2018-04-28 00:47:08 +0200
commitcbbbb8f776455d4d8c439ba48a7121ee915e6655 (patch)
treec6a0aa2961906e3baa4c08769a42ea4900e20af3 /plugins/mod_muc_mam.lua
parentd37e36dce4818b44a4d95acb74e0d91ab4f62b4d (diff)
downloadprosody-cbbbb8f776455d4d8c439ba48a7121ee915e6655.tar.gz
prosody-cbbbb8f776455d4d8c439ba48a7121ee915e6655.zip
mod_muc_mam: Have stanza-id filtering over all groupchat messages, not just ones considered for history
Diffstat (limited to 'plugins/mod_muc_mam.lua')
-rw-r--r--plugins/mod_muc_mam.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index 7e6c9838..3fdaeaa4 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -303,14 +303,13 @@ module:hook("muc-get-history", function (event)
return true;
end, 1);
--- Handle messages
-local function save_to_history(self, stanza)
- local room_node, room_host = jid_split(self.jid);
+module:hook("muc-broadcast-messages", function (event)
+ local room, stanza = event.room, event.stanza;
-- Filter out <stanza-id> that claim to be from us
stanza:maptags(function (tag)
if tag.name == "stanza-id" and tag.attr.xmlns == xmlns_st_id
- and jid_prep(tag.attr.by) == self.jid then
+ and jid_prep(tag.attr.by) == room.jid then
return nil;
end
if tag.name == "x" and tag.attr.xmlns == xmlns_muc_user then
@@ -319,6 +318,12 @@ local function save_to_history(self, stanza)
return tag;
end);
+end, 0);
+
+-- Handle messages
+local function save_to_history(self, stanza)
+ local room_node, room_host = jid_split(self.jid);
+
local stored_stanza = stanza;
if stanza.name == "message" and self:get_whois() == "anyone" then