aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-15 19:32:58 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-15 19:32:58 +0000
commitcd80b1c71dfd4baa325d00263bcd42d5094a2c92 (patch)
tree6ef0802edd52d8383ba551e53f71df9e20c92812
parent62ee1df6b6c30f47a093bbbb12f3939ca39227be (diff)
downloadprosody-cd80b1c71dfd4baa325d00263bcd42d5094a2c92.tar.gz
prosody-cd80b1c71dfd4baa325d00263bcd42d5094a2c92.zip
Fix logging of disconnect reason, and also sending of unavailable presence on disconnect
-rw-r--r--net/xmppclient_listener.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua
index 914dd78e..b475237f 100644
--- a/net/xmppclient_listener.lua
+++ b/net/xmppclient_listener.lua
@@ -73,15 +73,16 @@ function xmppclient.listener(conn, data)
end
end
-function xmppclient.disconnect(conn)
+function xmppclient.disconnect(conn, err)
local session = sessions[conn];
if session then
- if session.last_presence and session.last_presence.attr.type ~= "unavailable" then
+ if session.presence and session.presence.attr.type ~= "unavailable" then
local pres = st.presence{ type = "unavailable" };
- if err == "closed" then err = "connection closed"; end --FIXME where did err come from?
+ if err == "closed" then err = "connection closed"; end
pres:tag("status"):text("Disconnected: "..err);
session.stanza_dispatch(pres);
end
+ session.log("info", "Client disconnected: %s", err);
sm_destroy_session(session);
sessions[conn] = nil;
session = nil;