pidgin: ff681557: Patch #3874 from beret. There was a sim...

markdoliner at pidgin.im markdoliner at pidgin.im
Thu Mar 6 02:45:42 EST 2008


-----------------------------------------------------------------
Revision: ff681557cdc4d70719004cd04f9f7a68f6f33b3f
Ancestor: 8204e89e4a29b403c7f6b7530ccbd168a775938b
Author: markdoliner at pidgin.im
Date: 2008-03-06T07:41:52
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ff681557cdc4d70719004cd04f9f7a68f6f33b3f

Modified files:
        libpurple/protocols/oscar/oscar.c

ChangeLog: 

Patch #3874 from beret.  There was a similar patch #2712 from rschnz,
but I think this one is better.

Basically the names of ssi items should be UTF-8, and Pidgin currently
stores it that way, but when we read it in we call
oscar_utf8_try_convert(), which would normally be well and good, but
for ICQ accounts that function first tries to treat the name as the
character encoding specified in your account preferences.  If that
converstion happened to succeed it would be incorrect and result in
a bad group name.

So now we try to treat the string as UTF-8 first.

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	f19337d8b10fdf2ed4fbf530fc46f46faf454f24
+++ libpurple/protocols/oscar/oscar.c	1a0a82103413801c9589d383afad014b6710d789
@@ -4985,8 +4985,13 @@ static int purple_ssi_parselist(OscarDat
 
 					groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000);
 					gname = groupitem ? groupitem->name : NULL;
-					gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL;
-					alias = aim_ssi_getalias(od->ssi.local, 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(gc->account, gname);
+					} else
+						gname_utf8 = NULL;
 
 					g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans"));
 					if (g == NULL) {
@@ -4994,15 +4999,14 @@ static int purple_ssi_parselist(OscarDat
 						purple_blist_add_group(g, NULL);
 					}
 
-					if (alias != 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
+					} else
 						alias_utf8 = NULL;
 
 					b = purple_find_buddy_in_group(gc->account, curitem->name, g);
@@ -5045,7 +5049,14 @@ static int purple_ssi_parselist(OscarDat
 				char *gname_utf8;
 
 				gname = curitem->name;
-				gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL;
+				if (gname != NULL) {
+					if (g_utf8_validate(gname, -1, NULL))
+						gname_utf8 = g_strdup(gname);
+					else
+						gname_utf8 = oscar_utf8_try_convert(gc->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);


More information about the Commits mailing list