changeset 14991:633d4c25e82c

[gaim-migrate @ 17769] Change oscar-to-aim-and-icq hack. This does the renaming gtkgaim, after everything's initialized (so it fixes broken Persons and pounces and savedstatuses, but it introduces a hack in gaim_account_get_protocol_id(), since some initialization requires the protocol id to match the plugin. I don't really like this, but it's the best workaround I could think of. Hopefully we can remove this after not-long. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 17 Nov 2006 19:39:17 +0000
parents 8d3a5ff15f05
children 5906e055bce4
files gtk/gtkmain.c libgaim/account.c
diffstat 2 files changed, 25 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkmain.c	Fri Nov 17 19:27:58 2006 +0000
+++ b/gtk/gtkmain.c	Fri Nov 17 19:39:17 2006 +0000
@@ -726,6 +726,22 @@
 	/* TODO: Move pounces loading into gaim_pounces_init() */
 	gaim_pounces_load();
 
+	
+	/* HACK BY SEANEGAN:
+	 * We've renamed prpl-oscar to prpl-aim and prpl-icq, accordingly.
+	 * Let's do that change right here... after everything's loaded, but
+	 * before anything has happened
+	 */
+	for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
+		GaimAccount *account = accounts->data;
+		if (!strcmp(gaim_account_get_protocol_id(account), "prpl-oscar")) {
+			if (isdigit(gaim_account_get_username(account)))
+				gaim_account_set_protocol_id(account, "prpl-icq");
+			else 
+				gaim_account_set_protocol_id(account, "prpl-aim");
+		}
+	}
+	
 	ui_main();
 
 #ifdef USE_SM
--- a/libgaim/account.c	Fri Nov 17 19:27:58 2006 +0000
+++ b/libgaim/account.c	Fri Nov 17 19:39:17 2006 +0000
@@ -697,19 +697,6 @@
 		return NULL;
 	}
 
-
-	/* HACK BY SEANEGAN: special case prpl-oscar to either prpl-icq
-	 * prpl-aim for users upgrading to 2.0.0. This can probably
-	 * be removed after a while
-	 */
-	if (!strcmp(protocol_id, "prpl-oscar")) {
-		g_free(protocol_id);
-		if (isdigit(name[0]))
-			protocol_id = g_strdup("prpl-icq");
-		else 
-			protocol_id = g_strdup("prpl-aim");
-	}
-
 	ret = gaim_account_new(name, protocol_id);
 	g_free(name);
 	g_free(protocol_id);
@@ -1663,7 +1650,15 @@
 gaim_account_get_protocol_id(const GaimAccount *account)
 {
 	g_return_val_if_fail(account != NULL, NULL);
-
+	/*
+	 * HACK by Seanegan
+	 */
+	if (!strcmp(account->protocol_id, "prpl-oscar")) {
+		if (isdigit(account->username[0]))
+			return "prpl-icq";
+		else
+			return "prpl-aim";
+	}
 	return account->protocol_id;
 }