From 3bdb9e7da9470303b85edf4aea0131d79839b281 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 22 Jul 2012 17:02:18 +0100 Subject: mod_presence: Handle nil disconnection error --- plugins/mod_presence.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'plugins/mod_presence.lua') diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 6d039d83..09a6f9f2 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -352,13 +352,15 @@ module:hook("resource-unbind", function(event) -- Send unavailable presence if session.presence then local pres = st.presence{ type = "unavailable" }; - if not(err) or err == "closed" then err = "connection closed"; end - pres:tag("status"):text("Disconnected: "..err):up(); + if err then + pres:tag("status"):text("Disconnected: "..err):up(); + end session:dispatch_stanza(pres); elseif session.directed then local pres = st.presence{ type = "unavailable", from = session.full_jid }; - if not(err) or err == "closed" then err = "connection closed"; end - pres:tag("status"):text("Disconnected: "..err):up(); + if err then + pres:tag("status"):text("Disconnected: "..err):up(); + end for jid in pairs(session.directed) do pres.attr.to = jid; core_post_stanza(session, pres, true); -- cgit v1.2.3 From e89b006f03f692a7e807c54757f0623302c40b85 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 23 Jul 2012 17:32:33 +0100 Subject: Hopefully inert commit to clean up logging across a number of modules, removing all cases of concatenation when building log messages --- plugins/mod_presence.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/mod_presence.lua') diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 09a6f9f2..3cac0973 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -160,7 +160,7 @@ function send_presence_of_available_resources(user, host, jid, recipient_session end end end - log("debug", "broadcasted presence of "..count.." resources from "..user.."@"..host.." to "..jid); + log("debug", "broadcasted presence of %d resources from %s@%s to %s", count, user, host, jid); return count; end @@ -169,7 +169,7 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_ if to_bare == from_bare then return; end -- No self contacts local st_from, st_to = stanza.attr.from, stanza.attr.to; stanza.attr.from, stanza.attr.to = from_bare, to_bare; - log("debug", "outbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); + log("debug", "outbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare); if stanza.attr.type == "probe" then stanza.attr.from, stanza.attr.to = st_from, st_to; return; @@ -214,7 +214,7 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b local node, host = jid_split(to_bare); local st_from, st_to = stanza.attr.from, stanza.attr.to; stanza.attr.from, stanza.attr.to = from_bare, to_bare; - log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); + log("debug", "inbound presence %s from %s for %s", stanza.attr.type, from_bare, to_bare); if stanza.attr.type == "probe" then local result, err = rostermanager.is_contact_subscribed(node, host, from_bare); -- cgit v1.2.3 From 9114e88ee0cf86ca0ffe500e089389e54bb730ec Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 26 Jul 2012 04:33:17 +0200 Subject: mod_admin_adhoc, mod_admin_telnet, mod_bosh, mod_c2s, mod_component, mod_pep, mod_presence, mod_roster, mod_s2s: Import core_post_stanza from the global prosody table. --- plugins/mod_presence.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/mod_presence.lua') diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 3cac0973..dac86ae6 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -14,6 +14,7 @@ local t_concat, t_insert = table.concat, table.insert; local s_find = string.find; local tonumber = tonumber; +local core_post_stanza = prosody.core_post_stanza; local st = require "util.stanza"; local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; -- cgit v1.2.3