| 543 size_t data_len; |
543 size_t data_len; |
| 544 gchar *data = g_new(gchar, st.st_size + 1); |
544 gchar *data = g_new(gchar, st.st_size + 1); |
| 545 data_len = fread(data, 1, st.st_size, file); |
545 data_len = fread(data, 1, st.st_size, file); |
| 546 fclose(file); |
546 fclose(file); |
| 547 purple_buddy_icons_set_for_user(account, who, data, data_len); |
547 purple_buddy_icons_set_for_user(account, who, data, data_len); |
| 548 icon = purple_buddy_icons_find(account, who); |
548 // TODO: Set a blist setting or something |
| 549 purple_buddy_icon_set_path(icon, iconfile); |
|
| 550 } |
549 } |
| 551 } |
550 } |
| 552 |
551 |
| 553 /* TODO: custom faces for QQ members and users with level >= 16 */ |
552 /* TODO: custom faces for QQ members and users with level >= 16 */ |
| 554 void qq_set_my_buddy_icon(PurpleConnection *gc, const gchar *iconfile) |
553 void qq_set_my_buddy_icon(PurpleConnection *gc, const gchar *iconfile) |
| 607 static void _qq_update_buddy_icon(PurpleAccount *account, const gchar *name, gint face) |
606 static void _qq_update_buddy_icon(PurpleAccount *account, const gchar *name, gint face) |
| 608 { |
607 { |
| 609 gchar *icon_path; |
608 gchar *icon_path; |
| 610 PurpleBuddyIcon *icon = purple_buddy_icons_find(account, name); |
609 PurpleBuddyIcon *icon = purple_buddy_icons_find(account, name); |
| 611 gchar *icon_num_str = face_to_icon_str(face); |
610 gchar *icon_num_str = face_to_icon_str(face); |
| 612 const gchar *old_path = purple_buddy_icon_get_path(icon); |
611 // TODO: This needs to use a blist setting or something. |
| |
612 const gchar *old_path = NULL; |
| 613 const gchar *buddy_icon_dir = qq_buddy_icon_dir(); |
613 const gchar *buddy_icon_dir = qq_buddy_icon_dir(); |
| 614 |
614 |
| 615 icon_path = g_strconcat(buddy_icon_dir, G_DIR_SEPARATOR_S, QQ_ICON_PREFIX, |
615 icon_path = g_strconcat(buddy_icon_dir, G_DIR_SEPARATOR_S, QQ_ICON_PREFIX, |
| 616 icon_num_str, QQ_ICON_SUFFIX, NULL); |
616 icon_num_str, QQ_ICON_SUFFIX, NULL); |
| 617 if (icon == NULL || old_path == NULL |
617 if (icon == NULL || old_path == NULL |