summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Aurich <darkrain42@pidgin.im>2008-12-18 05:27:39 +0000
committerPaul Aurich <darkrain42@pidgin.im>2008-12-18 05:27:39 +0000
commit6164b36223a748f737ea9d561e65ca5248719fac (patch)
tree6221fbd2efc94ff091c04b55fd17d51091db89d0
parent1293bca0350f7206bcadef644c2b7878bad55e9b (diff)
downloadpidgin-6164b36223a748f737ea9d561e65ca5248719fac.tar.gz
Implement a sane mechanism for switching an OSCAR account to SSL.
The user checks the box and, if their login server is one of the default ones used in libpurple, change it to the SSL server. If the user unchecks the box, change it back. I'm not happy with this, but it works. It might be sensible to adjust our connecting server and not change the account option)
-rw-r--r--libpurple/protocols/oscar/oscar.c35
-rw-r--r--libpurple/protocols/oscar/oscarcommon.h1
2 files changed, 28 insertions, 8 deletions
diff --git a/libpurple/protocols/oscar/oscar.c b/libpurple/protocols/oscar/oscar.c
index 2823a06343..731ee61e41 100644
--- a/libpurple/protocols/oscar/oscar.c
+++ b/libpurple/protocols/oscar/oscar.c
@@ -1512,7 +1512,7 @@ oscar_login(PurpleAccount *account)
gc->flags |= PURPLE_CONNECTION_AUTO_RESP;
}
- od->use_ssl = purple_account_get_bool(account, "use_ssl", FALSE);
+ od->use_ssl = purple_account_get_bool(account, "use_ssl", OSCAR_DEFAULT_USE_SSL);
/* Connect to core Purple signals */
purple_prefs_connect_callback(gc, "/purple/away/idle_reporting", idle_reporting_pref_cb, gc);
@@ -1521,12 +1521,20 @@ oscar_login(PurpleAccount *account)
newconn = flap_connection_new(od, SNAC_FAMILY_AUTH);
if (od->use_ssl) {
if (purple_ssl_is_supported()) {
- /* FIXME SSL: This won't really work... Need to match on the server being the default
- * non-ssl server and, if so, connect to the default ssl one (and possibly update
- * the account setting).
+ const char *server = purple_account_get_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER);
+ /* If the account's server is what the oscar prpl has offered as
+ * the default login server through the vast eons (all two of
+ * said default options, AFAIK) and the user wants SSL, we'll
+ * do what we know is best for them and change the setting out
+ * from under them to the SSL login server.
*/
- newconn->gsc = purple_ssl_connect(account,
- purple_account_get_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER),
+ if (!strcmp(server, OSCAR_DEFAULT_LOGIN_SERVER) || !strcmp(server, OSCAR_OLD_LOGIN_SERVER)) {
+ purple_debug_info("oscar", "Account uses SSL, so changing server to default SSL server\n");
+ purple_account_set_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER);
+ server = OSCAR_DEFAULT_SSL_LOGIN_SERVER;
+ }
+
+ newconn->gsc = purple_ssl_connect(account, server,
purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT),
ssl_connection_established_cb, ssl_connection_error_cb, newconn);
} else {
@@ -1534,8 +1542,19 @@ oscar_login(PurpleAccount *account)
_("SSL support unavailable"));
}
} else {
- newconn->connect_data = purple_proxy_connect(NULL, account,
- purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER),
+ const char *server = purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER);
+
+ /* See the comment above. We do the reverse here. If they don't want
+ * SSL but their server is set to OSCAR_DEFAULT_SSL_LOGIN_SERVER,
+ * set it back to the default.
+ */
+ if (!strcmp(server, OSCAR_DEFAULT_SSL_LOGIN_SERVER)) {
+ purple_debug_info("oscar", "Account does not use SSL, so changing server back to non-SSL\n");
+ purple_account_set_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER);
+ server = OSCAR_DEFAULT_LOGIN_SERVER;
+ }
+
+ newconn->connect_data = purple_proxy_connect(NULL, account, server,
purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT),
connection_established_cb, newconn);
}
diff --git a/libpurple/protocols/oscar/oscarcommon.h b/libpurple/protocols/oscar/oscarcommon.h
index 4262a10a5f..c590745335 100644
--- a/libpurple/protocols/oscar/oscarcommon.h
+++ b/libpurple/protocols/oscar/oscarcommon.h
@@ -33,6 +33,7 @@
#define OSCAR_DEFAULT_LOGIN_SERVER "login.messaging.aol.com"
#define OSCAR_DEFAULT_LOGIN_PORT 5190
#define OSCAR_DEFAULT_SSL_LOGIN_SERVER "slogin.oscar.aol.com"
+#define OSCAR_OLD_LOGIN_SERVER "login.oscar.aol.com"
#ifndef _WIN32
#define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1"
#else