From: <ev...@us...> - 2006-09-26 23:20:44
|
Revision: 17377 http://svn.sourceforge.net/gaim/?rev=17377&view=rev Author: evands Date: 2006-09-26 16:20:39 -0700 (Tue, 26 Sep 2006) Log Message: ----------- 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. Modified Paths: -------------- trunk/libgaim/protocols/yahoo/yahoo.c trunk/libgaim/protocols/yahoo/yahoo.h trunk/libgaim/protocols/yahoo/yahoo_picture.c Modified: trunk/libgaim/protocols/yahoo/yahoo.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.c 2006-09-26 23:02:40 UTC (rev 17376) +++ trunk/libgaim/protocols/yahoo/yahoo.c 2006-09-26 23:20:39 UTC (rev 17377) @@ -2778,6 +2778,8 @@ yd->rxlen = 0; g_free(yd->picture_url); + if (yd->buddy_icon_connect_data) + gaim_proxy_connect_cancel(yd->buddy_icon_connect_data); if (yd->picture_upload_todo) yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); if (yd->ycht) Modified: trunk/libgaim/protocols/yahoo/yahoo.h =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.h 2006-09-26 23:02:40 UTC (rev 17376) +++ trunk/libgaim/protocols/yahoo/yahoo.h 2006-09-26 23:20:39 UTC (rev 17377) @@ -137,6 +137,7 @@ /* ew. we have to check the icon before we connect, * but can't upload it til we're connected. */ struct yahoo_buddy_icon_upload_data *picture_upload_todo; + GaimProxyConnectData *buddy_icon_connect_data; struct _YchtConn *ycht; Modified: trunk/libgaim/protocols/yahoo/yahoo_picture.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo_picture.c 2006-09-26 23:02:40 UTC (rev 17376) +++ trunk/libgaim/protocols/yahoo/yahoo_picture.c 2006-09-26 23:20:39 UTC (rev 17377) @@ -444,13 +444,15 @@ account = gaim_connection_get_account(gc); yd = gc->proto_data; + /* Buddy icon connect is now complete; clear the GaimProxyConnectData */ + yd->buddy_icon_connect_data = NULL; + if (source < 0) { gaim_debug_error("yahoo", "Buddy icon upload failed, no file desc.\n"); yahoo_buddy_icon_upload_data_free(d); return; } - pkt = yahoo_packet_new(0xc2, YAHOO_STATUS_AVAILABLE, yd->session_id); size = g_strdup_printf("%" G_GSIZE_FORMAT, d->str->len); @@ -498,26 +500,37 @@ { GaimAccount *account = gaim_connection_get_account(gc); struct yahoo_data *yd = gc->proto_data; + GaimProxyConnectData *connect_data = NULL; g_return_if_fail(d != NULL); + if (yd->buddy_icon_connect_data) { + /* Cancel any in-progress buddy icon upload */ + gaim_proxy_connect_cancel(yd->buddy_icon_connect_data); + yd->buddy_icon_connect_data = NULL; + } + if (yd->jp) { - if (gaim_proxy_connect(account, gaim_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), - gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_buddy_icon_upload_connected, d) == NULL) + if ((connect_data = gaim_proxy_connect(account, gaim_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), + gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), + yahoo_buddy_icon_upload_connected, d)) == NULL) { gaim_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); yahoo_buddy_icon_upload_data_free(d); } } else { - if (gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), - gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_buddy_icon_upload_connected, d) == NULL) + if ((connect_data = gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), + gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), + yahoo_buddy_icon_upload_connected, d)) == NULL) { gaim_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); yahoo_buddy_icon_upload_data_free(d); } } + + if (connect_data) { + yd->buddy_icon_connect_data = connect_data; + } } void yahoo_set_buddy_icon(GaimConnection *gc, const char *iconfile) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |