From ac05108ed91a4c8a0e75b78ff35514352ec74313 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 21 Dec 2017 13:38:59 +0100 Subject: MUC: Move delayed delivery check into an event handler --- plugins/muc/muc.lib.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'plugins/muc') 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) -- cgit v1.2.3