changeset 15421:6d8728fd3dda

Make sure the pounces, buddy-aliases, savedstatuses etc. saved before the aim/icq split works after the split. The util function _gaim_oscar_convert will be removed at a 'suitable' time in the future.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 26 Jan 2007 04:10:22 +0000
parents b25a5eddff9c
children da62cc01dd56
files libpurple/account.c libpurple/blist.c libpurple/pounce.c libpurple/savedstatuses.c libpurple/util.c libpurple/util.h
diffstat 6 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Fri Jan 26 03:53:15 2007 +0000
+++ b/libpurple/account.c	Fri Jan 26 04:10:22 2007 +0000
@@ -697,7 +697,7 @@
 		return NULL;
 	}
 
-	ret = gaim_account_new(name, protocol_id);
+	ret = gaim_account_new(name, _gaim_oscar_convert(name, protocol_id)); /* XXX: */
 	g_free(name);
 	g_free(protocol_id);
 
--- a/libpurple/blist.c	Fri Jan 26 03:53:15 2007 +0000
+++ b/libpurple/blist.c	Fri Jan 26 04:10:22 2007 +0000
@@ -404,7 +404,9 @@
 
 	acct_name = xmlnode_get_attrib(bnode, "account");
 	protocol = xmlnode_get_attrib(bnode, "protocol");
+	protocol = _gaim_oscar_convert(acct_name, protocol); /* XXX: Remove */
 	proto = xmlnode_get_attrib(bnode, "proto");
+	proto = _gaim_oscar_convert(acct_name, proto); /* XXX: Remove */
 
 	if (!acct_name || (!proto && !protocol))
 		return;
--- a/libpurple/pounce.c	Fri Jan 26 03:53:15 2007 +0000
+++ b/libpurple/pounce.c	Fri Jan 26 04:10:22 2007 +0000
@@ -403,8 +403,12 @@
 	}
 
 	if (!strcmp(element_name, "account")) {
+		char *tmp;
 		g_free(data->account_name);
 		data->account_name = g_strdup(buffer);
+		tmp = data->protocol_id;
+		data->protocol_id = g_strdup(_gaim_oscar_convert(buffer, tmp));
+		g_free(tmp);
 	}
 	else if (!strcmp(element_name, "pouncee")) {
 		g_free(data->pouncee);
--- a/libpurple/savedstatuses.c	Fri Jan 26 03:53:15 2007 +0000
+++ b/libpurple/savedstatuses.c	Fri Jan 26 04:10:22 2007 +0000
@@ -382,6 +382,7 @@
 		const char *protocol;
 		acct_name = xmlnode_get_data(node);
 		protocol = xmlnode_get_attrib(node, "protocol");
+		protocol = _gaim_oscar_convert(acct_name, protocol); /* XXX: Remove */
 		if ((acct_name != NULL) && (protocol != NULL))
 			ret->account = gaim_accounts_find(acct_name, protocol);
 		g_free(acct_name);
--- a/libpurple/util.c	Fri Jan 26 03:53:15 2007 +0000
+++ b/libpurple/util.c	Fri Jan 26 04:10:22 2007 +0000
@@ -4040,3 +4040,14 @@
 	return buf;
 }
 
+const char *_gaim_oscar_convert(const char *act, const char *protocol)
+{
+	if (protocol && act && strcmp(protocol, "prpl-oscar") == 0) {
+		if (isdigit(*act))
+			protocol = "prpl-icq";
+		else
+			protocol = "prpl-aim";
+	}
+	return protocol;
+}
+
--- a/libpurple/util.h	Fri Jan 26 03:53:15 2007 +0000
+++ b/libpurple/util.h	Fri Jan 26 04:10:22 2007 +0000
@@ -1064,6 +1064,11 @@
  */
 const char *gaim_escape_filename(const char *str);
 
+/**
+ * This is added temporarily to assist the split of oscar into aim and icq.
+ * This should not be used by plugins.
+ */
+const char *_gaim_oscar_convert(const char *act, const char *protocol);
 #ifdef __cplusplus
 }
 #endif