# HG changeset patch # User Kim Alvefur # Date 1513859939 -3600 # Node ID d546815e555e72e807ab81ee48907456d2b6a6b7 # Parent 3d37061471748840eb06c9cecdab7d6f61c4c8e3 MUC: Move delayed delivery check into an event handler diff -r 3d3706147174 -r d546815e555e plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Fri Dec 22 01:02:05 2017 +0100 +++ b/plugins/muc/muc.lib.lua Thu Dec 21 13:38:59 2017 +0100 @@ -164,6 +164,16 @@ 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 @@ 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)