diff options
-rw-r--r-- | core/stanza_router.lua | 1 | ||||
-rw-r--r-- | plugins/mod_iq.lua | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 71e40681..72ddebd1 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -140,6 +140,7 @@ function core_post_stanza(origin, stanza, preevents) to_type = '/host'; else to_type = '/bare'; + to_self = true; end end diff --git a/plugins/mod_iq.lua b/plugins/mod_iq.lua index 5be04533..0e1dadfc 100644 --- a/plugins/mod_iq.lua +++ b/plugins/mod_iq.lua @@ -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; |