10 local tostring = tostring; |
10 local tostring = tostring; |
11 |
11 |
12 local log = require "util.logger".init("mod_starttls"); |
12 local log = require "util.logger".init("mod_starttls"); |
13 |
13 |
14 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
14 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
15 |
|
16 local new_connhandler = require "net.connhandlers".new; |
|
17 |
15 |
18 add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
16 add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
19 function (session, stanza) |
17 function (session, stanza) |
20 if session.conn.starttls then |
18 if session.conn.starttls then |
21 send(session, st.stanza("proceed", { xmlns = xmlns_starttls })); |
19 send(session, st.stanza("proceed", { xmlns = xmlns_starttls })); |