aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_dispatch.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-08-24 22:48:27 +0100
committerMatthew Wild <mwild1@gmail.com>2008-08-24 22:48:27 +0100
commit1a138d2e57818f585c9244a4230d7387c50777ea (patch)
tree748c1714574fb3eb468c27f083b46f7c935cc10d /core/stanza_dispatch.lua
parent25f82f43ad92f190e2373f0e61524bee826617b2 (diff)
downloadprosody-1a138d2e57818f585c9244a4230d7387c50777ea.tar.gz
prosody-1a138d2e57818f585c9244a4230d7387c50777ea.zip
- Remove some debugging code
- Don't allow stanzas to be sent before successful auth (needs further review) - Make init_xmlhandlers local - Fix indentation in main.lua - Fix disconnect logic (it broke if client disconnected before auth, etc.)
Diffstat (limited to 'core/stanza_dispatch.lua')
-rw-r--r--core/stanza_dispatch.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/stanza_dispatch.lua b/core/stanza_dispatch.lua
index 2c835517..e76d6ddd 100644
--- a/core/stanza_dispatch.lua
+++ b/core/stanza_dispatch.lua
@@ -32,7 +32,6 @@ function init_stanza_dispatcher(session)
return true;
else
username, password, resource = t_concat(username), t_concat(password), t_concat(resource);
- print(username, password, resource)
local reply = st.reply(stanza);
require "core.usermanager"
if usermanager.validate_credentials(session.host, username, password) then
@@ -96,7 +95,9 @@ function init_stanza_dispatcher(session)
send(format("<iq type='error' id='%s'><error type='cancel'><service-unavailable/></error></iq>", stanza.attr.id));
return;
end
- elseif stanza.name == "presence" then
+ end
+ if not session.username then log("warn", "Attempt to use an unauthed stream!"); return; end
+ if stanza.name == "presence" then
if session.roster then
local initial_presence = not session.last_presence;
session.last_presence = stanza;
@@ -112,7 +113,6 @@ function init_stanza_dispatcher(session)
broadcast.attr.to = contact_jid;
send_to(contact_jid, broadcast);
if initial_presence then
- print("Initital presence");
local node, host = jid.split(contact_jid);
if hosts[host] and hosts[host].type == "local" then
local contact = hosts[host].sessions[node]
@@ -137,7 +137,7 @@ function init_stanza_dispatcher(session)
-- Probe for our contacts' presence
end
end
- else
+ elseif session.username then
--end
--if stanza.attr.to and ((not hosts[stanza.attr.to]) or hosts[stanza.attr.to].type ~= "local") then
-- Need to route stanza
@@ -147,4 +147,3 @@ function init_stanza_dispatcher(session)
end
end
-