diff options
author | Waqas Hussain <waqas20@gmail.com> | 2008-10-23 21:51:00 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2008-10-23 21:51:00 +0500 |
commit | 98a409f8b417a5b0600b7b60a5ed6598bfc0dd20 (patch) | |
tree | 9bf6c746e90f9a5a6a07c1a046959f2654690729 /net | |
parent | aa5e75a22e06ca2bf0ee70370ce4e430893ac807 (diff) | |
parent | 3286f0609f034a3b9814a3d7df4151008554f992 (diff) | |
download | prosody-98a409f8b417a5b0600b7b60a5ed6598bfc0dd20.tar.gz prosody-98a409f8b417a5b0600b7b60a5ed6598bfc0dd20.zip |
Merged from Matthew
Diffstat (limited to 'net')
-rw-r--r-- | net/xmppclient_listener.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index 7d5b3abe..e722e55b 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -69,6 +69,19 @@ function xmppclient.listener(conn, data) end function xmppclient.disconnect(conn) + local session = sessions[conn]; + if session then + if session.last_presence and session.last_presence.attr.type ~= "unavailable" then + local pres = st.presence{ type = "unavailable" }; + if err == "closed" then err = "connection closed"; end + pres:tag("status"):text("Disconnected: "..err); + session.stanza_dispatch(pres); + end + sm_destroy_session(session); + sessions[conn] = nil; + session = nil; + collectgarbage("collect"); + end end connlisteners_register("xmppclient", xmppclient); |