Mercurial > pidgin
comparison libgaim/protocols/yahoo/yahoo_picture.c @ 14631:622931ca5622
[gaim-migrate @ 17377]
A pending yahoo_buddy_icon_upload() request is now cancelled when disconnecting or if a second upload request is made, which can happen if the user rapidly changes buddy icons.
committer: Tailor Script <tailor@pidgin.im>
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Tue, 26 Sep 2006 23:20:39 +0000 |
parents | 776615acf309 |
children | 118fd0dc5b6e |
comparison
equal
deleted
inserted
replaced
14630:275c84b1b2a4 | 14631:622931ca5622 |
---|---|
442 | 442 |
443 gc = d->gc; | 443 gc = d->gc; |
444 account = gaim_connection_get_account(gc); | 444 account = gaim_connection_get_account(gc); |
445 yd = gc->proto_data; | 445 yd = gc->proto_data; |
446 | 446 |
447 /* Buddy icon connect is now complete; clear the GaimProxyConnectData */ | |
448 yd->buddy_icon_connect_data = NULL; | |
449 | |
447 if (source < 0) { | 450 if (source < 0) { |
448 gaim_debug_error("yahoo", "Buddy icon upload failed, no file desc.\n"); | 451 gaim_debug_error("yahoo", "Buddy icon upload failed, no file desc.\n"); |
449 yahoo_buddy_icon_upload_data_free(d); | 452 yahoo_buddy_icon_upload_data_free(d); |
450 return; | 453 return; |
451 } | 454 } |
452 | |
453 | 455 |
454 pkt = yahoo_packet_new(0xc2, YAHOO_STATUS_AVAILABLE, yd->session_id); | 456 pkt = yahoo_packet_new(0xc2, YAHOO_STATUS_AVAILABLE, yd->session_id); |
455 | 457 |
456 size = g_strdup_printf("%" G_GSIZE_FORMAT, d->str->len); | 458 size = g_strdup_printf("%" G_GSIZE_FORMAT, d->str->len); |
457 /* 1 = me, 38 = expire time(?), 0 = me, 28 = size, 27 = filename, 14 = NULL, 29 = data */ | 459 /* 1 = me, 38 = expire time(?), 0 = me, 28 = size, 27 = filename, 14 = NULL, 29 = data */ |
496 | 498 |
497 void yahoo_buddy_icon_upload(GaimConnection *gc, struct yahoo_buddy_icon_upload_data *d) | 499 void yahoo_buddy_icon_upload(GaimConnection *gc, struct yahoo_buddy_icon_upload_data *d) |
498 { | 500 { |
499 GaimAccount *account = gaim_connection_get_account(gc); | 501 GaimAccount *account = gaim_connection_get_account(gc); |
500 struct yahoo_data *yd = gc->proto_data; | 502 struct yahoo_data *yd = gc->proto_data; |
503 GaimProxyConnectData *connect_data = NULL; | |
501 | 504 |
502 g_return_if_fail(d != NULL); | 505 g_return_if_fail(d != NULL); |
503 | 506 |
507 if (yd->buddy_icon_connect_data) { | |
508 /* Cancel any in-progress buddy icon upload */ | |
509 gaim_proxy_connect_cancel(yd->buddy_icon_connect_data); | |
510 yd->buddy_icon_connect_data = NULL; | |
511 } | |
512 | |
504 if (yd->jp) { | 513 if (yd->jp) { |
505 if (gaim_proxy_connect(account, gaim_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), | 514 if ((connect_data = gaim_proxy_connect(account, gaim_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), |
506 gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), | 515 gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), |
507 yahoo_buddy_icon_upload_connected, d) == NULL) | 516 yahoo_buddy_icon_upload_connected, d)) == NULL) |
508 { | 517 { |
509 gaim_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); | 518 gaim_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); |
510 yahoo_buddy_icon_upload_data_free(d); | 519 yahoo_buddy_icon_upload_data_free(d); |
511 } | 520 } |
512 } else { | 521 } else { |
513 if (gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), | 522 if ((connect_data = gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), |
514 gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), | 523 gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), |
515 yahoo_buddy_icon_upload_connected, d) == NULL) | 524 yahoo_buddy_icon_upload_connected, d)) == NULL) |
516 { | 525 { |
517 gaim_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); | 526 gaim_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); |
518 yahoo_buddy_icon_upload_data_free(d); | 527 yahoo_buddy_icon_upload_data_free(d); |
519 } | 528 } |
529 } | |
530 | |
531 if (connect_data) { | |
532 yd->buddy_icon_connect_data = connect_data; | |
520 } | 533 } |
521 } | 534 } |
522 | 535 |
523 void yahoo_set_buddy_icon(GaimConnection *gc, const char *iconfile) | 536 void yahoo_set_buddy_icon(GaimConnection *gc, const char *iconfile) |
524 { | 537 { |