# HG changeset patch # User Kim Alvefur # Date 1378335608 -7200 # Node ID 3acb01ca7e5ca0d736983635083be0238c5e0eb6 # Parent 547b3c05cc0660b0a1a313a0e09a0af8a8142f97 mod_carbons: Handle enabled/disable with the same callback for all versions diff -r 547b3c05cc06 -r 3acb01ca7e5c mod_carbons/mod_carbons.lua --- a/mod_carbons/mod_carbons.lua Tue Sep 03 11:19:31 2013 +0100 +++ b/mod_carbons/mod_carbons.lua Thu Sep 05 01:00:08 2013 +0200 @@ -14,7 +14,7 @@ local function toggle_carbons(event) local origin, stanza = event.origin, event.stanza; if stanza.attr.type == "set" then - local state = stanza.tags[1].name; + 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)); @@ -27,19 +27,7 @@ -- COMPAT module:hook("iq/self/"..xmlns_carbons_old..":disable", toggle_carbons); module:hook("iq/self/"..xmlns_carbons_old..":enable", toggle_carbons); - --- COMPAT :( -if module:get_option_boolean("carbons_v0") then - module:hook("iq/self/"..xmlns_carbons_really_old..":carbons", function(event) - local origin, stanza = event.origin, event.stanza; - if stanza.attr.type == "set" then - local state = stanza.tags[1].attr.mode; - origin.want_carbons = state == "enable" and xmlns_carbons_really_old; - origin.send(st.reply(stanza)); - return true; - end - end); -end +module:hook("iq/self/"..xmlns_carbons_really_old..":carbons", toggle_carbons); local function message_handler(event, c2s) local origin, stanza = event.origin, event.stanza;