Comparison

mod_smacks/mod_smacks.lua @ 1527:06ecc5b3ca46

mod_smacks: Send failure correctly on s2s
author Kim Alvefur <zash@zash.se>
date Mon, 20 Oct 2014 11:55:08 +0200
parent 1526:120817435151
child 1528:5ccb3ee2cf72
comparison
equal deleted inserted replaced
1526:120817435151 1527:06ecc5b3ca46
136 136
137 function handle_enable(session, stanza, xmlns_sm) 137 function handle_enable(session, stanza, xmlns_sm)
138 local ok, err, err_text = can_do_smacks(session); 138 local ok, err, err_text = can_do_smacks(session);
139 if not ok then 139 if not ok then
140 session.log("warn", "Failed to enable smacks: %s", err_text); -- TODO: XEP doesn't say we can send error text, should it? 140 session.log("warn", "Failed to enable smacks: %s", err_text); -- TODO: XEP doesn't say we can send error text, should it?
141 session.send(st.stanza("failed", { xmlns = xmlns_sm }):tag(err, { xmlns = xmlns_errors})); 141 (session.sends2s or session.send)(st.stanza("failed", { xmlns = xmlns_sm }):tag(err, { xmlns = xmlns_errors}));
142 return true; 142 return true;
143 end 143 end
144 144
145 module:log("debug", "Enabling stream management"); 145 module:log("debug", "Enabling stream management");
146 session.smacks = xmlns_sm; 146 session.smacks = xmlns_sm;