mod_presence: Respond with an unavailable presence when subscribers probe and no resources are available.

Fri, 29 Jan 2010 18:16:39 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Fri, 29 Jan 2010 18:16:39 +0500
changeset 2525
e385511b3a54
parent 2524
b427f5401ce7
child 2526
401ff68413a1
child 2530
26c1f27eb35d

mod_presence: Respond with an unavailable presence when subscribers probe and no resources are available.

plugins/mod_presence.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_presence.lua	Fri Jan 29 13:02:06 2010 +0000
+++ b/plugins/mod_presence.lua	Fri Jan 29 18:16:39 2010 +0500
@@ -217,7 +217,7 @@
 	if stanza.attr.type == "probe" then
 		if rostermanager.is_contact_subscribed(node, host, from_bare) then
 			if 0 == send_presence_of_available_resources(node, host, st_from, origin, core_route_stanza) then
-				-- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
+				core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- TODO send last activity
 			end
 		else
 			core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unsubscribed"}));
@@ -227,7 +227,7 @@
 			core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="subscribed"})); -- already subscribed
 			-- Sending presence is not clearly stated in the RFC, but it seems appropriate
 			if 0 == send_presence_of_available_resources(node, host, from_bare, origin, core_route_stanza) then
-				-- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
+				core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- TODO send last activity
 			end
 		else
 			core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- acknowledging receipt

mercurial