aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-08-26 13:14:43 +0100
committerMatthew Wild <mwild1@gmail.com>2008-08-26 13:14:43 +0100
commit5f1085df7eeb44e7b2e0271c86cf43b4780270e2 (patch)
treebead659a5afd0c18a28a68b38900d53d2c197e75
parentf2dc5a554f470cb9c56a9ce94d67c3874bd29a6f (diff)
downloadprosody-5f1085df7eeb44e7b2e0271c86cf43b4780270e2.tar.gz
prosody-5f1085df7eeb44e7b2e0271c86cf43b4780270e2.zip
Beginning of new routing logic
-rw-r--r--main.lua17
1 files changed, 15 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index c19ad8bf..97ea089f 100644
--- a/main.lua
+++ b/main.lua
@@ -8,7 +8,7 @@ require "lxp"
function log(type, area, message)
print(type, area, message);
end
-
+
require "core.stanza_dispatch"
local init_xmlhandlers = require "core.xmlhandlers"
require "core.rostermanager"
@@ -16,7 +16,7 @@ require "core.offlinemessage"
require "core.usermanager"
require "util.stanza"
require "util.jid"
-
+
-- Locals for faster access --
local t_insert = table.insert;
local t_concat = table.concat;
@@ -50,6 +50,19 @@ function connect_host(host)
hosts[host] = { type = "remote", sendbuffer = {} };
end
+local function route_stanza(stanza)
+ if not stanza.attr.to then
+ -- Has no 'to' attribute, handle internally
+ end
+ local node, host, resource = jid.split(stanza.attr.to);
+ if host and hosts[host] and hosts[host].type == "local" then
+ -- Is a local host, handle internally
+
+ else
+ -- Is not for us or a local user, route accordingly
+ end
+end
+
local function send_to(session, to, stanza)
local node, host, resource = jid.split(to);
if not hosts[host] then