# HG changeset patch # User daurnimator # Date 1395264812 14400 # Node ID 4a35a0281d8a33060bf5369fd69c4d3d0c37652c # Parent 203f2b4933b00e65302ea8a2590f036be261ce5a plugins/muc/muc.lib: Send invite out from event: removes '-prepared' from event name diff -r 203f2b4933b0 -r 4a35a0281d8a plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Wed Mar 19 17:30:21 2014 -0400 +++ b/plugins/muc/muc.lib.lua Wed Mar 19 17:33:32 2014 -0400 @@ -1011,8 +1011,7 @@ :tag('body') -- Add a plain message for clients which don't support invites :text(_from..' invited you to the room '.._to..(_reason and (' ('.._reason..')') or "")) :up(); - module:fire_event("muc-invite-prepared", { room = self, stanza = invite }) - self:_route_stanza(invite); + module:fire_event("muc-invite", { room = self, stanza = invite, origin = origin, incoming = stanza }); return true; else origin.send(st.error_reply(stanza, "cancel", "jid-malformed")); @@ -1020,8 +1019,13 @@ end end +module:hook("muc-invite", function(event) + event.room:_route_stanza(event.stanza); + return true; +end, -1) + -- When an invite is sent; add an affiliation for the invitee -module:hook("muc-invite-prepared", function(event) +module:hook("muc-invite", function(event) local room, stanza = event.room, event.stanza local invitee = stanza.attr.to if room:get_members_only() and not room:get_affiliation(invitee) then