From 38dc47caaef527891f068fb666af55f41ee3cb5b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 21 Nov 2009 13:47:45 +0000 Subject: s2smanager: Don't tostring() the data before sending, sends2s already does this. --- core/s2smanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 4c61eaa3..aa6de317 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -391,7 +391,7 @@ function streamopened(session, attr) if send_buffer and #send_buffer > 0 then log("debug", "Sending s2s send_buffer now..."); for i, data in ipairs(send_buffer) do - session.sends2s(tostring(data)); + session.sends2s(data); send_buffer[i] = nil; end end -- cgit v1.2.3 From c3ed7fbfced3ef8d3cb76185106bed6270104783 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 21 Nov 2009 13:49:48 +0000 Subject: s2smanager: Don't log full stanza when sending outwards --- core/s2smanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index aa6de317..d8edaed0 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -128,7 +128,7 @@ function new_incoming(conn) 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(tostring(t)); end + session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^([^>]*>?)")); w(tostring(t)); end incoming_s2s[session] = true; add_task(connect_timeout, function () if session.conn ~= conn or @@ -317,7 +317,7 @@ function make_connect(host_session, connect_host, connect_port) 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(tostring(t)); end + host_session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?")); w(tostring(t)); end conn.write(format([[]], from_host, to_host)); log("debug", "Connection attempt in progress..."); -- cgit v1.2.3 From 2b75fe3807dcaa4aeafbe8adb864c8540933e8e3 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 21 Nov 2009 23:04:26 +0000 Subject: objectmanager: Convert to unix line-endings --- core/objectmanager.lua | 120 ++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'core') diff --git a/core/objectmanager.lua b/core/objectmanager.lua index e96cbd90..293622c9 100644 --- a/core/objectmanager.lua +++ b/core/objectmanager.lua @@ -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; -- cgit v1.2.3 From 87edc64c11a5f38229c915f32165bccd2de65a84 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 22 Nov 2009 04:46:48 +0000 Subject: stanza_router: Don't log full stanzas destined for s2s --- core/stanza_router.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 00c37ed7..ad312b85 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -180,7 +180,7 @@ function core_route_stanza(origin, stanza) 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 -- cgit v1.2.3