diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-05 22:20:31 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-05 22:20:31 -0700 |
commit | aef4828a1dc51de10a43bb7dd5d023de9971295b (patch) | |
tree | cbb675b41369f1ada1579fba4060726573cf9cb5 /protocols/jabber | |
parent | 0da65d5fb37691ed4d31f7ab4058732f1440db6b (diff) |
More cleanups, mainly in the callbacks. Replaced things like
do_error_dialog() and (set|hide)_login_progress(_error)?() with things
that hopefully make more sense.
Although it's still not really great...
Diffstat (limited to 'protocols/jabber')
-rw-r--r-- | protocols/jabber/io.c | 54 | ||||
-rw-r--r-- | protocols/jabber/iq.c | 40 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 18 | ||||
-rw-r--r-- | protocols/jabber/presence.c | 6 | ||||
-rw-r--r-- | protocols/jabber/sasl.c | 20 |
5 files changed, 69 insertions, 69 deletions
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index 6e699301..699c7019 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -116,8 +116,8 @@ static gboolean jabber_write_queue( struct im_connection *ic ) closesocket( jd->fd ); /* Shouldn't be necessary after errors? */ jd->fd = -1; - hide_login_progress_error( ic, "Short write() to server" ); - signoff( ic ); + imc_error( ic, "Short write() to server" ); + imc_logout( ic ); return FALSE; } else if( st > 0 ) @@ -159,8 +159,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition /* Parse. */ if( xt_feed( jd->xt, buf, st ) < 0 ) { - hide_login_progress_error( ic, "XML stream error" ); - signoff( ic ); + imc_error( ic, "XML stream error" ); + imc_logout( ic ); return FALSE; } @@ -202,9 +202,9 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition SASL and TLS. */ if( set_getbool( &ic->acc->set, "tls" ) ) { - hide_login_progress( ic, "TLS is turned on for this " + imc_error( ic, "TLS is turned on for this " "account, but is not supported by this server" ); - signoff( ic ); + imc_logout( ic ); return FALSE; } else @@ -215,8 +215,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition } else { - hide_login_progress( ic, "XML stream error" ); - signoff( ic ); + imc_error( ic, "XML stream error" ); + imc_logout( ic ); return FALSE; } } @@ -226,8 +226,8 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition closesocket( jd->fd ); jd->fd = -1; - hide_login_progress_error( ic, "Error while reading from server" ); - signoff( ic ); + imc_error( ic, "Error while reading from server" ); + imc_logout( ic ); return FALSE; } @@ -241,12 +241,12 @@ gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition c if( source == -1 ) { - hide_login_progress( ic, "Could not connect to server" ); - signoff( ic ); + imc_error( ic, "Could not connect to server" ); + imc_logout( ic ); return FALSE; } - set_login_progress( ic, 1, "Connected to server, logging in" ); + imc_log( ic, "Connected to server, logging in" ); return jabber_start_stream( ic ); } @@ -262,19 +262,19 @@ gboolean jabber_connected_ssl( gpointer data, void *source, b_input_condition co already, set it to NULL here to prevent a double cleanup: */ jd->ssl = NULL; - hide_login_progress( ic, "Could not connect to server" ); - signoff( ic ); + imc_error( ic, "Could not connect to server" ); + imc_logout( ic ); return FALSE; } - set_login_progress( ic, 1, "Connected to server, logging in" ); + imc_log( ic, "Connected to server, logging in" ); return jabber_start_stream( ic ); } static xt_status jabber_end_of_stream( struct xt_node *node, gpointer data ) { - signoff( data ); + imc_logout( data ); return XT_ABORT; } @@ -296,8 +296,8 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) ) { - hide_login_progress( ic, "Server requires TLS connections, but TLS is turned off for this account" ); - signoff( ic ); + imc_error( ic, "Server requires TLS connections, but TLS is turned off for this account" ); + imc_logout( ic ); return XT_ABORT; } @@ -326,8 +326,8 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) if( !trytls && set_getbool( &ic->acc->set, "tls" ) ) { - hide_login_progress( ic, "TLS is turned on for this account, but is not supported by this server" ); - signoff( ic ); + imc_error( ic, "TLS is turned on for this account, but is not supported by this server" ); + imc_logout( ic ); return XT_ABORT; } @@ -416,7 +416,7 @@ static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data ) } jd->w_inpa = jd->r_inpa = 0; - set_login_progress( ic, 1, "Converting stream to TLS" ); + imc_log( ic, "Converting stream to TLS" ); jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic ); @@ -451,8 +451,8 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data ) /* Tssk... */ if( type == NULL ) { - hide_login_progress_error( ic, "Unknown stream error reported by server" ); - signoff( ic ); + imc_error( ic, "Unknown stream error reported by server" ); + imc_logout( ic ); return XT_ABORT; } @@ -461,17 +461,17 @@ static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data ) infinite loop! */ if( strcmp( type, "conflict" ) == 0 ) { - hide_login_progress( ic, "Account and resource used from a different location" ); + imc_error( ic, "Account and resource used from a different location" ); ic->wants_to_die = TRUE; } else { s = g_strdup_printf( "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" ); - hide_login_progress_error( ic, s ); + imc_error( ic, s ); g_free( s ); } - signoff( ic ); + imc_logout( ic ); return XT_ABORT; } diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 86d97e15..e1848272 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -38,8 +38,8 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) if( !type ) { - hide_login_progress_error( ic, "Received IQ packet without type." ); - signoff( ic ); + imc_error( ic, "Received IQ packet without type." ); + imc_logout( ic ); return XT_ABORT; } @@ -59,7 +59,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) entry = g_hash_table_lookup( jd->node_cache, s ); if( entry == NULL ) - serv_got_crap( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s ); + imc_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s ); else if( entry->func ) return entry->func( ic, node, entry->node ); } @@ -68,7 +68,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) if( !( c = xt_find_node( node->children, "query" ) ) || !( s = xt_find_attr( c, "xmlns" ) ) ) { - serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type ); + imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); return XT_HANDLED; } @@ -131,7 +131,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) if( !( c = xt_find_node( node->children, "query" ) ) || !( s = xt_find_attr( c, "xmlns" ) ) ) { - serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type ); + imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type ); return XT_HANDLED; } @@ -153,7 +153,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) } else { - serv_got_crap( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" ); + imc_log( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" ); xt_free_node( reply ); reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); @@ -218,8 +218,8 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no if( !( query = xt_find_node( node->children, "query" ) ) ) { - serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" ); - signoff( ic ); + imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); + imc_logout( ic ); return XT_HANDLED; } @@ -257,8 +257,8 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no { xt_free_node( reply ); - hide_login_progress( ic, "Can't find suitable authentication method" ); - signoff( ic ); + imc_error( ic, "Can't find suitable authentication method" ); + imc_logout( ic ); return XT_ABORT; } @@ -276,15 +276,15 @@ static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node if( !( type = xt_find_attr( node, "type" ) ) ) { - serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" ); - signoff( ic ); + imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" ); + imc_logout( ic ); return XT_HANDLED; } if( strcmp( type, "error" ) == 0 ) { - hide_login_progress( ic, "Authentication failure" ); - signoff( ic ); + imc_error( ic, "Authentication failure" ); + imc_logout( ic ); return XT_ABORT; } else if( strcmp( type, "result" ) == 0 ) @@ -310,7 +310,7 @@ xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, c = xt_find_node( c->children, "jid" ); if( c && c->text_len && ( s = strchr( c->text, '/' ) ) && strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) - serv_got_crap( ic, "Server changed session resource string to `%s'", s + 1 ); + imc_log( ic, "Server changed session resource string to `%s'", s + 1 ); jd->flags &= ~JFLAG_WAIT_BIND; } @@ -333,7 +333,7 @@ int jabber_get_roster( struct im_connection *ic ) struct xt_node *node; int st; - set_login_progress( ic, 1, "Authenticated, requesting buddy list" ); + imc_log( ic, "Authenticated, requesting buddy list" ); node = xt_new_node( "query", NULL, NULL ); xt_add_attr( node, "xmlns", XMLNS_ROSTER ); @@ -352,7 +352,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * if( !( query = xt_find_node( node->children, "query" ) ) ) { - serv_got_crap( ic, "WARNING: Received NULL roster packet" ); + imc_log( ic, "WARNING: Received NULL roster packet" ); return XT_HANDLED; } @@ -396,7 +396,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * } if( initial ) - account_online( ic ); + imc_connected( ic ); return XT_HANDLED; } @@ -427,7 +427,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no ( vc = xt_find_node( node->children, "vCard" ) ) == NULL ) { s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */ - serv_got_crap( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" ); + imc_log( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" ); return XT_HANDLED; } @@ -535,7 +535,7 @@ static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_no /* *sigh* */ - serv_got_crap( ic, reply->str ); + imc_log( ic, reply->str ); g_string_free( reply, TRUE ); return XT_HANDLED; diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 23de1103..ec0df487 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -58,7 +58,7 @@ static void jabber_init( account_t *acc ) static void jabber_login( account_t *acc ) { - struct im_connection *ic = new_gaim_conn( acc ); + struct im_connection *ic = imc_new( acc ); struct jabber_data *jd = g_new0( struct jabber_data, 1 ); struct ns_srv_reply *srv = NULL; char *connect_to, *s; @@ -71,8 +71,8 @@ static void jabber_login( account_t *acc ) if( jd->server == NULL ) { - hide_login_progress( ic, "Incomplete account name (format it like <username@jabberserver.name>)" ); - signoff( ic ); + imc_error( ic, "Incomplete account name (format it like <username@jabberserver.name>)" ); + imc_logout( ic ); return; } @@ -158,14 +158,14 @@ static void jabber_login( account_t *acc ) else connect_to = jd->server; - set_login_progress( ic, 0, "Connecting" ); + imc_log( ic, "Connecting" ); if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN || set_getint( &acc->set, "port" ) > JABBER_PORT_MAX ) { - serv_got_crap( ic, "Incorrect port number, must be in the %d-%d range", + imc_log( ic, "Incorrect port number, must be in the %d-%d range", JABBER_PORT_MIN, JABBER_PORT_MAX ); - signoff( ic ); + imc_logout( ic ); return; } @@ -185,8 +185,8 @@ static void jabber_login( account_t *acc ) if( jd->fd == -1 ) { - hide_login_progress( ic, "Could not connect to server" ); - signoff( ic ); + imc_error( ic, "Could not connect to server" ); + imc_logout( ic ); } } @@ -284,7 +284,7 @@ static void jabber_get_info( struct im_connection *ic, char *who ) while( bud ) { - serv_got_crap( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", + imc_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s", bud->full_jid, bud->priority, bud->away_state ? bud->away_state->full_name : "(none)", bud->away_message ? : "(none)" ); diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index 2db32fd1..634948bf 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -40,7 +40,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) ) { if( set_getbool( &ic->irc->set, "debug" ) ) - serv_got_crap( ic, "WARNING: Could not handle presence information from JID: %s", from ); + imc_log( ic, "WARNING: Could not handle presence information from JID: %s", from ); return XT_HANDLED; } @@ -73,7 +73,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) if( jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) == NULL ) { if( set_getbool( &ic->irc->set, "debug" ) ) - serv_got_crap( ic, "WARNING: Received presence information from unknown JID: %s", from ); + imc_log( ic, "WARNING: Received presence information from unknown JID: %s", from ); return XT_HANDLED; } @@ -102,7 +102,7 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) else if( strcmp( type, "subscribed" ) == 0 ) { /* Not sure about this one, actually... */ - serv_got_crap( ic, "%s just accepted your authorization request", from ); + imc_log( ic, "%s just accepted your authorization request", from ); } else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 ) { diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 4943f59e..ab6f6c00 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -37,14 +37,14 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data ) /* Should abort this now, since we should already be doing IQ authentication. Strange things happen when you try to do both... */ - serv_got_crap( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" ); + imc_log( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" ); return XT_HANDLED; } s = xt_find_attr( node, "xmlns" ); if( !s || strcmp( s, XMLNS_SASL ) != 0 ) { - signoff( ic ); + imc_logout( ic ); return XT_ABORT; } @@ -61,8 +61,8 @@ xt_status sasl_pkt_mechanisms( struct xt_node *node, gpointer data ) if( !sup_plain && !sup_digest ) { - hide_login_progress( ic, "No known SASL authentication schemes supported" ); - signoff( ic ); + imc_error( ic, "No known SASL authentication schemes supported" ); + imc_logout( ic ); return XT_ABORT; } @@ -278,8 +278,8 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data ) goto silent_error; error: - hide_login_progress( ic, "Incorrect SASL challenge received" ); - signoff( ic ); + imc_error( ic, "Incorrect SASL challenge received" ); + imc_logout( ic ); silent_error: g_free( digest_uri ); @@ -302,19 +302,19 @@ xt_status sasl_pkt_result( struct xt_node *node, gpointer data ) s = xt_find_attr( node, "xmlns" ); if( !s || strcmp( s, XMLNS_SASL ) != 0 ) { - signoff( ic ); + imc_logout( ic ); return XT_ABORT; } if( strcmp( node->name, "success" ) == 0 ) { - set_login_progress( ic, 1, "Authentication finished" ); + imc_log( ic, "Authentication finished" ); jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART; } else if( strcmp( node->name, "failure" ) == 0 ) { - hide_login_progress( ic, "Authentication failure" ); - signoff( ic ); + imc_error( ic, "Authentication failure" ); + imc_logout( ic ); return XT_ABORT; } |