Changeset

4702:7009e16192fa

mod_tlsfail: Add c2s support
author Kim Alvefur <zash@zash.se>
date Sun, 03 Oct 2021 17:04:05 +0200
parents 4701:efdc3e4dc5df
children 4703:94df7986a874
files mod_tlsfail/mod_tlsfail.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_tlsfail/mod_tlsfail.lua	Fri Oct 01 16:58:37 2021 +0200
+++ b/mod_tlsfail/mod_tlsfail.lua	Sun Oct 03 17:04:05 2021 +0200
@@ -5,6 +5,11 @@
 local s2s_feature = st.stanza("starttls", starttls_attr);
 local starttls_failure = st.stanza("failure", starttls_attr);
 
+module:hook("stream-features", function(event)
+	local features = event.features;
+	features:add_child(s2s_feature);
+end);
+
 module:hook("s2s-stream-features", function(event)
 	local features = event.features;
 	features:add_child(s2s_feature);
@@ -13,7 +18,7 @@
 -- Hook <starttls/>
 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event)
 	local origin = event.origin;
-	origin.sends2s(starttls_failure);
+	(origin.sends2s or origin.send)(starttls_failure);
 	origin:close();
 	return true;
 end);