Comparison

plugins/mod_pubsub/mod_pubsub.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 6657:f1af4edd5722
child 6843:161cccfdf015
child 7708:c420a38db5ef
comparison
equal deleted inserted replaced
6840:eeefe8d42b8b 6841:be87ab2d611c
26 function handle_pubsub_iq(event) 26 function handle_pubsub_iq(event)
27 local origin, stanza = event.origin, event.stanza; 27 local origin, stanza = event.origin, event.stanza;
28 local pubsub = stanza.tags[1]; 28 local pubsub = stanza.tags[1];
29 local action = pubsub.tags[1]; 29 local action = pubsub.tags[1];
30 if not action then 30 if not action then
31 return origin.send(st.error_reply(stanza, "cancel", "bad-request")); 31 origin.send(st.error_reply(stanza, "cancel", "bad-request"));
32 return true;
32 end 33 end
33 local handler = handlers[stanza.attr.type.."_"..action.name]; 34 local handler = handlers[stanza.attr.type.."_"..action.name];
34 if handler then 35 if handler then
35 handler(origin, stanza, action, service); 36 handler(origin, stanza, action, service);
36 return true; 37 return true;