Software /
code /
prosody-modules
Changeset
1183:3acb01ca7e5c
mod_carbons: Handle enabled/disable with the same callback for all versions
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 05 Sep 2013 01:00:08 +0200 |
parents | 1182:547b3c05cc06 |
children | 1184:0d3d15586d7e |
files | mod_carbons/mod_carbons.lua |
diffstat | 1 files changed, 2 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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;