core/stanza_router.lua

changeset 1182
89e9f0d555a2
parent 1179
503d68e7e18a
child 1191
7f965bd37d65
equal deleted inserted replaced
1181:dffbb7d1da4b 1182:89e9f0d555a2
121 local to = stanza.attr.to; 121 local to = stanza.attr.to;
122 local node, host, resource = jid_split(to); 122 local node, host, resource = jid_split(to);
123 local to_bare = node and (node.."@"..host) or host; -- bare JID 123 local to_bare = node and (node.."@"..host) or host; -- bare JID
124 124
125 local event_data = {origin=origin, stanza=stanza}; 125 local event_data = {origin=origin, stanza=stanza};
126 if fire_event(tostring(host or origin.host).."/"..stanza.name, event_data) then 126 if host and fire_event(host.."/"..stanza.name, event_data) then
127 -- event handled
128 elseif stanza.name == "presence" and origin.host and fire_event(origin.host.."/"..stanza.name, event_data) then
127 -- event handled 129 -- event handled
128 elseif not to then 130 elseif not to then
129 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); 131 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
130 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server 132 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server
131 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); 133 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);

mercurial