# HG changeset patch # User Kim Alvefur # Date 1524869228 -7200 # Node ID adffadd88ff0c9e6b16e467b286f0ac016eb922b # Parent 82b889608503a5463f153093609dd98338f8ae50 mod_muc_mam: Have stanza-id filtering over all groupchat messages, not just ones considered for history diff -r 82b889608503 -r adffadd88ff0 plugins/mod_muc_mam.lua --- a/plugins/mod_muc_mam.lua Fri Apr 27 15:26:29 2018 +0200 +++ b/plugins/mod_muc_mam.lua Sat Apr 28 00:47:08 2018 +0200 @@ -303,14 +303,13 @@ 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 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 @@ 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