gobjectification: b2500c36: Get rid of PURPLE_CONNECTION_IS_VALID in...
qulogic at pidgin.im
qulogic at pidgin.im
Wed Aug 13 00:51:23 EDT 2008
-----------------------------------------------------------------
Revision: b2500c36bd05a4a629c803b89a7a019bd9e663f5
Ancestor: 41b16d9ebc1efb9eb5ea0eb12893f66efa9d1226
Author: qulogic at pidgin.im
Date: 2008-08-13T02:28:34
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/b2500c36bd05a4a629c803b89a7a019bd9e663f5
Modified files:
libpurple/protocols/jabber/jabber.c
ChangeLog:
Get rid of PURPLE_CONNECTION_IS_VALID in jabber.c. All those callbacks
should be cancelled in jabber_close. The functions jabber_recv_cb_ssl
jabber_login_callback_ssl & jabber_ssl_connect_failure should be
cancelled with js->gsc and jabber_recv_cb with "inpa" property of the
PurpleConnection. This should fix the login-freeze the right way.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c 34faf5447118159fdd92c78fce5f4004fc30227f
+++ libpurple/protocols/jabber/jabber.c 420fe49a1452efd8f0c2b6e9cde2729328afc623
@@ -416,12 +416,6 @@ jabber_recv_cb_ssl(gpointer data, Purple
int len;
static char buf[4096];
- /* TODO: It should be possible to make this check unnecessary */
- if(!PURPLE_CONNECTION_IS_VALID(gc)) {
- purple_ssl_close(gsc);
- return;
- }
-
while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
purple_connection_received_now(gc);
buf[len] = '\0';
@@ -452,9 +446,6 @@ jabber_recv_cb(gpointer data, gint sourc
int len;
static char buf[4096];
- if(!PURPLE_CONNECTION_IS_VALID(gc))
- return;
-
if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
purple_connection_received_now(gc);
#ifdef HAVE_CYRUS_SASL
@@ -496,12 +487,6 @@ jabber_login_callback_ssl(gpointer data,
PurpleConnection *gc = data;
JabberStream *js;
- /* TODO: It should be possible to make this check unnecessary */
- if(!PURPLE_CONNECTION_IS_VALID(gc)) {
- purple_ssl_close(gsc);
- return;
- }
-
js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if(js->state == JABBER_STREAM_CONNECTING)
@@ -544,7 +529,7 @@ jabber_login_callback(gpointer data, gin
jabber_send_raw(js, "<?xml version='1.0' ?>", -1);
jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING);
- g_object_set(G_OBJECT(gc),"inpa",purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc),NULL);
+ g_object_set(G_OBJECT(gc), "inpa", purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc), NULL);
}
static void
@@ -554,10 +539,6 @@ jabber_ssl_connect_failure(PurpleSslConn
PurpleConnection *gc = data;
JabberStream *js;
- /* If the connection is already disconnected, we don't need to do anything else */
- if(!PURPLE_CONNECTION_IS_VALID(gc))
- return;
-
js = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
js->gsc = NULL;
@@ -566,8 +547,8 @@ static void tls_init(JabberStream *js)
static void tls_init(JabberStream *js)
{
- purple_input_remove(purple_object_get_int(PURPLE_OBJECT(js->gc),"inpa"));
- g_object_set(G_OBJECT(js->gc),"inpa",0,NULL);
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(js->gc), "inpa"));
+ g_object_set(G_OBJECT(js->gc), "inpa", 0, NULL);
js->gsc = purple_ssl_connect_with_host_fd(purple_connection_get_account(js->gc), js->fd,
jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc);
}
@@ -1307,8 +1288,8 @@ void jabber_close(PurpleConnection *gc)
#endif
purple_ssl_close(js->gsc);
} else if (js->fd > 0) {
- if(purple_object_get_int(PURPLE_OBJECT(js->gc),"inpa"))
- purple_input_remove(purple_object_get_int(PURPLE_OBJECT(js->gc),"inpa"));
+ if (purple_object_get_int(PURPLE_OBJECT(js->gc), "inpa"))
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(js->gc), "inpa"));
close(js->fd);
}
More information about the Commits
mailing list