aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-19 05:07:52 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-19 05:07:52 +0000
commit8b041f3cdbc219dc78f884e6418c83d03b867a5a (patch)
tree6c3799a4c2ac37a81a6a30cf545e5b6f786565d1
parentb32558393fb6cc5f8c04304e74f8dc20e556792b (diff)
downloadprosody-8b041f3cdbc219dc78f884e6418c83d03b867a5a.tar.gz
prosody-8b041f3cdbc219dc78f884e6418c83d03b867a5a.zip
Fix sending of unavailable presence on disconnect
-rw-r--r--core/sessionmanager.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index 74edb86c..7a0d6a49 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -14,6 +14,8 @@ local error = error;
local uuid_generate = require "util.uuid".generate;
local rm_load_roster = require "core.rostermanager".load_roster;
+local st = require "util.stanza";
+
local newproxy = newproxy;
local getmetatable = getmetatable;
@@ -33,13 +35,13 @@ function new_session(conn)
return session;
end
-function destroy_session(session)
+function destroy_session(session, err)
(session.log or log)("info", "Destroying session");
-- Send unavailable presence
if session.presence then
local pres = st.presence{ type = "unavailable" };
- if err == "closed" then err = "connection closed"; end
+ if (not err) or err == "closed" then err = "connection closed"; end
pres:tag("status"):text("Disconnected: "..err);
session.stanza_dispatch(pres);
end