diff options
author | Kim Alvefur <zash@zash.se> | 2017-12-21 13:38:59 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-12-21 13:38:59 +0100 |
commit | ac05108ed91a4c8a0e75b78ff35514352ec74313 (patch) | |
tree | f880c931c8d338e9ec7dbe90cf18bac3cb8e83fd /plugins/muc | |
parent | 689f3d3009eaaebd36cae0a29e5949506d525ef8 (diff) | |
download | prosody-ac05108ed91a4c8a0e75b78ff35514352ec74313.tar.gz prosody-ac05108ed91a4c8a0e75b78ff35514352ec74313.zip |
MUC: Move delayed delivery check into an event handler
Diffstat (limited to 'plugins/muc')
-rw-r--r-- | plugins/muc/muc.lib.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 7de8ea24..08415758 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -164,6 +164,16 @@ function room_mt:build_item_list(occupant, x, is_anonymous, nick, actor_nick, ac end function room_mt:broadcast_message(stanza) + if module:fire_event("muc-broadcast-message", {room = self, stanza = stanza}) then + return true; + end + self:broadcast(stanza); + return true; +end + +-- Strip delay tags claiming to be from us +module:hook("muc-broadcast-message", function (event) + local stanza = event.stanza; local to = stanza.attr.to; local room_jid = self.jid; @@ -180,13 +190,7 @@ function room_mt:broadcast_message(stanza) end return child; end) - - if module:fire_event("muc-broadcast-message", {room = self, stanza = stanza}) then - return true; - end - self:broadcast(stanza); - return true; -end +end); -- Broadcast a stanza to all occupants in the room. -- optionally checks conditional called with (nick, occupant) |