Changeset

2133:5c1758ccf8b9

Merge with trunk
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 04:50:42 +0000
parents 2131:72411e239221 (current diff) 2132:20a52cfda988 (diff)
children 2134:9044e7cfefc2
files core/s2smanager.lua
diffstat 3 files changed, 63 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/core/objectmanager.lua	Sun Nov 22 04:45:13 2009 +0000
+++ b/core/objectmanager.lua	Sun Nov 22 04:50:42 2009 +0000
@@ -6,63 +6,63 @@
 -- COPYING file in the source package for more information.
 --
 
-
-local new_multitable = require "util.multitable".new;
-local t_insert = table.insert;
-local t_concat = table.concat;
-local tostring = tostring;
-local unpack = unpack;
-local pairs = pairs;
-local error = error;
-local type = type;
-local _G = _G;
-
-local data = new_multitable();
-
-module "objectmanager"
-
-function set(...)
-	return data:set(...);
-end
-function remove(...)
-	return data:remove(...);
-end
-function get(...)
-	return data:get(...);
-end
-
-local function get_path(path)
-	if type(path) == "table" then return path; end
-	local s = {};
-	for part in tostring(path):gmatch("[%w_]+") do
-		t_insert(s, part);
-	end
-	return s;
-end
-
-function get_object(path)
-	path = get_path(path)
-	return data:get(unpack(path)), path;
-end
-function set_object(path, object)
-	path = get_path(path);
-	data:set(unpack(path), object);
-end
-
-data:set("ls", function(_dir)
-	local obj, dir = get_object(_dir);
-	if not obj then error("object not found: " .. t_concat(dir, '/')); end
-	local r = {};
-	if type(obj) == "table" then
-		for key, val in pairs(obj) do
-			r[key] = type(val);
-		end
-	end
-	return r;
-end);
-data:set("get", get_object);
-data:set("set", set_object);
-data:set("echo", function(...) return {...}; end);
-data:set("_G", _G);
-
-return _M;
+
+local new_multitable = require "util.multitable".new;
+local t_insert = table.insert;
+local t_concat = table.concat;
+local tostring = tostring;
+local unpack = unpack;
+local pairs = pairs;
+local error = error;
+local type = type;
+local _G = _G;
+
+local data = new_multitable();
+
+module "objectmanager"
+
+function set(...)
+	return data:set(...);
+end
+function remove(...)
+	return data:remove(...);
+end
+function get(...)
+	return data:get(...);
+end
+
+local function get_path(path)
+	if type(path) == "table" then return path; end
+	local s = {};
+	for part in tostring(path):gmatch("[%w_]+") do
+		t_insert(s, part);
+	end
+	return s;
+end
+
+function get_object(path)
+	path = get_path(path)
+	return data:get(unpack(path)), path;
+end
+function set_object(path, object)
+	path = get_path(path);
+	data:set(unpack(path), object);
+end
+
+data:set("ls", function(_dir)
+	local obj, dir = get_object(_dir);
+	if not obj then error("object not found: " .. t_concat(dir, '/')); end
+	local r = {};
+	if type(obj) == "table" then
+		for key, val in pairs(obj) do
+			r[key] = type(val);
+		end
+	end
+	return r;
+end);
+data:set("get", get_object);
+data:set("set", set_object);
+data:set("echo", function(...) return {...}; end);
+data:set("_G", _G);
+
+return _M;
--- a/core/s2smanager.lua	Sun Nov 22 04:45:13 2009 +0000
+++ b/core/s2smanager.lua	Sun Nov 22 04:50:42 2009 +0000
@@ -128,7 +128,7 @@
 	open_sessions = open_sessions + 1;
 	local w, log = conn.write, logger_init("s2sin"..tostring(conn):match("[a-f0-9]+$"));
 	session.log = log;
-	session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(conn, tostring(t)); end
+	session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^([^>]*>?)"); w(conn, tostring(t)); end
 	incoming_s2s[session] = true;
 	add_task(connect_timeout, function ()
 		if session.conn ~= conn or
@@ -317,7 +317,7 @@
 	cl.register_outgoing(conn, host_session);
 	
 	local w, log = conn.write, host_session.log;
-	host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(conn, tostring(t)); end
+	host_session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?")); w(conn, tostring(t)); end
 	
 	conn:write(format([[<stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback' xmlns:stream='http://etherx.jabber.org/streams' from='%s' to='%s' version='1.0' xml:lang='en'>]], from_host, to_host));
 	log("debug", "Connection attempt in progress...");
--- a/core/stanza_router.lua	Sun Nov 22 04:45:13 2009 +0000
+++ b/core/stanza_router.lua	Sun Nov 22 04:50:42 2009 +0000
@@ -180,7 +180,7 @@
 			local xmlns = stanza.attr.xmlns;
 			--stanza.attr.xmlns = "jabber:server";
 			stanza.attr.xmlns = nil;
-			log("debug", "sending s2s stanza: %s", tostring(stanza));
+			log("debug", "sending s2s stanza: %s", tostring(stanza.top_tag and stanza:top_tag()) or stanza);
 			send_s2s(origin.host, host, stanza); -- TODO handle remote routing errors
 			stanza.attr.xmlns = xmlns; -- reset
 		else