aboutsummaryrefslogtreecommitdiffstats
path: root/core/sessionmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-18 17:52:33 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-18 17:52:33 +0000
commit01c770997f61259d6e5b8ae5018aab1ef6ac0ef8 (patch)
treee58078b7e8fe4e6d58e6fdfb0be12fcea875ee29 /core/sessionmanager.lua
parentf4e09200420e410c608ef9b841a0669b5c0d88a9 (diff)
downloadprosody-01c770997f61259d6e5b8ae5018aab1ef6ac0ef8.tar.gz
prosody-01c770997f61259d6e5b8ae5018aab1ef6ac0ef8.zip
Quite some changes, to:
- Small logging fix for s2smanager - Send a stream error if an incoming s2s connection is to an unrecognised hostname (fixes #11) - init_xmlhandlers now takes a table of callbacks (includes changes to net/xmpp*_listener for this) - Move sending of unavailable presence to where it should be, sessionmanager.destroy_session - Fix sending of stream errors to wrong connection
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r--core/sessionmanager.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 33157567..fbfb7964 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -35,6 +35,16 @@ end
function destroy_session(session)
(session.log or log)("info", "Destroying session");
+
+ -- Send unavailable presence
+ if session.presence and session.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
+
+ -- Remove session/resource from user's session list
if session.host and session.username then
if session.resource then
hosts[session.host].sessions[session.username].sessions[session.resource] = nil;
@@ -46,8 +56,7 @@ function destroy_session(session)
end
end
end
- session.conn = nil;
- session.disconnect = nil;
+
for k in pairs(session) do
if k ~= "trace" then
session[k] = nil;