--- a/libpurple/protocols/qq/buddy_info.c Wed Dec 03 01:58:45 2008 +0000 +++ b/libpurple/protocols/qq/buddy_info.c Sat Dec 13 05:45:27 2008 +0000 @@ -58,7 +58,7 @@ #define QQ_PUBLISH_SIZE 3 static const gchar *publish_types[] = { - N_("Visible"), N_("Firend Only"), N_("Private") + N_("Visible"), N_("Friend Only"), N_("Private") }; #define QQ_GENDER_SIZE 3 @@ -87,7 +87,7 @@ QQ_INFO_UNKNOW3, QQ_INFO_UNKNOW4, QQ_INFO_UNKNOW5, QQ_INFO_IS_PUB_MOBILE, QQ_INFO_IS_PUB_CONTACT, QQ_INFO_COLLEGE, QQ_INFO_HOROSCOPE, QQ_INFO_ZODIAC, QQ_INFO_BLOOD, QQ_INFO_SHOW, QQ_INFO_UNKNOW6, - QQ_INFO_LAST_2007, QQ_INFO_LAST, + QQ_INFO_LAST_2007, QQ_INFO_LAST }; enum { @@ -95,7 +95,7 @@ }; enum { - QQ_FIELD_LABEL = 0, QQ_FIELD_STRING, QQ_FIELD_MULTI, QQ_FIELD_BOOL, QQ_FIELD_CHOICE, + QQ_FIELD_LABEL = 0, QQ_FIELD_STRING, QQ_FIELD_MULTI, QQ_FIELD_BOOL, QQ_FIELD_CHOICE }; typedef struct { @@ -228,7 +228,7 @@ g_return_if_fail(uid != 0); qd = (qq_data *) gc->proto_data; - g_snprintf(raw_data, sizeof(raw_data), "%d", uid); + g_snprintf(raw_data, sizeof(raw_data), "%u", uid); qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data), update_class, action); } @@ -457,7 +457,7 @@ data[data_len] = '\0'; if (qd->uid != atoi((gchar *) data)) { /* return should be my uid */ purple_debug_info("QQ", "Failed Updating info\n"); - qq_got_attention(gc, _("Could not change buddy information.")); + qq_got_message(gc, _("Could not change buddy information.")); } } @@ -553,7 +553,7 @@ return icon_path; } -static void update_buddy_icon(PurpleAccount *account, const gchar *who, gint face) +void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face) { PurpleBuddy *buddy; const gchar *icon_name_prev = NULL; @@ -564,19 +564,21 @@ g_return_if_fail(account != NULL && who != NULL); - purple_debug_info("QQ", "Update %s icon to %d\n", who, face); + /* purple_debug_info("QQ", "Update %s icon to %d\n", who, face); */ icon_name = qq_get_icon_name(face); - purple_debug_info("QQ", "icon file name is %s\n", icon_name); + g_return_if_fail(icon_name != NULL); + /* purple_debug_info("QQ", "icon file name is %s\n", icon_name); */ if ((buddy = purple_find_buddy(account, who))) { icon_name_prev = purple_buddy_icons_get_checksum_for_user(buddy); - if (icon_name_prev != NULL) { - purple_debug_info("QQ", "Previous icon is %s\n", icon_name_prev); - } + /* + purple_debug_info("QQ", "Previous icon is %s\n", + icon_name_prev != NULL ? icon_name_prev : "(NULL)"); + */ } if (icon_name_prev != NULL && !strcmp(icon_name, icon_name_prev)) { - purple_debug_info("QQ", "Icon is not changed\n"); + /* purple_debug_info("QQ", "Icon is not changed\n"); */ g_free(icon_name); return; } @@ -590,6 +592,8 @@ if (!g_file_get_contents(icon_path, &icon_file_content, &icon_file_size, NULL)) { purple_debug_error("QQ", "Failed reading icon file %s\n", icon_path); } else { + purple_debug_info("QQ", "Update %s icon to %d (%s)\n", + who, face, icon_path); purple_buddy_icons_set_for_user(account, who, icon_file_content, icon_file_size, icon_name); } @@ -610,7 +614,7 @@ qd = (qq_data *)purple_connection_get_protocol_data(gc); - uid = strtol(segments[QQ_INFO_UID], NULL, 10); + uid = strtoul(segments[QQ_INFO_UID], NULL, 10); who = uid_to_purple_name(uid); qq_filter_str(segments[QQ_INFO_NICK]); @@ -649,7 +653,7 @@ purple_blist_server_alias_buddy(buddy, bd->nickname); /* convert face num from packet (0-299) to local face (1-100) */ - update_buddy_icon(gc->account, who, bd->face); + qq_update_buddy_icon(gc->account, who, bd->face); g_free(who); g_free(alias_utf8); @@ -786,12 +790,12 @@ bytes += qq_get32(&onlineTime, data + bytes); bytes += qq_get16(&level, data + bytes); bytes += qq_get16(&timeRemainder, data + bytes); - purple_debug_info("QQ_LEVEL", "%d, tmOnline: %d, level: %d, tmRemainder: %d\n", - uid, onlineTime, level, timeRemainder); + purple_debug_info("QQ", "level: %d, uid %d, tmOnline: %d, tmRemainder: %d\n", + level, uid, onlineTime, timeRemainder); bd = qq_buddy_data_find(gc, uid); if (bd == NULL) { - purple_debug_error("QQ", "Got levels of %d not in my buddy list\n", uid); + purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid); continue; } @@ -821,8 +825,8 @@ bytes += qq_get32(&onlineTime, data + bytes); bytes += qq_get16(&level, data + bytes); bytes += qq_get16(&timeRemainder, data + bytes); - purple_debug_info("QQ_LEVEL", "%d, tmOnline: %d, level: %d, tmRemainder: %d\n", - uid, onlineTime, level, timeRemainder); + purple_debug_info("QQ", "level: %d, uid %d, tmOnline: %d, tmRemainder: %d\n", + level, uid, onlineTime, timeRemainder); bd = qq_buddy_data_find(gc, uid); if (bd == NULL) {