Comparison

plugins/mod_tls.lua @ 6302:76699a0ae4c4

mod_lastactivity, mod_legacyauth, mod_presence, mod_saslauth, mod_tls: Use the newer stanza:get_child APIs and optimize away some table lookups
author Kim Alvefur <zash@zash.se>
date Fri, 04 Jul 2014 22:52:34 +0200
parent 6296:66fb7b7c668d
child 6487:edc63dc72566
comparison
equal deleted inserted replaced
6301:2fdd71b08126 6302:76699a0ae4c4
106 end); 106 end);
107 107
108 -- For s2sout connections, start TLS if we can 108 -- For s2sout connections, start TLS if we can
109 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) 109 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza)
110 module:log("debug", "Received features element"); 110 module:log("debug", "Received features element");
111 if can_do_tls(session) and stanza:child_with_ns(xmlns_starttls) then 111 if can_do_tls(session) and stanza:get_child("starttls", xmlns_starttls) then
112 module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host); 112 module:log("debug", "%s is offering TLS, taking up the offer...", session.to_host);
113 session.sends2s("<starttls xmlns='"..xmlns_starttls.."'/>"); 113 session.sends2s("<starttls xmlns='"..xmlns_starttls.."'/>");
114 return true; 114 return true;
115 end 115 end
116 end, 500); 116 end, 500);