Diff

plugins/mod_pep.lua @ 1429:51cfb152cb38

mod_pep: Ignore presence subscriptions when extractng hash information
author Waqas Hussain <waqas20@gmail.com>
date Fri, 26 Jun 2009 23:42:59 +0500
parent 1428:02e97e716675
child 1430:39169cf8d36f
line wrap: on
line diff
--- a/plugins/mod_pep.lua	Fri Jun 26 23:36:12 2009 +0500
+++ b/plugins/mod_pep.lua	Fri Jun 26 23:42:59 2009 +0500
@@ -49,7 +49,8 @@
 end
 
 local function get_caps_hash_from_presence(stanza, current)
-	if not stanza.attr.type then
+	local t = stanza.attr.type;
+	if not t then
 		for _, child in pairs(stanza.tags) do
 			if child.name == "c" and child.attr.xmlns == "http://jabber.org/protocol/caps" then
 				local attr = child.attr;
@@ -61,8 +62,10 @@
 				return; -- bad caps format
 			end
 		end
-		return current; -- no caps, could mean caps optimization, so return current
+	elseif t == "unavailable" or t == "error" then
+		return;
 	end
+	return current; -- no caps, could mean caps optimization, so return current
 end
 
 module:hook("presence/bare", function(event)