aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-05 17:45:44 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-05 17:45:44 +0500
commit44ba02eef0075861e2398dfb5959288c9330f781 (patch)
tree61bf18c6f57c5f3949be1c692e27d4fc2a4cf10f /plugins/mod_presence.lua
parent0d65c3fef770ea2491514c981b73d1743ddf7b68 (diff)
downloadprosody-44ba02eef0075861e2398dfb5959288c9330f781.tar.gz
prosody-44ba02eef0075861e2398dfb5959288c9330f781.zip
Moved automatic unavailable presence generation on disconnect from sessionmanager to mod_presence
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 9ae068c2..4fa9f431 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -315,3 +315,14 @@ module:hook("presence/full", function(data)
end -- resource not online, discard
return true;
end);
+
+module:hook("resource-unbind", function(event)
+ local session, err = event.session, event.error;
+ -- Send unavailable presence
+ if session.presence then
+ local pres = st.presence{ type = "unavailable" };
+ if not(err) or err == "closed" then err = "connection closed"; end
+ pres:tag("status"):text("Disconnected: "..err):up();
+ session:dispatch_stanza(pres);
+ end
+end);