core/stanza_router.lua

changeset 1413
b7e17efe433e
parent 1412
6cfcab7cd4e7
child 1419
1ac8bcc63a9d
equal deleted inserted replaced
1412:6cfcab7cd4e7 1413:b7e17efe433e
4 -- 4 --
5 -- This project is MIT/X11 licensed. Please see the 5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information. 6 -- COPYING file in the source package for more information.
7 -- 7 --
8 8
9
10
11 local log = require "util.logger".init("stanzarouter") 9 local log = require "util.logger".init("stanzarouter")
12 10
13 local hosts = _G.hosts; 11 local hosts = _G.hosts;
14 12 local tostring = tostring;
15 local st = require "util.stanza"; 13 local st = require "util.stanza";
16 local send_s2s = require "core.s2smanager".send_to_host; 14 local send_s2s = require "core.s2smanager".send_to_host;
17 local user_exists = require "core.usermanager".user_exists;
18
19 local rostermanager = require "core.rostermanager";
20 local offlinemanager = require "core.offlinemanager";
21
22 local modules_handle_stanza = require "core.modulemanager".handle_stanza; 15 local modules_handle_stanza = require "core.modulemanager".handle_stanza;
23 local component_handle_stanza = require "core.componentmanager".handle_stanza; 16 local component_handle_stanza = require "core.componentmanager".handle_stanza;
24
25 local tostring = tostring;
26 local t_insert = table.insert;
27 local pairs = pairs;
28 local ipairs = ipairs;
29
30 local jid_split = require "util.jid".split; 17 local jid_split = require "util.jid".split;
31 local jid_prepped_split = require "util.jid".prepped_split; 18 local jid_prepped_split = require "util.jid".prepped_split;
32 local fire_event = prosody.events.fire_event;
33 19
34 function core_process_stanza(origin, stanza) 20 function core_process_stanza(origin, stanza)
35 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag()) 21 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag())
36 22
37 -- Currently we guarantee every stanza to have an xmlns, should we keep this rule? 23 -- Currently we guarantee every stanza to have an xmlns, should we keep this rule?
198 log("debug", "Routing outgoing stanza for %s to %s", from_host, host); 184 log("debug", "Routing outgoing stanza for %s to %s", from_host, host);
199 send_s2s(from_host, host, stanza); 185 send_s2s(from_host, host, stanza);
200 else 186 else
201 log("warn", "received stanza from unhandled connection type: %s", origin.type); 187 log("warn", "received stanza from unhandled connection type: %s", origin.type);
202 end 188 end
203 stanza.attr.to = to; -- reset
204 end 189 end

mercurial