Software /
code /
prosody
Comparison
plugins/mod_tls.lua @ 705:11afa1d88c55
mod_saslauth, mod_tls: minor code cleanup
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 13 Jan 2009 19:37:12 +0500 |
parent | 622:96848cf7f28c |
child | 758:b1885732e979 |
comparison
equal
deleted
inserted
replaced
704:ef8d0d339172 | 705:11afa1d88c55 |
---|---|
19 | 19 |
20 | 20 |
21 | 21 |
22 local st = require "util.stanza"; | 22 local st = require "util.stanza"; |
23 | 23 |
24 --local sessions = sessions; | |
25 | |
26 local t_insert = table.insert; | |
27 | |
28 local log = require "util.logger".init("mod_starttls"); | |
29 | |
30 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; | 24 local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; |
31 | 25 |
32 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, | 26 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
33 function (session, stanza) | 27 function (session, stanza) |
34 if session.conn.starttls then | 28 if session.conn.starttls then |
42 end | 36 end |
43 end); | 37 end); |
44 | 38 |
45 local starttls_attr = { xmlns = xmlns_starttls }; | 39 local starttls_attr = { xmlns = xmlns_starttls }; |
46 module:add_event_hook("stream-features", | 40 module:add_event_hook("stream-features", |
47 function (session, features) | 41 function (session, features) |
48 if session.conn.starttls then | 42 if session.conn.starttls then |
49 features:tag("starttls", starttls_attr):up(); | 43 features:tag("starttls", starttls_attr):up(); |
50 end | 44 end |
51 end); | 45 end); |