aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-12-21 13:38:59 +0100
committerKim Alvefur <zash@zash.se>2017-12-21 13:38:59 +0100
commitac05108ed91a4c8a0e75b78ff35514352ec74313 (patch)
treef880c931c8d338e9ec7dbe90cf18bac3cb8e83fd /plugins/muc/muc.lib.lua
parent689f3d3009eaaebd36cae0a29e5949506d525ef8 (diff)
downloadprosody-ac05108ed91a4c8a0e75b78ff35514352ec74313.tar.gz
prosody-ac05108ed91a4c8a0e75b78ff35514352ec74313.zip
MUC: Move delayed delivery check into an event handler
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua18
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)