pidgin: 4be5956e: disapproval of revision '661db628ce40c35...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Sun Nov 29 11:32:18 EST 2009
-----------------------------------------------------------------
Revision: 4be5956e86cfd7ac16331092beb6255db19e0640
Ancestor: 661db628ce40c3548058f062ea72d9687654d53a
Author: rekkanoryo at pidgin.im
Date: 2009-11-29T16:16:40
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4be5956e86cfd7ac16331092beb6255db19e0640
Modified files:
libpurple/protocols/oscar/oscar.c
ChangeLog:
disapproval of revision '661db628ce40c3548058f062ea72d9687654d53a'
This is causing a ton of crashes for Adium. Clearly this needs to be done differently.
-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c fcff94a3e8156e4ffaf8b33ba6f86d2ef335ca26
+++ libpurple/protocols/oscar/oscar.c 74e9ab37a96ec209cbe34457b99295a02cd5fd78
@@ -5225,7 +5225,7 @@ static int purple_ssi_parselist(OscarDat
{ /* If not in server list then prune from local list */
GSList *cur, *next;
GSList *buddies = purple_find_buddies(account, NULL);
-
+
/* Buddies */
cur = NULL;
@@ -5315,28 +5315,45 @@ static int purple_ssi_parselist(OscarDat
/* Add from server list to local list */
for (curitem=od->ssi.local; curitem; curitem=curitem->next) {
+ if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL)))
switch (curitem->type) {
case AIM_SSI_TYPE_BUDDY: { /* Buddy */
if (curitem->name) {
struct aim_ssi_item *groupitem;
- const char *gname, *alias;
+ char *gname, *gname_utf8, *alias, *alias_utf8;
groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000);
gname = groupitem ? groupitem->name : NULL;
+ if (gname != NULL) {
+ if (g_utf8_validate(gname, -1, NULL))
+ gname_utf8 = g_strdup(gname);
+ else
+ gname_utf8 = oscar_utf8_try_convert(account, gname);
+ } else
+ gname_utf8 = NULL;
- g = purple_find_group(gname ? gname : _("Orphans"));
+ g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans"));
if (g == NULL) {
- g = purple_group_new(gname ? gname : _("Orphans"));
+ g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
purple_blist_add_group(g, NULL);
}
alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name);
+ if (alias != NULL) {
+ if (g_utf8_validate(alias, -1, NULL))
+ alias_utf8 = g_strdup(alias);
+ else
+ alias_utf8 = oscar_utf8_try_convert(account, alias);
+ g_free(alias);
+ } else
+ alias_utf8 = NULL;
+
b = purple_find_buddy_in_group(account, curitem->name, g);
if (b) {
/* Get server stored alias */
- purple_blist_alias_buddy(b, alias);
+ purple_blist_alias_buddy(b, alias_utf8);
} else {
- b = purple_buddy_new(account, curitem->name, alias);
+ b = purple_buddy_new(account, curitem->name, alias_utf8);
purple_debug_info("oscar",
"ssi: adding buddy %s to group %s to local list\n", curitem->name, gname);
@@ -5360,15 +5377,30 @@ static int purple_ssi_parselist(OscarDat
purple_buddy_get_name(b),
OSCAR_STATUS_ID_MOBILE, NULL);
}
+
+ g_free(gname_utf8);
+ g_free(alias_utf8);
}
} break;
case AIM_SSI_TYPE_GROUP: { /* Group */
- const char *gname = curitem->name;
- if (gname != NULL && purple_find_group(gname) == NULL) {
- g = purple_group_new(gname);
+ char *gname;
+ char *gname_utf8;
+
+ gname = curitem->name;
+ if (gname != NULL) {
+ if (g_utf8_validate(gname, -1, NULL))
+ gname_utf8 = g_strdup(gname);
+ else
+ gname_utf8 = oscar_utf8_try_convert(account, gname);
+ } else
+ gname_utf8 = NULL;
+
+ if (gname_utf8 != NULL && purple_find_group(gname_utf8) == NULL) {
+ g = purple_group_new(gname_utf8);
purple_blist_add_group(g, NULL);
}
+ g_free(gname_utf8);
} break;
case AIM_SSI_TYPE_PERMIT: { /* Permit buddy */
@@ -5503,8 +5535,7 @@ purple_ssi_parseaddmod(OscarData *od, Fl
{
PurpleConnection *gc;
PurpleAccount *account;
- const char *gname;
- char *alias;
+ char *gname, *gname_utf8, *alias, *alias_utf8;
PurpleBuddy *b;
PurpleGroup *g;
struct aim_ssi_item *ssi_item;
@@ -5525,7 +5556,19 @@ purple_ssi_parseaddmod(OscarData *od, Fl
return 1;
gname = aim_ssi_itemlist_findparentname(od->ssi.local, name);
+ gname_utf8 = gname ? oscar_utf8_try_convert(account, gname) : NULL;
+
alias = aim_ssi_getalias(od->ssi.local, gname, name);
+ if (alias != NULL)
+ {
+ if (g_utf8_validate(alias, -1, NULL))
+ alias_utf8 = g_strdup(alias);
+ else
+ alias_utf8 = oscar_utf8_try_convert(account, alias);
+ }
+ else
+ alias_utf8 = NULL;
+ g_free(alias);
b = purple_find_buddy(account, name);
if (b) {
@@ -5534,21 +5577,21 @@ purple_ssi_parseaddmod(OscarData *od, Fl
* of your buddies, so update our local buddy list with
* the person's new alias.
*/
- purple_blist_alias_buddy(b, alias);
+ purple_blist_alias_buddy(b, alias_utf8);
} else if (snac_subtype == 0x0008) {
/*
* You're logged in somewhere else and you added a buddy to
* your server list, so add them to your local buddy list.
*/
- b = purple_buddy_new(account, name, alias);
+ b = purple_buddy_new(account, name, alias_utf8);
- if (!(g = purple_find_group(gname ? gname : _("Orphans")))) {
- g = purple_group_new(gname ? gname : _("Orphans"));
+ if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
+ g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
purple_blist_add_group(g, NULL);
}
purple_debug_info("oscar",
- "ssi: adding buddy %s to group %s to local list\n", name, gname ? gname : _("Orphans"));
+ "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
purple_blist_add_buddy(b, NULL, g, NULL);
/* Mobile users should always be online */
@@ -5561,8 +5604,6 @@ purple_ssi_parseaddmod(OscarData *od, Fl
}
- g_free(alias);
-
ssi_item = aim_ssi_itemlist_finditem(od->ssi.local,
gname, name, AIM_SSI_TYPE_BUDDY);
if (ssi_item == NULL)
@@ -5572,6 +5613,9 @@ purple_ssi_parseaddmod(OscarData *od, Fl
"group %s\n", name, gname);
}
+ g_free(gname_utf8);
+ g_free(alias_utf8);
+
return 1;
}
@@ -6274,6 +6318,7 @@ static void oscar_buddycb_edit_comment(P
struct name_data *data;
PurpleGroup *g;
char *comment;
+ gchar *comment_utf8;
gchar *title;
PurpleAccount *account;
const char *name;
@@ -6292,6 +6337,7 @@ static void oscar_buddycb_edit_comment(P
data = g_new(struct name_data, 1);
comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), name);
+ comment_utf8 = comment ? oscar_utf8_try_convert(account, comment) : NULL;
data->gc = gc;
data->name = g_strdup(name);
@@ -6299,7 +6345,7 @@ static void oscar_buddycb_edit_comment(P
title = g_strdup_printf(_("Buddy Comment for %s"), data->name);
purple_request_input(gc, title, _("Buddy Comment:"), NULL,
- comment, TRUE, FALSE, NULL,
+ comment_utf8, TRUE, FALSE, NULL,
_("_OK"), G_CALLBACK(oscar_ssi_editcomment),
_("_Cancel"), G_CALLBACK(oscar_free_name_data),
account, data->name, NULL,
@@ -6307,6 +6353,7 @@ static void oscar_buddycb_edit_comment(P
g_free(title);
g_free(comment);
+ g_free(comment_utf8);
}
static void
More information about the Commits
mailing list