comparison libgaim/protocols/qq/keep_alive.c @ 15071:902f3621aa13

[gaim-migrate @ 17855] Use the QQ faces as buddy icons instead of status icons. Also, a few minor cleanups and a bug fix for faces > 33. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Thu, 30 Nov 2006 10:30:13 +0000
parents c039c920e11c
children e952a5fc97b3
comparison
equal deleted inserted replaced
15070:97ae8709d6dc 15071:902f3621aa13
29 */ 29 */
30 30
31 #include "debug.h" 31 #include "debug.h"
32 #include "server.h" 32 #include "server.h"
33 33
34 #include "buddy_info.h"
34 #include "buddy_list.h" 35 #include "buddy_list.h"
35 #include "buddy_status.h" 36 #include "buddy_status.h"
36 #include "crypt.h" 37 #include "crypt.h"
37 #include "header_info.h" 38 #include "header_info.h"
38 #include "keep_alive.h" 39 #include "keep_alive.h"
116 } 117 }
117 list = list->next; 118 list = list->next;
118 } 119 }
119 } 120 }
120 121
122 static void _qq_update_buddy_icon(GaimAccount *account, const gchar *name, gint face)
123 {
124 GaimBuddyIcon *icon = gaim_buddy_icons_find(account, name);
125 gchar *icon_num_str = face_to_icon_str(face);
126 gchar *icon_path = g_strconcat(QQBUDDYICONDIR, G_DIR_SEPARATOR_S,
127 QQ_ICON_PREFIX, icon_num_str, QQ_ICON_SUFFIX, NULL);
128 const gchar *old_path = gaim_buddy_icon_get_path(icon);
129 if (icon == NULL || old_path == NULL
130 || g_ascii_strcasecmp(icon_path, old_path) != 0)
131 qq_set_buddy_icon_for_user(account, name, icon_path);
132 g_free(icon_num_str);
133 g_free(icon_path);
134 }
135
121 void qq_update_buddy_contact(GaimConnection *gc, qq_buddy *q_bud) 136 void qq_update_buddy_contact(GaimConnection *gc, qq_buddy *q_bud)
122 { 137 {
123 gchar *name; 138 gchar *name;
124 GaimBuddy *bud; 139 GaimBuddy *bud;
125 gchar *status_id; 140 gchar *status_id;
159 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "unknown status: %x\n", q_bud->status); 174 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "unknown status: %x\n", q_bud->status);
160 break; 175 break;
161 } 176 }
162 gaim_debug(GAIM_DEBUG_INFO, "QQ", "set buddy %d to %s\n", q_bud->uid, status_id); 177 gaim_debug(GAIM_DEBUG_INFO, "QQ", "set buddy %d to %s\n", q_bud->uid, status_id);
163 gaim_prpl_got_user_status(gc->account, name, status_id, NULL); 178 gaim_prpl_got_user_status(gc->account, name, status_id, NULL);
179 _qq_update_buddy_icon(gc->account, name, q_bud->face);
164 } else { 180 } else {
165 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "unknown buddy: %d\n", q_bud->uid); 181 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "unknown buddy: %d\n", q_bud->uid);
166 } 182 }
167 183
168 gaim_debug(GAIM_DEBUG_INFO, "QQ", "qq_update_buddy_contact, client=%04x\n", q_bud->client_version); 184 gaim_debug(GAIM_DEBUG_INFO, "QQ", "qq_update_buddy_contact, client=%04x\n", q_bud->client_version);