Mercurial > prosody-modules
comparison mod_bind2/mod_bind2.lua @ 4794:d17a1581ea30
mod_bind2: Advertise stream feature
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 28 Nov 2021 19:59:26 +0100 |
| parents | aaa6f412dce3 |
| children | 8849b4f68534 |
comparison
equal
deleted
inserted
replaced
| 4793:aaa6f412dce3 | 4794:d17a1581ea30 |
|---|---|
| 4 local xmlns_bind2 --[[<const>]] = "urn:xmpp:bind2:0"; | 4 local xmlns_bind2 --[[<const>]] = "urn:xmpp:bind2:0"; |
| 5 local xmlns_carbons --[[<const>]] = "urn:xmpp:carbons:2"; | 5 local xmlns_carbons --[[<const>]] = "urn:xmpp:carbons:2"; |
| 6 | 6 |
| 7 module:depends("sasl2"); | 7 module:depends("sasl2"); |
| 8 module:depends("carbons"); | 8 module:depends("carbons"); |
| 9 | |
| 10 module:hook("stream-features", function(event) | |
| 11 local origin, features = event.origin, event.features; | |
| 12 if origin.type ~= "c2s_unauthed" then return end | |
| 13 features:tag("bind", xmlns_bind2):up(); | |
| 14 end); | |
| 9 | 15 |
| 10 module:hook_tag(xmlns_sasl2, "authenticate", function (session, auth) | 16 module:hook_tag(xmlns_sasl2, "authenticate", function (session, auth) |
| 11 session.bind2 = auth:get_child("bind", xmlns_bind2); | 17 session.bind2 = auth:get_child("bind", xmlns_bind2); |
| 12 end, 1); | 18 end, 1); |
| 13 | 19 |
