Mercurial > prosody-hg
comparison plugins/mod_tls.lua @ 1938:82342e7f1b84
mod_tls: Catch s2s-stream-features and add starttls feature if possible
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 08 Oct 2009 23:41:59 +0100 |
| parents | e1c5b537f240 |
| children | 3d4c703d9333 |
comparison
equal
deleted
inserted
replaced
| 1937:9c700500f408 | 1938:82342e7f1b84 |
|---|---|
| 54 features:up(); | 54 features:up(); |
| 55 end | 55 end |
| 56 end | 56 end |
| 57 end); | 57 end); |
| 58 | 58 |
| 59 module:add_event_hook("s2s-stream-features", | 59 module:hook("s2s-stream-features", |
| 60 function (session, features) | 60 function (data) |
| 61 -- This hook is possibly called once per host (at least if the | 61 local session, features = data.session, data.features; |
| 62 -- remote server does not specify a to/from. | 62 if session.to_host and session.conn.starttls then |
| 63 if session.to_host and session.conn.starttls and not features:child_with_ns(xmlns_starttls) then | |
| 64 features:tag("starttls", starttls_attr):up(); | 63 features:tag("starttls", starttls_attr):up(); |
| 65 if secure_s2s_only then | 64 if secure_s2s_only then |
| 66 features:tag("required"):up():up(); | 65 features:tag("required"):up():up(); |
| 67 else | 66 else |
| 68 features:up(); | 67 features:up(); |
