aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-05 20:40:31 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-05 20:40:31 +0500
commitd1ee8e0f537fdc3c5b31557a021a9601544d9cd4 (patch)
treeb19576c03fcd22aeeeedce9f6f864f62399bcae1 /plugins/mod_presence.lua
parent44ba02eef0075861e2398dfb5959288c9330f781 (diff)
downloadprosody-d1ee8e0f537fdc3c5b31557a021a9601544d9cd4.tar.gz
prosody-d1ee8e0f537fdc3c5b31557a021a9601544d9cd4.zip
mod_presence: Send unavailable presence to resources from non-available resources on disconnect
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 4fa9f431..89136e3d 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -324,5 +324,14 @@ module:hook("resource-unbind", function(event)
if not(err) or err == "closed" then err = "connection closed"; end
pres:tag("status"):text("Disconnected: "..err):up();
session:dispatch_stanza(pres);
+ elseif session.directed 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();
+ for jid in pairs(session.directed) do
+ pres.attr.to = jid;
+ core_route_stanza(session, pres);
+ end
+ session.directed = nil;
end
end);