Software /
code /
prosody
Comparison
plugins/mod_tls.lua @ 316:13e2bd256a20
Fixed mod_tls to use session.send for sending stanzas
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 16 Nov 2008 05:03:21 +0500 |
parent | 303:89e8f53b870e |
child | 357:17bcecb06420 |
comparison
equal
deleted
inserted
replaced
315:4df26c981728 | 316:13e2bd256a20 |
---|---|
1 | 1 |
2 local st = require "util.stanza"; | 2 local st = require "util.stanza"; |
3 local send = require "core.sessionmanager".send_to_session; | |
4 | 3 |
5 --local sessions = sessions; | 4 --local sessions = sessions; |
6 | 5 |
7 local t_insert = table.insert; | 6 local t_insert = table.insert; |
8 | 7 |
11 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; | 10 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
12 | 11 |
13 add_handler("c2s_unauthed", "starttls", xmlns_starttls, | 12 add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
14 function (session, stanza) | 13 function (session, stanza) |
15 if session.conn.starttls then | 14 if session.conn.starttls then |
16 send(session, st.stanza("proceed", { xmlns = xmlns_starttls })); | 15 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); |
17 -- FIXME: I'm commenting the below, not sure why it was necessary | 16 -- FIXME: I'm commenting the below, not sure why it was necessary |
18 -- sessions[session.conn] = nil; | 17 -- sessions[session.conn] = nil; |
19 session:reset_stream(); | 18 session:reset_stream(); |
20 session.conn.starttls(); | 19 session.conn.starttls(); |
21 session.log("info", "TLS negotiation started..."); | 20 session.log("info", "TLS negotiation started..."); |