plugins/mod_tls.lua

changeset 1894
53f34ba6f6d6
parent 1875
334383faf77b
child 1896
e7ac9be5c90c
--- a/plugins/mod_tls.lua	Sun Oct 04 16:50:22 2009 +0100
+++ b/plugins/mod_tls.lua	Sat Oct 03 19:20:20 2009 -0700
@@ -55,9 +55,13 @@
 		end);
 
 module:add_event_hook("s2s-stream-features", 
-		function (session, features)												
-			if session.conn.starttls then
-				--features:tag("starttls", starttls_attr):up();
+		function (session, features)
+			-- This hook is possibly called once per host (at least if the
+			-- remote server does not specify a to/from.
+			if session.conn.starttls and not features:child_with_ns(xmlns_starttls) then
+				features:tag("starttls", starttls_attr);
+				-- TODO: Make this optional :P
+				--features:tag("required"):up():up();
 			end
 		end);
 

mercurial