Changeset

1278:2abf85791f29

mod_presence: A little cleanup
author Waqas Hussain <waqas20@gmail.com>
date Tue, 02 Jun 2009 07:26:40 +0500
parents 1277:f2b50efe8d44
children 1279:fa00d56a9fd3
files plugins/mod_presence.lua
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Tue Jun 02 07:23:28 2009 +0500
+++ b/plugins/mod_presence.lua	Tue Jun 02 07:26:40 2009 +0500
@@ -273,19 +273,20 @@
 end
 
 module:hook("pre-presence/full", function(data)
-	-- presence to full JID recieved
+	-- outbound presence to full JID recieved
 	local origin, stanza = data.origin, data.stanza;
 
-	if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then
+	local t = stanza.attr.type;
+	if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes sent to full JID
 		handle_outbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to), core_route_stanza);
 		return true;
 	end
-	
+
 	local to = stanza.attr.to;
 	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 {};
-		if stanza.attr.type then -- removing from directed presence list on sending an error or unavailable
+		if t 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?