Mercurial > prosody-hg
comparison plugins/mod_tls.lua @ 438:193f9dd64f17
Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 27 Nov 2008 03:12:12 +0000 |
| parents | 17bcecb06420 |
| children | cccd610a0ef9 |
comparison
equal
deleted
inserted
replaced
| 437:c1a720db2157 | 438:193f9dd64f17 |
|---|---|
| 7 | 7 |
| 8 local log = require "util.logger".init("mod_starttls"); | 8 local log = require "util.logger".init("mod_starttls"); |
| 9 | 9 |
| 10 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; | 10 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
| 11 | 11 |
| 12 add_handler("c2s_unauthed", "starttls", xmlns_starttls, | 12 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
| 13 function (session, stanza) | 13 function (session, stanza) |
| 14 if session.conn.starttls then | 14 if session.conn.starttls then |
| 15 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); | 15 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); |
| 16 -- 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 |
| 17 -- sessions[session.conn] = nil; | 17 -- sessions[session.conn] = nil; |
| 23 session.log("warn", "Attempt to start TLS, but TLS is not available on this connection"); | 23 session.log("warn", "Attempt to start TLS, but TLS is not available on this connection"); |
| 24 end | 24 end |
| 25 end); | 25 end); |
| 26 | 26 |
| 27 local starttls_attr = { xmlns = xmlns_starttls }; | 27 local starttls_attr = { xmlns = xmlns_starttls }; |
| 28 add_event_hook("stream-features", | 28 module:add_event_hook("stream-features", |
| 29 function (session, features) | 29 function (session, features) |
| 30 if session.conn.starttls then | 30 if session.conn.starttls then |
| 31 features:tag("starttls", starttls_attr):up(); | 31 features:tag("starttls", starttls_attr):up(); |
| 32 end | 32 end |
| 33 end); | 33 end); |
