diff libpurple/account.c @ 30895:8084631e2e84

jabber: Unify "Require TLS" and "Use old-style (port 5223) SSL" settings
author Paul Aurich <paul@darkrain42.org>
date Tue, 31 Aug 2010 02:28:05 +0000
parents 1cdae196aac8
children f9664876549f
line wrap: on
line diff
--- a/libpurple/account.c	Fri Aug 27 06:28:09 2010 +0000
+++ b/libpurple/account.c	Tue Aug 31 02:28:05 2010 +0000
@@ -513,6 +513,25 @@
 }
 
 static void
+migrate_xmpp_encryption(PurpleAccount *account)
+{
+	/* When this is removed, nuke the "old_ssl" and "require_tls" settings */
+	if (g_str_equal(purple_account_get_protocol_id(account), "prpl-jabber")) {
+		const char *sec = purple_account_get_string(account, "connection_security", "");
+
+		if (g_str_equal("", sec)) {
+			const char *val = "require_tls";
+			if (purple_account_get_bool(account, "old_ssl", FALSE))
+				val = "old_ssl";
+			else if (!purple_account_get_bool(account, "require_tls", TRUE))
+				val = "opportunistic_tls";
+
+			purple_account_set_string(account, "connection_security", val);
+		}
+	}
+}
+
+static void
 parse_settings(xmlnode *node, PurpleAccount *account)
 {
 	const char *ui;
@@ -579,6 +598,9 @@
 	/* we do this here because we need access to account settings to determine
 	 * if we can/should migrate an old Yahoo! JAPAN account */
 	migrate_yahoo_japan(account);
+	/* we do this here because we need to do it before the user views the
+	 * Edit Account dialog. */
+	migrate_xmpp_encryption(account);
 }
 
 static GList *