# HG changeset patch # User andrew.victor@mxit.com # Date 1318973965 0 # Node ID 75daf132caf25161b891a842f50d3ad0f9d6e5bc # Parent f236f3fce0d876b6540722394c9c0a4835d005c9 Yahoo: Move the "inpa" input watcher into protocol_data. diff -r f236f3fce0d8 -r 75daf132caf2 libpurple/protocols/yahoo/libymsg.c --- a/libpurple/protocols/yahoo/libymsg.c Tue Oct 18 21:27:51 2011 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Tue Oct 18 21:39:25 2011 +0000 @@ -2244,8 +2244,10 @@ yd->wm = TRUE; if (yd->fd >= 0) close(yd->fd); - if (gc->inpa) - purple_input_remove(gc->inpa); + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, "Purple/" VERSION, FALSE, -1, yahoo_login_page_cb, gc); if (url_data != NULL) @@ -3248,7 +3250,7 @@ yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc)))); yahoo_packet_send_and_free(pkt, yd); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); + yd->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); } #ifdef TRY_WEBMESSENGER_LOGIN @@ -3278,7 +3280,7 @@ yahoo_packet_send_and_free(pkt, yd); g_free(yd->auth); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); + yd->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); } static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) @@ -3342,7 +3344,8 @@ } yd->auth = g_string_free(s, FALSE); - purple_input_remove(gc->inpa); + purple_input_remove(yd->inpa); + yd->inpa = 0; close(source); g_free(yd->rxqueue); yd->rxqueue = NULL; @@ -3359,13 +3362,10 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc; - YahooData *yd; + PurpleConnection *gc = data; + YahooData *yd = purple_connection_get_protocol_data(gc); int written, remaining; - gc = data; - yd = purple_connection_get_protocol_data(gc); - remaining = strlen(yd->auth) - yd->auth_written; written = write(source, yd->auth + yd->auth_written, remaining); @@ -3375,9 +3375,10 @@ gchar *tmp; g_free(yd->auth); yd->auth = NULL; - if (gc->inpa) - purple_input_remove(gc->inpa); - gc->inpa = 0; + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } tmp = g_strdup_printf(_("Lost connection with %s: %s"), "login.yahoo.com:80", g_strerror(errno)); purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); @@ -3393,13 +3394,14 @@ g_free(yd->auth); yd->auth = NULL; yd->auth_written = 0; - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); + purple_input_remove(yd->inpa); + yd->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); } static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; + YahooData *yd = purple_connection_get_protocol_data(gc); if (source < 0) { gchar *tmp; @@ -3410,9 +3412,9 @@ return; } - if (gc->inpa == 0) + if (yd->inpa == 0) { - gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, + yd->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, yahoo_got_cookies_send_cb, gc); yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); } @@ -3725,8 +3727,10 @@ YahooData *yd = purple_connection_get_protocol_data(gc); GSList *l; - if (gc->inpa) - purple_input_remove(gc->inpa); + if (yd->inpa) { + purple_input_remove(yd->inpa); + yd->inpa = 0; + } while (yd->url_datas) { purple_util_fetch_url_cancel(yd->url_datas->data); diff -r f236f3fce0d8 -r 75daf132caf2 libpurple/protocols/yahoo/libymsg.h --- a/libpurple/protocols/yahoo/libymsg.h Tue Oct 18 21:27:51 2011 +0000 +++ b/libpurple/protocols/yahoo/libymsg.h Tue Oct 18 21:39:25 2011 +0000 @@ -188,6 +188,7 @@ typedef struct { PurpleConnection *gc; int fd; + guint inpa; guchar *rxqueue; int rxlen; PurpleCircBuffer *txbuf;