Software /
code /
prosody
Changeset
1254:c199be608546
stanza_router: Fire events for non-jabber:client and pre-auth stanzas
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 31 May 2009 02:20:30 +0500 |
parents | 1253:60156584c442 |
children | 1255:a25b12c105bb 1259:6bd11bca9725 |
files | core/stanza_router.lua |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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