aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-08-26 16:57:00 +0100
committerMatthew Wild <mwild1@gmail.com>2008-08-26 16:57:00 +0100
commit42051336dcb360df4affa56d9ec8ecb848f7764a (patch)
tree71da25f6710e99f145e4581e7f875fb582d46c2c
parent3c5654cfc8fb53672714cdb8309c0a6d71018ead (diff)
downloadprosody-42051336dcb360df4affa56d9ec8ecb848f7764a.tar.gz
prosody-42051336dcb360df4affa56d9ec8ecb848f7764a.zip
Remove some debugging messages
Connection now closed on error Removed version='1.0' to keep it working with non-SASL
-rw-r--r--core/xmlhandlers.lua2
-rw-r--r--main.lua13
2 files changed, 7 insertions, 8 deletions
diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua
index b9c557fa..f731d3d5 100644
--- a/core/xmlhandlers.lua
+++ b/core/xmlhandlers.lua
@@ -42,7 +42,7 @@ function init_xmlhandlers(session)
session.streamid = m_random(1000000, 99999999);
print(session, session.host, "Client opened stream");
send("<?xml version='1.0'?>");
- send(format("<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='%s' from='%s' version='1.0'>", session.streamid, session.host));
+ send(format("<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='%s' from='%s'>", session.streamid, session.host));
--send("<stream:features>");
--send("<mechanism>PLAIN</mechanism>");
--send [[<register xmlns="http://jabber.org/features/iq-register"/> ]]
diff --git a/main.lua b/main.lua
index 97ea089f..e49f5735 100644
--- a/main.lua
+++ b/main.lua
@@ -10,7 +10,7 @@ function log(type, area, message)
end
require "core.stanza_dispatch"
-local init_xmlhandlers = require "core.xmlhandlers"
+require "core.xmlhandlers"
require "core.rostermanager"
require "core.offlinemessage"
require "core.usermanager"
@@ -24,6 +24,7 @@ local t_concatall = function (t, sep) local tt = {}; for _, s in ipairs(t) do t_
local m_random = math.random;
local format = string.format;
local st = stanza;
+local init_xmlhandlers = xmlhandlers.init_xmlhandlers;
------------------------------
sessions = {};
@@ -165,15 +166,13 @@ function disconnect(conn, err)
sessions[conn].disconnect(err);
end
-print("ssl_ctx:", type(ssl_ctx));
-
setmetatable(_G, { __index = function (t, k) print("WARNING: ATTEMPT TO READ A NIL GLOBAL!!!", k); error("Attempt to read a non-existent global. Naughty boy.", 2); end, __newindex = function (t, k, v) print("ATTEMPT TO SET A GLOBAL!!!!", tostring(k).." = "..tostring(v)); error("Attempt to set a global. Naughty boy.", 2); end }) --]][][[]][];
-local protected_handler = function (...) local success, ret = pcall(handler, ...); if not success then print("ERROR on "..tostring((select(1, ...)))..": "..ret); end end;
-local protected_disconnect = function (...) local success, ret = pcall(disconnect, ...); if not success then print("ERROR on "..tostring((select(1, ...))).." disconnect: "..ret); end end;
+local protected_handler = function (conn, data, err) local success, ret = pcall(handler, conn, data, err); if not success then print("ERROR on "..tostring(conn)..": "..ret); conn:close(); end end;
+local protected_disconnect = function (conn, err) local success, ret = pcall(disconnect, conn, err); if not success then print("ERROR on "..tostring(conn).." disconnect: "..ret); conn:close(); end end;
-print( server.add( { listener = protected_handler, disconnect = protected_disconnect }, 5222, "*", 1, nil ) ) -- server.add will send a status message
-print( server.add( { listener = protected_handler, disconnect = protected_disconnect }, 5223, "*", 1, ssl_ctx ) ) -- server.add will send a status message
+server.add( { listener = protected_handler, disconnect = protected_disconnect }, 5222, "*", 1, nil ) -- server.add will send a status message
+server.add( { listener = protected_handler, disconnect = protected_disconnect }, 5223, "*", 1, ssl_ctx ) -- server.add will send a status message
server.loop();