Merge 0.6 with waqas
[prosody.git] / plugins / mod_iq.lua
index 5be045335c478e256913228207d31fc76b6f3719..0e1dadfca4413d2bd64e64c4726fcecc82a58b11 100644 (file)
@@ -53,6 +53,18 @@ module:hook("iq/bare", function(data)
        end
 end);
 
+module:hook("iq/self", function(data)
+       -- IQ to bare JID recieved
+       local origin, stanza = data.origin, data.stanza;
+
+       if stanza.attr.type == "get" or stanza.attr.type == "set" then
+               return module:fire_event("iq/self/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name, data);
+       else
+               module:fire_event("iq/self/"..stanza.attr.id, data);
+               return true;
+       end
+end);
+
 module:hook("iq/host", function(data)
        -- IQ to a local host recieved
        local origin, stanza = data.origin, data.stanza;