aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-10-24 07:27:36 +0100
committerMatthew Wild <mwild1@gmail.com>2008-10-24 07:27:36 +0100
commit5c90ffdf7e7c7d784ed5f60eed3f8a2666c117f8 (patch)
tree00c7446dee596c9f5a2559a3e26109687e640669 /core/stanza_router.lua
parent5031be1f8cb3a5a8785c07c5e4c5802913c209f6 (diff)
downloadprosody-5c90ffdf7e7c7d784ed5f60eed3f8a2666c117f8.tar.gz
prosody-5c90ffdf7e7c7d784ed5f60eed3f8a2666c117f8.zip
s2s works! \o/ \o/
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua25
1 files changed, 10 insertions, 15 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 2399c25f..905de6e3 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -26,7 +26,7 @@ function core_process_stanza(origin, stanza)
if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then
if stanza.attr.type == "set" or stanza.attr.type == "get" then
error("Invalid IQ");
- elseif #stanza.tags > 1 or not(stanza.attr.type == "error" or stanza.attr.type == "result") then
+ elseif #stanza.tags > 1 and not(stanza.attr.type == "error" or stanza.attr.type == "result") then
error("Invalid IQ");
end
end
@@ -49,10 +49,8 @@ function core_process_stanza(origin, stanza)
core_handle_stanza(origin, stanza);
elseif stanza.name == "iq" and not select(3, jid_split(to)) then
core_handle_stanza(origin, stanza);
- elseif origin.type == "c2s" then
+ elseif origin.type == "c2s" or origin.type == "s2sin" then
core_route_stanza(origin, stanza);
- elseif origin.type == "s2sin" then
- core_deliver_stanza(origin, stanza);
end
end
@@ -98,7 +96,7 @@ function core_handle_stanza(origin, stanza)
log("debug", "Routing stanza to local");
handle_stanza(session, stanza);
end
- elseif origin.type == "s2sin_unauthed" then
+ elseif origin.type == "s2sin_unauthed" or origin.type == "s2sin" then
if stanza.attr.xmlns == "jabber:server:dialback" then
if stanza.name == "verify" then
-- We are being asked to verify the key, to ensure it was generated by us
@@ -113,7 +111,8 @@ function core_handle_stanza(origin, stanza)
type = "valid"
end
origin.send(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1]));
- elseif stanza.name == "result" then
+ elseif stanza.name == "result" and origin.type == "s2sin_unauthed" then
+ -- he wants to be identified through dialback
-- We need to check the key with the Authoritative server
local attr = stanza.attr;
origin.from_host = attr.from;
@@ -244,22 +243,18 @@ function core_route_stanza(origin, stanza)
end
end
end
- else
+ elseif origin.type == "c2s" then
-- Remote host
+ --stanza.attr.xmlns = "jabber:server";
+ stanza.attr.xmlns = nil;
log("debug", "sending s2s stanza: %s", tostring(stanza));
- stanza.attr.xmlns = "jabber:server";
send_s2s(origin.host, host, stanza);
+ else
+ log("warn", "received stanza from unhandled connection type: %s", origin.type);
end
stanza.attr.to = to; -- reset
end
-function core_deliver_stanza(origin, stanza)
- local name, attr = stanza.name, stanza.attr;
- if name == "message" then
-
- end
-end
-
function handle_stanza_toremote(stanza)
log("error", "Stanza bound for remote host, but s2s is not implemented");
end