Software /
code /
prosody
Comparison
plugins/mod_tls.lua @ 2595:015934e20f03
mod_tls: Switched to new events API.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 01:56:18 +0500 |
parent | 2594:ab52fdd9f5d0 |
child | 2596:187cd90860cb |
comparison
equal
deleted
inserted
replaced
2594:ab52fdd9f5d0 | 2595:015934e20f03 |
---|---|
42 -- FIXME: What reply? | 42 -- FIXME: What reply? |
43 session.log("warn", "Attempt to start TLS, but TLS is not available on this s2s connection"); | 43 session.log("warn", "Attempt to start TLS, but TLS is not available on this s2s connection"); |
44 end | 44 end |
45 end | 45 end |
46 | 46 |
47 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, c2s_starttls_handler); | 47 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event) |
48 module:add_handler("s2sin_unauthed", "starttls", xmlns_starttls, s2s_starttls_handler); | 48 local origin, stanza = event.origin, event.stanza; |
49 if origin.type == "c2s_unauthed" then | |
50 c2s_starttls_handler(origin, stanza); | |
51 elseif origin.type == "s2sin_unauthed" then | |
52 s2s_starttls_handler(origin, stanza); | |
53 else | |
54 -- FIXME: What reply? | |
55 origin.log("warn", "Attempt to start TLS, but TLS is not available on this %s connection", origin.type); | |
56 end | |
57 return true; | |
58 end); | |
49 | 59 |
50 | 60 |
51 local starttls_attr = { xmlns = xmlns_starttls }; | 61 local starttls_attr = { xmlns = xmlns_starttls }; |
52 module:add_event_hook("stream-features", | 62 module:add_event_hook("stream-features", |
53 function (session, features) | 63 function (session, features) |