Changeset

140:9a632cf13f51

mod_sift: Don't sift IQ errors and results.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 06 Mar 2010 22:23:25 +0500
parents 139:3165e56f96a1
children 141:b42a88eba9ba
files mod_sift/mod_sift.lua
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_sift/mod_sift.lua	Sat Mar 06 22:21:38 2010 +0500
+++ b/mod_sift/mod_sift.lua	Sat Mar 06 22:23:25 2010 +0500
@@ -94,12 +94,14 @@
 module:hook("iq/full", function(event)
 	local origin, stanza = event.origin, event.stanza;
 	local siftdata = data[stanza.attr.to];
-	if siftdata and siftdata.iq then -- we seem to have an IQ filter
-		local tag = stanza.tags[1]; -- the IQ child
-		if not siftdata.iq[(tag.attr.xmlns or "jabber:client").."|"..tag.name] then
-			-- element not allowed; sending back generic error
-			origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
-			return true;
+	if stanza.attr.type == "get" or stanza.attr.type == "set" then
+		if siftdata and siftdata.iq then -- we seem to have an IQ filter
+			local tag = stanza.tags[1]; -- the IQ child
+			if not siftdata.iq[(tag.attr.xmlns or "jabber:client").."|"..tag.name] then
+				-- element not allowed; sending back generic error
+				origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+				return true;
+			end
 		end
 	end
 end, 50);