Package: libpurple0
Version: 2.3.1-2
Severity: normal
Tags: patch

During server-side buddylist import over OSCAR, libpurple converts all
group names from the local encoding (CP1250 in my case) to UTF-8.
However, all ICQ clients - Pidgin included! - save those names in UTF-8.
I am sending a patch that changes the behavior to first check if the
group name is valid UTF-8; use it if it is, and convert it if it is not.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=cs_CZ.UTF8, LC_CTYPE=cs_CZ.UTF8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libpurple0 depends on:
ii  libavahi-client3 0.6.22-2                Avahi client library
ii  libavahi-common3 0.6.22-2                Avahi common library
ii  libavahi-glib1   0.6.22-2                Avahi glib integration library
ii  libc6            2.7-8                   GNU C Library: Shared libraries
ii  libdbus-1-3      1.1.4-1                 simple interprocess messaging syst
ii  libdbus-glib-1-2 0.74-1                  simple interprocess messaging syst
ii  libgadu3         1:1.7~rc2-2             Gadu-Gadu protocol library - runti
ii  libglib2.0-0     2.14.6-1                The GLib library of C routines
ii  libmeanwhile1    1.0.2-3                 open implementation of the Lotus S
ii  libnspr4-0d      4.7.0~1.9b1-2           NetScape Portable Runtime Library
ii  libnss3-1d       3.12.0~1.9b1-2          Network Security Service libraries
ii  libperl5.8       5.8.8-12                Shared Perl library
ii  libsasl2-2       2.1.22.dfsg1-18         Cyrus SASL - authentication abstra
ii  libsasl2-modules 2.1.22.dfsg1-18         Cyrus SASL - pluggable authenticat
ii  libsilc-1.1-2    1.1.5-1                 SILC library (silc-toolkit)
ii  libxml2          2.6.31.dfsg-1           GNOME XML library
ii  libzephyr3       2.1.20070719.SNAPSHOT-1 The original "Instant Message" sys
ii  pidgin-data      2.3.1-2                 multi-protocol instant messaging c

Versions of packages libpurple0 recommends:
ii  ca-certificates             20070303-0.1 Common CA certificates
ii  libpurple-bin               2.3.1-2      multi-protocol instant messaging l

-- debconf-show failed
--- libpurple/protocols/oscar/oscar.c.orig	2007-12-07 15:37:08.000000000 +0100
+++ libpurple/protocols/oscar/oscar.c	2008-01-12 17:30:53.000000000 +0100
@@ -4940,10 +4940,15 @@
 				if (curitem->name) {
 					struct aim_ssi_item *groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000);
 					char *gname = groupitem ? groupitem->name : NULL;
-					char *gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL;
+					char *gname_utf8 = NULL;
 					char *alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name);
 					char *alias_utf8;
 
+					if (gname && g_utf8_validate(gname, -1, NULL))
+						gname_utf8 = g_strdup(gname);
+					else if (gname)
+						gname_utf8 = oscar_utf8_try_convert(gc->account, gname);
+
 					g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans"));
 					if (g == NULL) {
 						g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
@@ -4998,7 +5003,11 @@
 
 			case 0x0001: { /* Group */
 				char *gname = curitem->name;
-				char *gname_utf8 = gname ? oscar_utf8_try_convert(gc->account, gname) : NULL;
+				char *gname_utf8 = NULL;
+				if (gname && g_utf8_validate(gname, -1, NULL))
+					gname_utf8 = g_strdup(gname);
+				else if (gname)
+					gname_utf8 = oscar_utf8_try_convert(gc->account, gname);
 				if (gname_utf8 != NULL && purple_find_group(gname_utf8) == NULL) {
 					g = purple_group_new(gname_utf8);
 					purple_blist_add_group(g, NULL);

Reply via email to