pidgin: d0a34f1a: Yahoo: Move the "inpa" input watcher int...
andrew.victor at mxit.com
andrew.victor at mxit.com
Tue Oct 18 17:57:04 EDT 2011
----------------------------------------------------------------------
Revision: d0a34f1afe4365aea21a704526a844620d6a7c84
Parent: ec03cf27e2c134919ef7cd1adf951dd0afcec4b0
Author: andrew.victor at mxit.com
Date: 10/18/11 17:39:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d0a34f1afe4365aea21a704526a844620d6a7c84
Changelog:
Yahoo: Move the "inpa" input watcher into protocol_data.
Changes against parent ec03cf27e2c134919ef7cd1adf951dd0afcec4b0
patched libpurple/protocols/yahoo/libymsg.c
patched libpurple/protocols/yahoo/libymsg.h
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c 4d9cf41e9410969a1f3e13952166d8459b9b314b
+++ libpurple/protocols/yahoo/libymsg.c c011e770810c77ce5a5a105dfc022713d3e3ca99
@@ -2244,8 +2244,10 @@ static void yahoo_process_authresp(Purpl
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 @@ static void yahoo_got_connected(gpointer
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 @@ static void yahoo_got_web_connected(gpoi
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 @@ static void yahoo_web_pending(gpointer d
}
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(gp
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 @@ static void yahoo_got_cookies_send_cb(gp
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 @@ static void yahoo_got_cookies_send_cb(gp
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 @@ static void yahoo_got_cookies(gpointer d
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 @@ void yahoo_close(PurpleConnection *gc) {
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);
============================================================
--- libpurple/protocols/yahoo/libymsg.h 33426a009b36fcbe8e4554854737da6af7ad3b1c
+++ libpurple/protocols/yahoo/libymsg.h d260fccb7275f1e79b682ebbef480b72638c1a34
@@ -188,6 +188,7 @@ typedef struct {
typedef struct {
PurpleConnection *gc;
int fd;
+ guint inpa;
guchar *rxqueue;
int rxlen;
PurpleCircBuffer *txbuf;
More information about the Commits
mailing list