im.pidgin.pidgin: c180c5d69d4c73b8c1f08f48824d93fbeb3b44e8

bartosz at pidgin.im bartosz at pidgin.im
Tue Oct 2 17:55:54 EDT 2007


revision:            c180c5d69d4c73b8c1f08f48824d93fbeb3b44e8
date:                2007-10-02T21:47:50
author:              bartosz at pidgin.im
branch:              im.pidgin.pidgin
changelog:
gg: Properly handle CP1250 chars in group's name when importing buddylist.

manifest:
format_version "1"

new_manifest [7bfaef53bca2a2315b3fb29c1d6bc725c2246068]

old_revision [45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb]

patch "libpurple/protocols/gg/buddylist.c"
 from [aa1eb8a29f943a90c6fb14c0f6934123fc6b8730]
   to [353535de7d31ded3a69e0486d86d6d22604f31e6]
-------------- next part --------------
#
#
# patch "libpurple/protocols/gg/buddylist.c"
#  from [aa1eb8a29f943a90c6fb14c0f6934123fc6b8730]
#    to [353535de7d31ded3a69e0486d86d6d22604f31e6]
#
============================================================
--- libpurple/protocols/gg/buddylist.c	aa1eb8a29f943a90c6fb14c0f6934123fc6b8730
+++ libpurple/protocols/gg/buddylist.c	353535de7d31ded3a69e0486d86d6d22604f31e6
@@ -27,6 +27,13 @@
 #include "gg-utils.h"
 #include "buddylist.h"
 
+#define F_FIRSTNAME 0
+#define F_LASTNAME 1
+/* #define F_ 2 */
+#define F_NICKNAME 3
+#define F_PHONE 4
+#define F_GROUP 5
+#define F_UIN 6
 
 /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */
 void ggp_buddylist_send(PurpleConnection *gc)
@@ -90,7 +97,7 @@ void ggp_buddylist_load(PurpleConnection
 	gchar **users_tbl;
 	int i;
 
-	/* Don't limit a number of records in a buddylist. */
+	/* Don't limit the number of records in a buddylist. */
 	users_tbl = g_strsplit(buddylist, "\r\n", -1);
 
 	for (i = 0; users_tbl[i] != NULL; i++) {
@@ -108,8 +115,8 @@ void ggp_buddylist_load(PurpleConnection
 			continue;
 		}
 
-		show = charset_convert(data_tbl[3], "CP1250", "UTF-8");
-		name = data_tbl[6];
+		show = charset_convert(data_tbl[F_NICKNAME], "CP1250", "UTF-8");
+		name = data_tbl[F_UIN];
 		if ('\0' == *name) {
 			purple_debug_warning("gg",
 				"Something is wrong on line %d of the buddylist. Skipping.\n",
@@ -121,7 +128,7 @@ void ggp_buddylist_load(PurpleConnection
 			show = g_strdup(name);
 		}
 
-		purple_debug_info("gg", "got buddy: name=%s show=%s\n", name, show);
+		purple_debug_info("gg", "got buddy: name=%s; show=%s\n", name, show);
 
 		if (purple_find_buddy(purple_connection_get_account(gc), name)) {
 			g_free(show);
@@ -131,19 +138,19 @@ void ggp_buddylist_load(PurpleConnection
 
 		g = g_strdup("Gadu-Gadu");
 
-		if ('\0' != data_tbl[5]) {
+		if ('\0' != data_tbl[F_GROUP]) {
 			/* XXX: Probably buddy should be added to all the groups. */
 			/* Hard limit to at most 50 groups */
-			gchar **group_tbl = g_strsplit(data_tbl[5], ",", 50);
+			gchar **group_tbl = g_strsplit(data_tbl[F_GROUP], ",", 50);
 			if (ggp_array_size(group_tbl) > 0) {
 				g_free(g);
-				g = g_strdup(group_tbl[0]);
+				g = charset_convert(group_tbl[0], "CP1250", "UTF-8");
 			}
 			g_strfreev(group_tbl);
 		}
 
 		buddy = purple_buddy_new(purple_connection_get_account(gc), name,
-				       strlen(show) ? show : NULL);
+					 strlen(show) ? show : NULL);
 
 		if (!(group = purple_find_group(g))) {
 			group = purple_group_new(g);
@@ -159,7 +166,6 @@ void ggp_buddylist_load(PurpleConnection
 	g_strfreev(users_tbl);
 
 	ggp_buddylist_send(gc);
-
 }
 /* }}} */
 
@@ -192,8 +198,7 @@ void ggp_buddylist_offline(PurpleConnect
 					continue;
 
 				purple_prpl_got_user_status(
-					purple_connection_get_account(gc),
-					buddy->name, "offline", NULL);
+					account, buddy->name, "offline", NULL);
 
 				purple_debug_info("gg",
 					"ggp_buddylist_offline: gone: %s\n",


More information about the Commits mailing list