Comparison

plugins/mod_carbons.lua @ 6841:be87ab2d611c

plugins: Explicitly return to halt event propagation (session.send sometimes does not return true)
author Kim Alvefur <zash@zash.se>
date Mon, 21 Sep 2015 23:06:22 +0200
parent 6804:9f40ae38f0de
child 7670:2be85cb3bc66
comparison
equal deleted inserted replaced
6840:eeefe8d42b8b 6841:be87ab2d611c
12 local function toggle_carbons(event) 12 local function toggle_carbons(event)
13 local origin, stanza = event.origin, event.stanza; 13 local origin, stanza = event.origin, event.stanza;
14 local state = stanza.tags[1].name; 14 local state = stanza.tags[1].name;
15 module:log("debug", "%s %sd carbons", origin.full_jid, state); 15 module:log("debug", "%s %sd carbons", origin.full_jid, state);
16 origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns; 16 origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns;
17 return origin.send(st.reply(stanza)); 17 origin.send(st.reply(stanza));
18 return true;
18 end 19 end
19 module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons); 20 module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons);
20 module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); 21 module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons);
21 22
22 local function message_handler(event, c2s) 23 local function message_handler(event, c2s)