From d1ee8e0f537fdc3c5b31557a021a9601544d9cd4 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 5 Jul 2009 20:40:31 +0500 Subject: mod_presence: Send unavailable presence to resources from non-available resources on disconnect --- plugins/mod_presence.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins') 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); -- cgit v1.2.3