Sun, 31 May 2009 02:20:30 +0500
stanza_router: Fire events for non-jabber:client and pre-auth stanzas
core/stanza_router.lua | file | annotate | diff | comparison | revisions |
--- a/core/stanza_router.lua Sun May 31 01:17:19 2009 +0500 +++ b/core/stanza_router.lua Sun May 31 02:20:30 2009 +0500 @@ -115,6 +115,20 @@ end core_post_stanza(origin, stanza); else + local h = hosts[stanza.attr.to or origin.host or origin.to_host]; + if h then + local event; + if stanza.attr.xmlns == "jabber:client" then + if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") then + event = "stanza/iq/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name; + else + event = "stanza/"..stanza.name; + end + else + event = "stanza/"..stanza.attr.xmlns..":"..stanza.name; + end + if h.events.fire_event(event, {origin = origin, stanza = stanza}) then return; end + end modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); end end