Changeset

63:311e61176159

verse.plugins.tls: Fail gracefully when LuaSec not loaded
author Matthew Wild <mwild1@gmail.com>
date Tue, 11 May 2010 23:06:52 +0100
parents 62:d4b6f9e33c6e
children 64:a28540d4117a
files plugins/tls.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/tls.lua	Tue May 11 23:05:26 2010 +0100
+++ b/plugins/tls.lua	Tue May 11 23:06:52 2010 +0100
@@ -4,10 +4,12 @@
 function verse.plugins.tls(stream)
 	local function handle_features(features_stanza)
 		if stream.authenticated then return; end
-		if features_stanza:get_child("starttls", xmlns_tls) then
+		if features_stanza:get_child("starttls", xmlns_tls) and stream.conn.starttls then
 			stream:debug("Negotiating TLS...");
 			stream:send(st.stanza("starttls", { xmlns = xmlns_tls }));
 			return true;
+		elseif not stream.conn.starttls then
+			stream:warn("SSL libary (LuaSec) not loaded, so TLS not available");
 		else
 			stream:debug("Server doesn't offer TLS :(");
 		end