mod_iq: Limit sub-events to get and set IQs

Tue, 02 Jun 2009 20:18:02 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Tue, 02 Jun 2009 20:18:02 +0500
changeset 1288
d2dc0954ebfd
parent 1287
ac82c7b9c76b
child 1289
d0c38cac1687

mod_iq: Limit sub-events to get and set IQs

plugins/mod_iq.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_iq.lua	Tue Jun 02 20:15:18 2009 +0500
+++ b/plugins/mod_iq.lua	Tue Jun 02 20:18:02 2009 +0500
@@ -37,7 +37,7 @@
 		end
 	end
 	-- TODO fire post processing events
-	if #stanza.tags == 1 then
+	if stanza.attr.type == "get" or stanza.attr.type == "set" then
 		return module:fire_event("iq/bare/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
 	else
 		return true; -- TODO do something with results and errors
@@ -48,7 +48,7 @@
 	-- IQ to a local host recieved
 	local origin, stanza = data.origin, data.stanza;
 
-	if #stanza.tags == 1 then
+	if stanza.attr.type == "get" or stanza.attr.type == "set" then
 		return module:fire_event("iq/host/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
 	else
 		return true; -- TODO do something with results and errors

mercurial