Software /
code /
prosody-modules
Changeset
1184:0d3d15586d7e
mod_carbons: Use iq-type events
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 05 Sep 2013 01:02:01 +0200 |
parents | 1183:3acb01ca7e5c |
children | 1185:30b681898c2d |
files | mod_carbons/mod_carbons.lua |
diffstat | 1 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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;