Mercurial > pidgin
comparison libpurple/protocols/yahoo/yahoo_picture.c @ 27694:908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
in the prpl. I'm sure someone is going to want to shoot me over this, but I'm
tired of seeing "struct yahoo_data" everywhere in this prpl.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 26 Jul 2009 17:25:18 +0000 |
parents | 8bc9087b5ec2 |
children | fcf841ffd620 88a46649de3d 3828a61c44da |
comparison
equal
deleted
inserted
replaced
27693:8bc9087b5ec2 | 27694:908be3822215 |
---|---|
47 static void | 47 static void |
48 yahoo_fetch_picture_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, | 48 yahoo_fetch_picture_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
49 const gchar *pic_data, size_t len, const gchar *error_message) | 49 const gchar *pic_data, size_t len, const gchar *error_message) |
50 { | 50 { |
51 struct yahoo_fetch_picture_data *d; | 51 struct yahoo_fetch_picture_data *d; |
52 struct yahoo_data *yd; | 52 YahooData *yd; |
53 | 53 |
54 d = user_data; | 54 d = user_data; |
55 yd = d->gc->proto_data; | 55 yd = d->gc->proto_data; |
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 |
69 g_free(d); | 69 g_free(d); |
70 } | 70 } |
71 | 71 |
72 void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) | 72 void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) |
73 { | 73 { |
74 struct yahoo_data *yd; | 74 YahooData *yd; |
75 GSList *l = pkt->hash; | 75 GSList *l = pkt->hash; |
76 char *who = NULL, *us = NULL; | 76 char *who = NULL, *us = NULL; |
77 gboolean got_icon_info = FALSE, send_icon_info = FALSE; | 77 gboolean got_icon_info = FALSE, send_icon_info = FALSE; |
78 char *url = NULL; | 78 char *url = NULL; |
79 int checksum = 0; | 79 int checksum = 0; |
190 } | 190 } |
191 | 191 |
192 void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) | 192 void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) |
193 { | 193 { |
194 PurpleAccount *account = purple_connection_get_account(gc); | 194 PurpleAccount *account = purple_connection_get_account(gc); |
195 struct yahoo_data *yd = gc->proto_data; | 195 YahooData *yd = gc->proto_data; |
196 GSList *l = pkt->hash; | 196 GSList *l = pkt->hash; |
197 char *url = NULL; | 197 char *url = NULL; |
198 | 198 |
199 while (l) { | 199 while (l) { |
200 struct yahoo_pair *pair = l->data; | 200 struct yahoo_pair *pair = l->data; |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 void yahoo_send_picture_info(PurpleConnection *gc, const char *who) | 269 void yahoo_send_picture_info(PurpleConnection *gc, const char *who) |
270 { | 270 { |
271 struct yahoo_data *yd = gc->proto_data; | 271 YahooData *yd = gc->proto_data; |
272 struct yahoo_packet *pkt; | 272 struct yahoo_packet *pkt; |
273 | 273 |
274 if (!yd->picture_url) { | 274 if (!yd->picture_url) { |
275 purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); | 275 purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); |
276 return; | 276 return; |
283 yahoo_packet_send_and_free(pkt, yd); | 283 yahoo_packet_send_and_free(pkt, yd); |
284 } | 284 } |
285 | 285 |
286 void yahoo_send_picture_request(PurpleConnection *gc, const char *who) | 286 void yahoo_send_picture_request(PurpleConnection *gc, const char *who) |
287 { | 287 { |
288 struct yahoo_data *yd = gc->proto_data; | 288 YahooData *yd = gc->proto_data; |
289 struct yahoo_packet *pkt; | 289 struct yahoo_packet *pkt; |
290 | 290 |
291 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); | 291 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
292 yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ | 292 yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ |
293 yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ | 293 yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ |
295 yahoo_packet_send_and_free(pkt, yd); | 295 yahoo_packet_send_and_free(pkt, yd); |
296 } | 296 } |
297 | 297 |
298 void yahoo_send_picture_checksum(PurpleConnection *gc) | 298 void yahoo_send_picture_checksum(PurpleConnection *gc) |
299 { | 299 { |
300 struct yahoo_data *yd = gc->proto_data; | 300 YahooData *yd = gc->proto_data; |
301 struct yahoo_packet *pkt; | 301 struct yahoo_packet *pkt; |
302 | 302 |
303 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); | 303 pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); |
304 yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), | 304 yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), |
305 212, "1", 192, yd->picture_checksum); | 305 212, "1", 192, yd->picture_checksum); |
306 yahoo_packet_send_and_free(pkt, yd); | 306 yahoo_packet_send_and_free(pkt, yd); |
307 } | 307 } |
308 | 308 |
309 void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) | 309 void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) |
310 { | 310 { |
311 struct yahoo_data *yd = gc->proto_data; | 311 YahooData *yd = gc->proto_data; |
312 struct yahoo_packet *pkt; | 312 struct yahoo_packet *pkt; |
313 | 313 |
314 pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); | 314 pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
315 yahoo_packet_hash(pkt, "si", 3, who, 213, type); | 315 yahoo_packet_hash(pkt, "si", 3, who, 213, type); |
316 yahoo_packet_send_and_free(pkt, yd); | 316 yahoo_packet_send_and_free(pkt, yd); |
331 yahoo_send_picture_update_to_user(d->gc, who, d->type); | 331 yahoo_send_picture_update_to_user(d->gc, who, d->type); |
332 } | 332 } |
333 | 333 |
334 void yahoo_send_picture_update(PurpleConnection *gc, int type) | 334 void yahoo_send_picture_update(PurpleConnection *gc, int type) |
335 { | 335 { |
336 struct yahoo_data *yd = gc->proto_data; | 336 YahooData *yd = gc->proto_data; |
337 struct yspufe data; | 337 struct yspufe data; |
338 | 338 |
339 data.gc = gc; | 339 data.gc = gc; |
340 data.type = type; | 340 data.type = type; |
341 | 341 |
425 const char *host; | 425 const char *host; |
426 int port; | 426 int port; |
427 gsize pkt_buf_len; | 427 gsize pkt_buf_len; |
428 PurpleConnection *gc = d->gc; | 428 PurpleConnection *gc = d->gc; |
429 PurpleAccount *account; | 429 PurpleAccount *account; |
430 struct yahoo_data *yd; | 430 YahooData *yd; |
431 /* use whole URL if using HTTP Proxy */ | 431 /* use whole URL if using HTTP Proxy */ |
432 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); | 432 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
433 | 433 |
434 account = purple_connection_get_account(gc); | 434 account = purple_connection_get_account(gc); |
435 yd = gc->proto_data; | 435 yd = gc->proto_data; |
495 } | 495 } |
496 | 496 |
497 void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) | 497 void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) |
498 { | 498 { |
499 PurpleAccount *account = purple_connection_get_account(gc); | 499 PurpleAccount *account = purple_connection_get_account(gc); |
500 struct yahoo_data *yd = gc->proto_data; | 500 YahooData *yd = gc->proto_data; |
501 | 501 |
502 if (yd->buddy_icon_connect_data != NULL) { | 502 if (yd->buddy_icon_connect_data != NULL) { |
503 /* Cancel any in-progress buddy icon upload */ | 503 /* Cancel any in-progress buddy icon upload */ |
504 purple_proxy_connect_cancel(yd->buddy_icon_connect_data); | 504 purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
505 yd->buddy_icon_connect_data = NULL; | 505 yd->buddy_icon_connect_data = NULL; |
540 return checksum; | 540 return checksum; |
541 } | 541 } |
542 | 542 |
543 void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) | 543 void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
544 { | 544 { |
545 struct yahoo_data *yd = gc->proto_data; | 545 YahooData *yd = gc->proto_data; |
546 PurpleAccount *account = gc->account; | 546 PurpleAccount *account = gc->account; |
547 | 547 |
548 if (img == NULL) { | 548 if (img == NULL) { |
549 g_free(yd->picture_url); | 549 g_free(yd->picture_url); |
550 yd->picture_url = NULL; | 550 yd->picture_url = NULL; |