# HG changeset patch # User Luke Schierer # Date 1192813759 0 # Node ID d30ea407576ee5538cc0bfa5ab0939d612670951 # Parent 665d6d7eea83125c8b0013ba3bf1ae40132adbba applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb through c180c5d69d4c73b8c1f08f48824d93fbeb3b44e8 diff -r 665d6d7eea83 -r d30ea407576e libpurple/protocols/gg/buddylist.c --- a/libpurple/protocols/gg/buddylist.c Fri Oct 19 17:06:53 2007 +0000 +++ b/libpurple/protocols/gg/buddylist.c Fri Oct 19 17:09:19 2007 +0000 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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 @@ g_strfreev(users_tbl); ggp_buddylist_send(gc); - } /* }}} */ @@ -192,8 +198,7 @@ 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",