Comparison

plugins/mod_presence.lua @ 10694:0cda5d597607

mod_presence: Advertise support for Subscription Pre-Approval RFC 6121 §3.4 says: > If a server supports subscription pre-approvals, then it MUST > advertise the following stream feature during stream negotiation. The feature itself (#686) was added in f0e9e5bda415
author Kim Alvefur <zash@zash.se>
date Thu, 19 Mar 2020 00:10:15 +0100
parent 10556:79fe4ed1332b
child 10813:4a9ff4f61796
comparison
equal deleted inserted replaced
10693:76bb806cdd4b 10694:0cda5d597607
27 local sessionmanager = require "core.sessionmanager"; 27 local sessionmanager = require "core.sessionmanager";
28 28
29 local recalc_resource_map = require "util.presence".recalc_resource_map; 29 local recalc_resource_map = require "util.presence".recalc_resource_map;
30 30
31 local ignore_presence_priority = module:get_option_boolean("ignore_presence_priority", false); 31 local ignore_presence_priority = module:get_option_boolean("ignore_presence_priority", false);
32
33 local pre_approval_stream_feature = st.stanza("sub", {xmlns="urn:xmpp:features:pre-approval"});
34 module:hook("stream-features", function(event)
35 local origin, features = event.origin, event.features;
36 if origin.username then
37 features:add_child(pre_approval_stream_feature);
38 end
39 end);
32 40
33 function handle_normal_presence(origin, stanza) 41 function handle_normal_presence(origin, stanza)
34 if ignore_presence_priority then 42 if ignore_presence_priority then
35 local priority = stanza:get_child("priority"); 43 local priority = stanza:get_child("priority");
36 if priority and priority[1] ~= "0" then 44 if priority and priority[1] ~= "0" then