Software /
code /
prosody-modules
Comparison
mod_invites_register/mod_invites_register.lua @ 4673:eee7ef8eb0a2
mod_invites_register: advertise new stream feature from XEP-0445
Continue to advertise the older one for backwards-compatibility.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 09 Sep 2021 14:39:13 +0100 |
parent | 4599:06c9c9ef0a51 |
child | 4907:4aecf78cc39d |
comparison
equal
deleted
inserted
replaced
4672:0b084f63fed0 | 4673:eee7ef8eb0a2 |
---|---|
10 local invites; | 10 local invites; |
11 if prosody.shutdown then -- COMPAT hack to detect prosodyctl | 11 if prosody.shutdown then -- COMPAT hack to detect prosodyctl |
12 invites = module:depends("invites"); | 12 invites = module:depends("invites"); |
13 end | 13 end |
14 | 14 |
15 local invite_stream_feature = st.stanza("register", { xmlns = "urn:xmpp:invite" }):up(); | 15 local legacy_invite_stream_feature = st.stanza("register", { xmlns = "urn:xmpp:invite" }):up(); |
16 local invite_stream_feature = st.stanza("register", { xmlns = "urn:xmpp:ibr-token:0" }):up(); | |
16 module:hook("stream-features", function(event) | 17 module:hook("stream-features", function(event) |
17 local session, features = event.origin, event.features; | 18 local session, features = event.origin, event.features; |
18 | 19 |
19 -- Advertise to unauthorized clients only. | 20 -- Advertise to unauthorized clients only. |
20 if session.type ~= "c2s_unauthed" or (require_encryption and not session.secure) then | 21 if session.type ~= "c2s_unauthed" or (require_encryption and not session.secure) then |
21 return | 22 return |
22 end | 23 end |
23 | 24 |
25 features:add_child(legacy_invite_stream_feature); | |
24 features:add_child(invite_stream_feature); | 26 features:add_child(invite_stream_feature); |
25 end); | 27 end); |
26 | 28 |
27 -- XEP-0379: Pre-Authenticated Roster Subscription | 29 -- XEP-0379: Pre-Authenticated Roster Subscription |
28 module:hook("presence/bare", function (event) | 30 module:hook("presence/bare", function (event) |