mod_presence: Remove JIDs from directed presence list on sending error or unavailable presence

Tue, 02 Jun 2009 07:23:28 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Tue, 02 Jun 2009 07:23:28 +0500
changeset 1277
f2b50efe8d44
parent 1276
d0e80c1578e1
child 1278
2abf85791f29

mod_presence: Remove JIDs from directed presence list on sending error or unavailable presence

plugins/mod_presence.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_presence.lua	Tue Jun 02 07:22:16 2009 +0500
+++ b/plugins/mod_presence.lua	Tue Jun 02 07:23:28 2009 +0500
@@ -285,6 +285,10 @@
 	local to_bare = jid_bare(to);
 	if not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence
 		origin.directed = origin.directed or {};
-		origin.directed[to] = true; -- FIXME does it make more sense to add to_bare rather than to?
+		if stanza.attr.type then -- removing from directed presence list on sending an error or unavailable
+			origin.directed[to] = nil; -- FIXME does it make more sense to add to_bare rather than to?
+		else
+			origin.directed[to] = true; -- FIXME does it make more sense to add to_bare rather than to?
+		end
 	end
 end);

mercurial