Software /
code /
prosody
Comparison
core/stanza_router.lua @ 1163:8b4a57765b04
stanza_router: Fire events after all checks
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 15 May 2009 23:42:35 +0500 |
parent | 1157:279f79389189 |
child | 1164:251954b07cae |
comparison
equal
deleted
inserted
replaced
1157:279f79389189 | 1163:8b4a57765b04 |
---|---|
105 log("warn", "stanza recieved for a non-local server"); | 105 log("warn", "stanza recieved for a non-local server"); |
106 return; -- FIXME what should we do here? | 106 return; -- FIXME what should we do here? |
107 end]] -- FIXME | 107 end]] -- FIXME |
108 | 108 |
109 if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and (not xmlns or xmlns == "jabber:server" or xmlns == "jabber:client") then | 109 if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and (not xmlns or xmlns == "jabber:server" or xmlns == "jabber:client") then |
110 local event_data = {origin=origin, stanza=stanza}; | |
111 if fire_event(tostring(host or origin.host).."/"..stanza.name, event_data) then return; end | |
112 if origin.type == "s2sin" and not origin.dummy then | 110 if origin.type == "s2sin" and not origin.dummy then |
113 local host_status = origin.hosts[from_host]; | 111 local host_status = origin.hosts[from_host]; |
114 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? | 112 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? |
115 log("warn", "Received a stanza claiming to be from %s, over a conn authed for %s!", from_host, origin.from_host); | 113 log("warn", "Received a stanza claiming to be from %s, over a conn authed for %s!", from_host, origin.from_host); |
116 return; -- FIXME what should we do here? does this work with subdomains? | 114 return; -- FIXME what should we do here? does this work with subdomains? |
117 end | 115 end |
118 end | 116 end |
119 if not to then | 117 local event_data = {origin=origin, stanza=stanza}; |
118 if fire_event(tostring(host or origin.host).."/"..stanza.name, event_data) then | |
119 -- event handled | |
120 elseif not to then | |
120 core_handle_stanza(origin, stanza); | 121 core_handle_stanza(origin, stanza); |
121 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server | 122 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server |
122 core_handle_stanza(origin, stanza); | 123 core_handle_stanza(origin, stanza); |
123 elseif stanza.attr.xmlns and stanza.attr.xmlns ~= "jabber:client" and stanza.attr.xmlns ~= "jabber:server" then | 124 elseif stanza.attr.xmlns and stanza.attr.xmlns ~= "jabber:client" and stanza.attr.xmlns ~= "jabber:server" then |
124 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); | 125 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); |