Changeset

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
parents 10693:76bb806cdd4b
children 10695:52886aad9ee1
files plugins/mod_presence.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Wed Mar 18 17:42:56 2020 +0000
+++ b/plugins/mod_presence.lua	Thu Mar 19 00:10:15 2020 +0100
@@ -30,6 +30,14 @@
 
 local ignore_presence_priority = module:get_option_boolean("ignore_presence_priority", false);
 
+local pre_approval_stream_feature = st.stanza("sub", {xmlns="urn:xmpp:features:pre-approval"});
+module:hook("stream-features", function(event)
+	local origin, features = event.origin, event.features;
+	if origin.username then
+		features:add_child(pre_approval_stream_feature);
+	end
+end);
+
 function handle_normal_presence(origin, stanza)
 	if ignore_presence_priority then
 		local priority = stanza:get_child("priority");