--- a/libpurple/protocols/oscar/oscar.c Thu Jun 16 17:09:33 2016 -0500
+++ b/libpurple/protocols/oscar/oscar.c Fri Jun 17 18:11:18 2016 -0500
@@ -348,7 +348,9 @@
flap_connection_send_version(od, conn);
- if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN))
+ const gchar *login_type = purple_account_get_string(account, "login_type", OSCAR_DEFAULT_LOGIN); + if (!purple_strequal(login_type, OSCAR_MD5_LOGIN)) ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM;
ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ;
@@ -641,6 +643,7 @@
const gchar *encryption_type;
+ const gchar *login_type; @@ -740,8 +743,9 @@
od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
+ login_type = purple_account_get_string(account, "login_type", OSCAR_DEFAULT_LOGIN); encryption_type = purple_account_get_string(account, "encryption", OSCAR_DEFAULT_ENCRYPTION);
- od->use_ssl = strcmp(encryption_type, OSCAR_NO_ENCRYPTION) != 0;
+ od->use_ssl = purple_strequal(encryption_type, OSCAR_NO_ENCRYPTION) == FALSE; /* Connect to core Purple signals */
purple_prefs_connect_callback(purple_connection_get_protocol(gc), "/purple/away/idle_reporting", idle_reporting_pref_cb, gc);
@@ -757,8 +761,36 @@
* This authentication method is used for both ICQ and AIM when
* clientLogin is not enabled.
- if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN)) {
+ if (purple_strequal(login_type, OSCAR_CLIENT_LOGIN)) { + /* Note: Actual server/port configuration is ignored here */ send_client_login(od, purple_account_get_username(account));
+ } else if (purple_strequal(login_type, OSCAR_KERBEROS_LOGIN)) { + purple_connection_error( + PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, + _("You required Kerberos authentication but encryption is disabled in your account settings.")); + server = purple_account_get_string(account, "server", AIM_DEFAULT_KDC_SERVER); + * If the account's server is what the oscar protocol has offered as + * the default login server through the vast eons (all two of + * said default options, AFAIK) and the user wants KDC, we'll + * do what we know is best for them and change the setting out + * from under them to the KDC login server. + if (purple_strequal(server, oscar_get_login_server(od->icq, FALSE)) || + purple_strequal(server, oscar_get_login_server(od->icq, TRUE)) || + purple_strequal(server, AIM_ALT_LOGIN_SERVER) || + purple_strequal(server, "")) { + purple_debug_info("oscar", "Account uses Kerberos auth, so changing server to default KDC server\n"); + purple_account_set_string(account, "server", AIM_DEFAULT_KDC_SERVER); + purple_account_set_int(account, "port", AIM_DEFAULT_KDC_PORT); + send_kerberos_login(od, purple_account_get_username(account)); @@ -775,9 +807,13 @@
* do what we know is best for them and change the setting out
* from under them to the SSL login server.
- if (!strcmp(server, oscar_get_login_server(od->icq, FALSE)) || !strcmp(server, AIM_ALT_LOGIN_SERVER)) {
+ if (purple_strequal(server, oscar_get_login_server(od->icq, FALSE)) || + purple_strequal(server, AIM_ALT_LOGIN_SERVER) || + purple_strequal(server, AIM_DEFAULT_KDC_SERVER) || + purple_strequal(server, "")) { purple_debug_info("oscar", "Account uses SSL, so changing server to default SSL server\n");
purple_account_set_string(account, "server", oscar_get_login_server(od->icq, TRUE));
+ purple_account_set_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), server = oscar_get_login_server(od->icq, TRUE);
@@ -792,9 +828,12 @@
* SSL but their server is set to OSCAR_DEFAULT_SSL_LOGIN_SERVER,
* set it back to the default.
- if (!strcmp(server, oscar_get_login_server(od->icq, TRUE))) {
+ if (purple_strequal(server, oscar_get_login_server(od->icq, TRUE)) || + purple_strequal(server, AIM_DEFAULT_KDC_SERVER) || + purple_strequal(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_get_login_server(od->icq, FALSE));
+ purple_account_set_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), server = oscar_get_login_server(od->icq, FALSE);
@@ -1079,9 +1118,9 @@
const gchar *encryption_type = purple_account_get_string(account, "encryption", OSCAR_DEFAULT_ENCRYPTION);
- if (strcmp(encryption_type, OSCAR_OPPORTUNISTIC_ENCRYPTION) == 0) {
+ if (purple_strequal(encryption_type, OSCAR_OPPORTUNISTIC_ENCRYPTION)) { purple_debug_warning("oscar", "We won't use SSL for FLAP type 0x%04hx.\n", redir->group);
- } else if (strcmp(encryption_type, OSCAR_REQUIRE_ENCRYPTION) == 0) {
+ } else if (purple_strequal(encryption_type, OSCAR_REQUIRE_ENCRYPTION)) { purple_debug_error("oscar", "FLAP server %s:%d of type 0x%04hx doesn't support encryption.\n", host, port, redir->group);
@@ -1252,7 +1291,7 @@
? oscar_encoding_to_utf8(info->status_encoding, info->status, info->status_len)
- if (strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) == 0) {
+ if (purple_strequal(status_id, OSCAR_STATUS_ID_AVAILABLE)) { /* TODO: If itmsurl is NULL, does that mean the URL has been
cleared? Or does it mean the URL should remain unchanged? */
if (info->itmsurl != NULL) {
@@ -5555,7 +5594,7 @@
-void oscar_init_account_options(PurpleProtocol *protocol)
+void oscar_init_account_options(PurpleProtocol *protocol, gboolean is_icq) PurpleAccountOption *option;
static const gchar *encryption_keys[] = {
@@ -5570,9 +5609,37 @@
+ static const gchar *aim_login_keys[] = { + N_("Use clientLogin authentication"), + N_("Use Kerberos-based authentication"), + N_("Use MD5 based authentication"), + static const gchar *aim_login_values[] = { + static const gchar *icq_login_keys[] = { + N_("Use clientLogin authentication"), + N_("Use MD5 based authentication"), + static const gchar *icq_login_values[] = { + const gchar **login_keys; + const gchar **login_values; GList *encryption_options = NULL;
+ GList *login_options = NULL; + option = purple_account_option_string_new(_("Server"), "server", oscar_get_login_server(is_icq, TRUE)); + protocol->account_options = g_list_append(protocol->account_options, option); option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
protocol->account_options = g_list_append(protocol->account_options, option);
@@ -5585,14 +5652,35 @@
option = purple_account_option_list_new(_("Connection security"), "encryption", encryption_options);
protocol->account_options = g_list_append(protocol->account_options, option);
- option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin",
- OSCAR_DEFAULT_USE_CLIENTLOGIN);
+ login_keys = icq_login_keys; + login_values = icq_login_values; + login_keys = aim_login_keys; + login_values = aim_login_values; + for (i = 0; login_keys[i]; i++) { + PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1); + kvp->key = g_strdup(_(login_keys[i])); + kvp->value = g_strdup(login_values[i]); + login_options = g_list_append(login_options, kvp); + option = purple_account_option_list_new(_("Authentication method"), "login_type", login_options); protocol->account_options = g_list_append(protocol->account_options, option);
option = purple_account_option_bool_new(
_("Always use AIM/ICQ proxy server for\nfile transfers and direct IM (slower,\nbut does not reveal your IP address)"), "always_use_rv_proxy",
OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY);
protocol->account_options = g_list_append(protocol->account_options, option);
+ option = purple_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); + protocol->account_options = g_list_append(protocol->account_options, option); + option = purple_account_option_bool_new(_("Allow multiple simultaneous logins"), "allow_multiple_logins", + OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS); + protocol->account_options = g_list_append(protocol->account_options, option); --- a/libpurple/protocols/oscar/oscarcommon.h Thu Jun 16 17:09:33 2016 -0500
+++ b/libpurple/protocols/oscar/oscarcommon.h Fri Jun 17 18:11:18 2016 -0500
@@ -38,12 +38,19 @@
#define ICQ_DEFAULT_LOGIN_SERVER "login.icq.com"
#define ICQ_DEFAULT_SSL_LOGIN_SERVER "slogin.icq.com"
+#define AIM_DEFAULT_KDC_SERVER "kdc.uas.aol.com" +#define AIM_DEFAULT_KDC_PORT 443 #define OSCAR_DEFAULT_LOGIN_PORT 5190
#define OSCAR_OPPORTUNISTIC_ENCRYPTION "opportunistic_encryption"
#define OSCAR_REQUIRE_ENCRYPTION "require_encryption"
#define OSCAR_NO_ENCRYPTION "no_encryption"
+#define OSCAR_MD5_LOGIN "md5_login" +#define OSCAR_CLIENT_LOGIN "client_login" +#define OSCAR_KERBEROS_LOGIN "kerberos_login" #define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1"
@@ -54,7 +61,7 @@
#define OSCAR_DEFAULT_WEB_AWARE FALSE
#define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE
#define OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS TRUE
-#define OSCAR_DEFAULT_USE_CLIENTLOGIN TRUE
+#define OSCAR_DEFAULT_LOGIN OSCAR_CLIENT_LOGIN #define OSCAR_DEFAULT_ENCRYPTION OSCAR_OPPORTUNISTIC_ENCRYPTION