# HG changeset patch # User Matthew Wild # Date 1219752883 -3600 # Node ID ae161e9071492b4d7f8142d54dfc0613ba22ead7 # Parent 780bcad913f387d472c76bb22396ddb694165e0b Beginning of new routing logic diff -r 780bcad913f3 -r ae161e907149 main.lua --- a/main.lua Mon Aug 25 22:19:47 2008 +0100 +++ b/main.lua Tue Aug 26 13:14:43 2008 +0100 @@ -8,7 +8,7 @@ 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.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 @@ 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