Changeset

4967:b7bcf088e723

mod_presence: Handle nil disconnection error
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Jul 2012 17:02:18 +0100
parents 4966:073eff2853a1
children 4968:a6d3ac11a7af
files plugins/mod_presence.lua
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Sun Jul 22 17:01:52 2012 +0100
+++ b/plugins/mod_presence.lua	Sun Jul 22 17:02:18 2012 +0100
@@ -352,13 +352,15 @@
 	-- 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);