aboutsummaryrefslogtreecommitdiffstats
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
commite17cfd568a5f0d2fa4021cf2ab651cfcd0571a18 (patch)
treef880c931c8d338e9ec7dbe90cf18bac3cb8e83fd
parentceb2a46cf3b16fea2b8c6161f975e56c4ded69d6 (diff)
downloadprosody-e17cfd568a5f0d2fa4021cf2ab651cfcd0571a18.tar.gz
prosody-e17cfd568a5f0d2fa4021cf2ab651cfcd0571a18.zip
MUC: Move delayed delivery check into an event handler
-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)