diff libpurple/protocols/jabber/jabber.c @ 26272:fcee93c74230

BOSH: For authentication purposes, HTTPS is equivalent to a secured JabberStream. Since we always require the connection from CM to server to be secure, allow BOSH+HTTPS to pass 'Require SSL/TLS'.
author Paul Aurich <paul@darkrain42.org>
date Mon, 23 Mar 2009 00:38:20 +0000
parents e4a060a1e3de
children 882748e27f9d
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Mar 22 23:44:31 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Mar 23 00:38:20 2009 +0000
@@ -188,7 +188,7 @@
 		if(jabber_process_starttls(js, packet))
 
 			return;
-	} else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !js->gsc) {
+	} else if(purple_account_get_bool(js->gc->account, "require_tls", FALSE) && !jabber_stream_is_ssl(js)) {
 		purple_connection_error_reason (js->gc,
 			 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
 			_("You require encryption, but it is not available on this server."));
@@ -1745,6 +1745,12 @@
 	}
 }
 
+gboolean jabber_stream_is_ssl(JabberStream *js)
+{
+	return (js->bosh && jabber_bosh_connection_is_ssl(js->bosh)) ||
+	       (!js->bosh && js->gsc);
+}
+
 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b)
 {
 	return "jabber";