From 87ffa5ec0f9f2860a5ae44342cce3336d4d42561 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 26 Jun 2009 06:32:45 +0100 Subject: xmppclient_listener: Pass session close reason to destroy_session (to be used in unavailable presence) --- net/xmppclient_listener.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index 617f0467..5e1a1ba3 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -95,7 +95,7 @@ local function session_close(session, reason) end session.send(""); session.conn.close(); - xmppclient.disconnect(session.conn, "stream error"); + xmppclient.disconnect(session.conn, reason.condition or reason or "session closed"); end end @@ -136,7 +136,7 @@ function xmppclient.disconnect(conn, err) local session = sessions[conn]; if session then (session.log or log)("info", "Client disconnected: %s", err); - sm_destroy_session(session); + sm_destroy_session(session, err); sessions[conn] = nil; session = nil; collectgarbage("collect"); -- cgit v1.2.3 From a01f4e62493a01afa9813c2197596854b62c7b71 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 26 Jun 2009 15:35:20 +0100 Subject: mod_message: Advertise offline message support as per XEP-0160 (thanks nolan) --- plugins/mod_message.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua index 72ccfdd0..b56aef0a 100644 --- a/plugins/mod_message.lua +++ b/plugins/mod_message.lua @@ -67,3 +67,5 @@ module:hook("message/bare", function(data) return process_to_bare(stanza.attr.to or (origin.username..'@'..origin.host), origin, stanza); end); + +module:add_feature("msgoffline"); -- cgit v1.2.3 From fc9b65727f9c551518e6b2c9844f45a36b2bcabc Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 28 Jun 2009 02:46:36 +0100 Subject: mod_console: Reload/unload a module on a component host if it is loaded there --- plugins/mod_console.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index 9be37db4..0f2c6711 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -162,7 +162,7 @@ end def_env.module = {}; -local function get_hosts_set(hosts) +local function get_hosts_set(hosts, module) if type(hosts) == "table" then if hosts[1] then return set.new(hosts); @@ -172,8 +172,9 @@ local function get_hosts_set(hosts) elseif type(hosts) == "string" then return set.new { hosts }; elseif hosts == nil then + local mm = require "modulemanager"; return set.new(array.collect(keys(prosody.hosts))) - / function (host) return prosody.hosts[host].type == "local"; end; + / function (host) return prosody.hosts[host].type == "local" or module and mm.is_loaded(host, module); end; end end @@ -203,7 +204,7 @@ end function def_env.module:unload(name, hosts) local mm = require "modulemanager"; - hosts = get_hosts_set(hosts); + hosts = get_hosts_set(hosts, name); -- Unload the module for each host local ok, err, count = true, nil, 0; @@ -225,7 +226,7 @@ end function def_env.module:reload(name, hosts) local mm = require "modulemanager"; - hosts = get_hosts_set(hosts); + hosts = get_hosts_set(hosts, name); -- Reload the module for each host local ok, err, count = true, nil, 0; -- cgit v1.2.3 From f7672bd5078988da630ee66844433e5a3c2476bf Mon Sep 17 00:00:00 2001 From: nolan Date: Sun, 28 Jun 2009 08:09:57 -0500 Subject: Log stanza if stanza.to isn't set for some component errors. --- core/componentmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/componentmanager.lua b/core/componentmanager.lua index eb18fced..e375e3bd 100644 --- a/core/componentmanager.lua +++ b/core/componentmanager.lua @@ -75,7 +75,7 @@ function handle_stanza(origin, stanza) log("debug", "%s stanza being handled by component: %s", stanza.name, host); component(origin, stanza, hosts[host]); else - log("error", "Component manager recieved a stanza for a non-existing component: " .. stanza.attr.to); + log("error", "Component manager recieved a stanza for a non-existing component: " .. (stanza.attr.to or stanza)); end end -- cgit v1.2.3 From 0e37b231f247e5a7a0f0fb19b7f4239a3a1b3b68 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 28 Jun 2009 14:17:07 +0100 Subject: net.httpserver: Don't upset logger when response is nil --- net/httpserver.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/httpserver.lua b/net/httpserver.lua index af23a91d..8ce25f35 100644 --- a/net/httpserver.lua +++ b/net/httpserver.lua @@ -52,7 +52,7 @@ local function send_response(request, response) end else -- Response we have is just a string (the body) - log("debug", "Sending response to %s: %s", request.id, response); + log("debug", "Sending response to %s: %s", request.id or "", response or ""); resp = { "HTTP/1.0 200 OK\r\n" }; t_insert(resp, "Connection: close\r\n"); -- cgit v1.2.3