Mercurial > pidgin
comparison libpurple/protocols/yahoo/yahoo_picture.c @ 32147:513b8ec76077
propagate from branch 'im.pidgin.pidgin.2.x.y' (head be5e66abad2af29604bc794cc4c6600ab12751f3)
to branch 'im.pidgin.pidgin' (head be7373160916cdcb9710432f506e4eac29df8296)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 11 Sep 2011 04:19:01 +0000 |
parents | 88a46649de3d fcf841ffd620 |
children | 904686722499 |
comparison
equal
deleted
inserted
replaced
32146:88a46649de3d | 32147:513b8ec76077 |
---|---|
50 { | 50 { |
51 struct yahoo_fetch_picture_data *d; | 51 struct yahoo_fetch_picture_data *d; |
52 YahooData *yd; | 52 YahooData *yd; |
53 | 53 |
54 d = user_data; | 54 d = user_data; |
55 yd = d->gc->proto_data; | 55 yd = purple_connection_get_protocol_data(d->gc); |
56 yd->url_datas = g_slist_remove(yd->url_datas, url_data); | 56 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
57 | 57 |
58 if (error_message != NULL) { | 58 if (error_message != NULL) { |
59 purple_debug_error("yahoo", "Fetching buddy icon failed: %s\n", error_message); | 59 purple_debug_error("yahoo", "Fetching buddy icon failed: %s\n", error_message); |
60 } else if (len == 0) { | 60 } else if (len == 0) { |
133 /* TODO: Does this need to be MSIE 5.0? */ | 133 /* TODO: Does this need to be MSIE 5.0? */ |
134 url_data = purple_util_fetch_url(url, use_whole_url, | 134 url_data = purple_util_fetch_url(url, use_whole_url, |
135 "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, | 135 "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, |
136 yahoo_fetch_picture_cb, data); | 136 yahoo_fetch_picture_cb, data); |
137 if (url_data != NULL) { | 137 if (url_data != NULL) { |
138 yd = gc->proto_data; | 138 yd = purple_connection_get_protocol_data(gc); |
139 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); | 139 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
140 } else { | 140 } else { |
141 g_free(data->who); | 141 g_free(data->who); |
142 g_free(data); | 142 g_free(data); |
143 } | 143 } |
183 } | 183 } |
184 | 184 |
185 void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) | 185 void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) |
186 { | 186 { |
187 PurpleAccount *account = purple_connection_get_account(gc); | 187 PurpleAccount *account = purple_connection_get_account(gc); |
188 YahooData *yd = gc->proto_data; | 188 YahooData *yd = purple_connection_get_protocol_data(gc); |
189 GSList *l = pkt->hash; | 189 GSList *l = pkt->hash; |
190 char *url = NULL; | 190 char *url = NULL; |
191 | 191 |
192 while (l) { | 192 while (l) { |
193 struct yahoo_pair *pair = l->data; | 193 struct yahoo_pair *pair = l->data; |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 void yahoo_send_picture_info(PurpleConnection *gc, const char *who) | 262 void yahoo_send_picture_info(PurpleConnection *gc, const char *who) |
263 { | 263 { |
264 YahooData *yd = gc->proto_data; | 264 YahooData *yd = purple_connection_get_protocol_data(gc); |
265 struct yahoo_packet *pkt; | 265 struct yahoo_packet *pkt; |
266 | 266 |
267 if (!yd->picture_url) { | 267 if (!yd->picture_url) { |
268 purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); | 268 purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); |
269 return; | 269 return; |
276 yahoo_packet_send_and_free(pkt, yd); | 276 yahoo_packet_send_and_free(pkt, yd); |
277 } | 277 } |
278 | 278 |
279 void yahoo_send_picture_request(PurpleConnection *gc, const char *who) | 279 void yahoo_send_picture_request(PurpleConnection *gc, const char *who) |
280 { | 280 { |
281 YahooData *yd = gc->proto_data; | 281 YahooData *yd = purple_connection_get_protocol_data(gc); |
282 struct yahoo_packet *pkt; | 282 struct yahoo_packet *pkt; |
283 | 283 |
284 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); | 284 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
285 yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ | 285 yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ |
286 yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ | 286 yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ |
288 yahoo_packet_send_and_free(pkt, yd); | 288 yahoo_packet_send_and_free(pkt, yd); |
289 } | 289 } |
290 | 290 |
291 void yahoo_send_picture_checksum(PurpleConnection *gc) | 291 void yahoo_send_picture_checksum(PurpleConnection *gc) |
292 { | 292 { |
293 YahooData *yd = gc->proto_data; | 293 YahooData *yd = purple_connection_get_protocol_data(gc); |
294 struct yahoo_packet *pkt; | 294 struct yahoo_packet *pkt; |
295 | 295 |
296 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); | 296 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); |
297 yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), | 297 yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), |
298 212, "1", 192, yd->picture_checksum); | 298 212, "1", 192, yd->picture_checksum); |
299 yahoo_packet_send_and_free(pkt, yd); | 299 yahoo_packet_send_and_free(pkt, yd); |
300 } | 300 } |
301 | 301 |
302 void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) | 302 void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) |
303 { | 303 { |
304 YahooData *yd = gc->proto_data; | 304 YahooData *yd = purple_connection_get_protocol_data(gc); |
305 struct yahoo_packet *pkt; | 305 struct yahoo_packet *pkt; |
306 | 306 |
307 pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); | 307 pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
308 yahoo_packet_hash(pkt, "si", 3, who, 213, type); | 308 yahoo_packet_hash(pkt, "si", 3, who, 213, type); |
309 yahoo_packet_send_and_free(pkt, yd); | 309 yahoo_packet_send_and_free(pkt, yd); |
324 yahoo_send_picture_update_to_user(d->gc, who, d->type); | 324 yahoo_send_picture_update_to_user(d->gc, who, d->type); |
325 } | 325 } |
326 | 326 |
327 void yahoo_send_picture_update(PurpleConnection *gc, int type) | 327 void yahoo_send_picture_update(PurpleConnection *gc, int type) |
328 { | 328 { |
329 YahooData *yd = gc->proto_data; | 329 YahooData *yd = purple_connection_get_protocol_data(gc); |
330 struct yspufe data; | 330 struct yspufe data; |
331 | 331 |
332 data.gc = gc; | 332 data.gc = gc; |
333 data.type = type; | 333 data.type = type; |
334 | 334 |
423 YahooData *yd; | 423 YahooData *yd; |
424 /* use whole URL if using HTTP Proxy */ | 424 /* use whole URL if using HTTP Proxy */ |
425 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); | 425 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
426 | 426 |
427 account = purple_connection_get_account(gc); | 427 account = purple_connection_get_account(gc); |
428 yd = gc->proto_data; | 428 yd = purple_connection_get_protocol_data(gc); |
429 | 429 |
430 /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ | 430 /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ |
431 yd->buddy_icon_connect_data = NULL; | 431 yd->buddy_icon_connect_data = NULL; |
432 | 432 |
433 if (source < 0) { | 433 if (source < 0) { |
488 } | 488 } |
489 | 489 |
490 void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) | 490 void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) |
491 { | 491 { |
492 PurpleAccount *account = purple_connection_get_account(gc); | 492 PurpleAccount *account = purple_connection_get_account(gc); |
493 YahooData *yd = gc->proto_data; | 493 YahooData *yd = purple_connection_get_protocol_data(gc); |
494 | 494 |
495 if (yd->buddy_icon_connect_data != NULL) { | 495 if (yd->buddy_icon_connect_data != NULL) { |
496 /* Cancel any in-progress buddy icon upload */ | 496 /* Cancel any in-progress buddy icon upload */ |
497 purple_proxy_connect_cancel(yd->buddy_icon_connect_data); | 497 purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
498 yd->buddy_icon_connect_data = NULL; | 498 yd->buddy_icon_connect_data = NULL; |
533 return checksum; | 533 return checksum; |
534 } | 534 } |
535 | 535 |
536 void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) | 536 void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
537 { | 537 { |
538 YahooData *yd = gc->proto_data; | 538 YahooData *yd = purple_connection_get_protocol_data(gc); |
539 PurpleAccount *account = gc->account; | 539 PurpleAccount *account = gc->account; |
540 | 540 |
541 if (img == NULL) { | 541 if (img == NULL) { |
542 g_free(yd->picture_url); | 542 g_free(yd->picture_url); |
543 yd->picture_url = NULL; | 543 yd->picture_url = NULL; |