# HG changeset patch # User Kim Alvefur # Date 1378335721 -7200 # Node ID 0d3d15586d7e426bc29117ab1a202d817fd015e3 # Parent 3acb01ca7e5ca0d736983635083be0238c5e0eb6 mod_carbons: Use iq-type events diff -r 3acb01ca7e5c -r 0d3d15586d7e mod_carbons/mod_carbons.lua --- a/mod_carbons/mod_carbons.lua Thu Sep 05 01:00:08 2013 +0200 +++ b/mod_carbons/mod_carbons.lua Thu Sep 05 01:02:01 2013 +0200 @@ -13,21 +13,18 @@ local function toggle_carbons(event) local origin, stanza = event.origin, event.stanza; - if stanza.attr.type == "set" then - local state = stanza.tags[1].attr.mode or stanza.tags[1].name; - module:log("debug", "%s %sd carbons", origin.full_jid, state); - origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns; - origin.send(st.reply(stanza)); - return true - end + local state = stanza.tags[1].attr.mode or stanza.tags[1].name; + module:log("debug", "%s %sd carbons", origin.full_jid, state); + origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns; + return origin.send(st.reply(stanza)); end -module:hook("iq/self/"..xmlns_carbons..":disable", toggle_carbons); -module:hook("iq/self/"..xmlns_carbons..":enable", toggle_carbons); +module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons); +module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); -- COMPAT -module:hook("iq/self/"..xmlns_carbons_old..":disable", toggle_carbons); -module:hook("iq/self/"..xmlns_carbons_old..":enable", toggle_carbons); -module:hook("iq/self/"..xmlns_carbons_really_old..":carbons", toggle_carbons); +module:hook("iq-set/self/"..xmlns_carbons_old..":disable", toggle_carbons); +module:hook("iq-set/self/"..xmlns_carbons_old..":enable", toggle_carbons); +module:hook("iq-set/self/"..xmlns_carbons_really_old..":carbons", toggle_carbons); local function message_handler(event, c2s) local origin, stanza = event.origin, event.stanza;