# HG changeset patch # User Sadrul Habib Chowdhury # Date 1169784622 0 # Node ID 6d8728fd3ddad7d8af6ee2a34ae00a8ab5602153 # Parent b25a5eddff9c286267b367d5f8c2d932ec27cd85 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. diff -r b25a5eddff9c -r 6d8728fd3dda libpurple/account.c --- 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); diff -r b25a5eddff9c -r 6d8728fd3dda libpurple/blist.c --- 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; diff -r b25a5eddff9c -r 6d8728fd3dda libpurple/pounce.c --- 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); diff -r b25a5eddff9c -r 6d8728fd3dda libpurple/savedstatuses.c --- 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); diff -r b25a5eddff9c -r 6d8728fd3dda libpurple/util.c --- 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; +} + diff -r b25a5eddff9c -r 6d8728fd3dda libpurple/util.h --- 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