Software /
code /
prosody
Changeset
275:7af22e56d625
Fix logging of disconnect reason, and also sending of unavailable presence on disconnect
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 15 Nov 2008 19:32:58 +0000 |
parents | 274:9e68a697435d |
children | 290:f9b7afd42b67 |
files | net/xmppclient_listener.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/net/xmppclient_listener.lua Sat Nov 15 19:13:28 2008 +0000 +++ b/net/xmppclient_listener.lua Sat Nov 15 19:32:58 2008 +0000 @@ -73,15 +73,16 @@ 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;