comparison src/protocols/yahoo/yahoo_picture.c @ 9322:119f8a2c00b6

[gaim-migrate @ 10130] Move a function, and add a debug statement. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 20 Jun 2004 04:21:47 +0000
parents 085190b9dd64
children f40233043b5a
comparison
equal deleted inserted replaced
9321:542ad8b1a50f 9322:119f8a2c00b6
60 60
61 g_free(d->who); 61 g_free(d->who);
62 g_free(d); 62 g_free(d);
63 } 63 }
64 64
65 void yahoo_send_picture_info(GaimConnection *gc, const char *who)
66 {
67 struct yahoo_data *yd = gc->proto_data;
68 struct yahoo_packet *pkt;
69 char *buf;
70
71 if (!yd->picture_url)
72 return;
73
74 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, 0);
75 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
76 yahoo_packet_hash(pkt, 4, gaim_connection_get_display_name(gc));
77 yahoo_packet_hash(pkt, 5, who);
78 yahoo_packet_hash(pkt, 13, "2");
79 yahoo_packet_hash(pkt, 20, yd->picture_url);
80 buf = g_strdup_printf("%d", yd->picture_checksum);
81 yahoo_packet_hash(pkt, 192, buf);
82
83 yahoo_send_packet(yd, pkt);
84 yahoo_packet_free(pkt);
85 g_free(buf);
86 }
87
88 void yahoo_process_picture(GaimConnection *gc, struct yahoo_packet *pkt) 65 void yahoo_process_picture(GaimConnection *gc, struct yahoo_packet *pkt)
89 { 66 {
90 GSList *l = pkt->hash; 67 GSList *l = pkt->hash;
91 char *who = NULL, *us = NULL; 68 char *who = NULL, *us = NULL;
92 gboolean got_icon_info = FALSE, send_icon_info = FALSE; 69 gboolean got_icon_info = FALSE, send_icon_info = FALSE;
168 } 145 }
169 146
170 if (who) { 147 if (who) {
171 if (icon == 2) 148 if (icon == 2)
172 yahoo_send_picture_request(gc, who); 149 yahoo_send_picture_request(gc, who);
173 else if (icon == 0) 150 else if ((icon == 0) || (icon == 1)) {
174 gaim_buddy_icons_set_for_user(gc->account, who, NULL, 0); 151 gaim_buddy_icons_set_for_user(gc->account, who, NULL, 0);
152 gaim_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who);
153 }
175 } 154 }
176 } 155 }
177 156
178 void yahoo_process_picture_checksum(GaimConnection *gc, struct yahoo_packet *pkt) 157 void yahoo_process_picture_checksum(GaimConnection *gc, struct yahoo_packet *pkt)
179 { 158 {
239 yahoo_send_picture_update(gc, 2); 218 yahoo_send_picture_update(gc, 2);
240 yahoo_send_picture_checksum(gc); 219 yahoo_send_picture_checksum(gc);
241 } 220 }
242 } 221 }
243 222
223 void yahoo_send_picture_info(GaimConnection *gc, const char *who)
224 {
225 struct yahoo_data *yd = gc->proto_data;
226 struct yahoo_packet *pkt;
227 char *buf;
228
229 if (!yd->picture_url)
230 return;
231
232 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, 0);
233 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
234 yahoo_packet_hash(pkt, 4, gaim_connection_get_display_name(gc));
235 yahoo_packet_hash(pkt, 5, who);
236 yahoo_packet_hash(pkt, 13, "2");
237 yahoo_packet_hash(pkt, 20, yd->picture_url);
238 buf = g_strdup_printf("%d", yd->picture_checksum);
239 yahoo_packet_hash(pkt, 192, buf);
240
241 yahoo_send_packet(yd, pkt);
242 yahoo_packet_free(pkt);
243 g_free(buf);
244 }
244 245
245 void yahoo_send_picture_request(GaimConnection *gc, const char *who) 246 void yahoo_send_picture_request(GaimConnection *gc, const char *who)
246 { 247 {
247 struct yahoo_data *yd = gc->proto_data; 248 struct yahoo_data *yd = gc->proto_data;
248 struct yahoo_packet *pkt; 249 struct yahoo_packet *pkt;