# HG changeset patch # User Mark Doliner # Date 1313912964 0 # Node ID c80ac2d937b737104d89c1771027e9989c390bcd # Parent c3ea1711c37281e0c04b94d04b47e1f43833c338 Change last remaining users of purple_connection_error to use purple_connection_error_reason. The "reason" I used in this code is probably not the most appropriate reason. My goal was to retain the same behavior before and after this change. It's not a bad idea for someone to look at each of these calls and determine if a different reason should be used... but it hasn't seemed to cause problems so far, so maybe it doesn't matter. diff -r c3ea1711c372 -r c80ac2d937b7 libpurple/protocols/mxit/http.c --- a/libpurple/protocols/mxit/http.c Sun Aug 21 07:37:07 2011 +0000 +++ b/libpurple/protocols/mxit/http.c Sun Aug 21 07:49:24 2011 +0000 @@ -273,7 +273,7 @@ /* source is the file descriptor of the new connection */ if ( source < 0 ) { purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect failed: %s\n", error_message ); - purple_connection_error( req->session->con, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); + purple_connection_error_reason( req->session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); return; } diff -r c3ea1711c372 -r c80ac2d937b7 libpurple/protocols/mxit/login.c --- a/libpurple/protocols/mxit/login.c Sun Aug 21 07:37:07 2011 +0000 +++ b/libpurple/protocols/mxit/login.c Sun Aug 21 07:49:24 2011 +0000 @@ -165,7 +165,7 @@ /* source is the file descriptor of the new connection */ if ( source < 0 ) { purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect failed: %s\n", error_message ); - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); return; } @@ -202,7 +202,7 @@ /* socket connection */ data = purple_proxy_connect( session->con, session->acc, session->server, session->port, mxit_cb_connect, session ); if ( !data ) { - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Unable to connect to the MXit server. Please check your server settings." ) ); return; } } @@ -391,7 +391,7 @@ if ( !url_text ) { /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); return; } @@ -400,7 +400,7 @@ if ( !parts ) { /* wapserver error */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); return; } @@ -410,26 +410,26 @@ /* valid reply! */ break; case '1' : - purple_connection_error( session->con, _( "Wrong security code entered. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Wrong security code entered. Please try again later." ) ); return; case '2' : - purple_connection_error( session->con, _( "Your session has expired. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Your session has expired. Please try again later." ) ); return; case '5' : - purple_connection_error( session->con, _( "Invalid country selected. Please try again." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid country selected. Please try again." ) ); return; case '6' : - purple_connection_error( session->con, _( "The MXit ID you entered is not registered. Please register first." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is not registered. Please register first." ) ); return; case '7' : - purple_connection_error( session->con, _( "The MXit ID you entered is already registered. Please choose another." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "The MXit ID you entered is already registered. Please choose another." ) ); /* this user's account already exists, so we need to change the registration login flag to be login */ purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); return; case '3' : case '4' : default : - purple_connection_error( session->con, _( "Internal error. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Internal error. Please try again later." ) ); return; } @@ -611,7 +611,7 @@ if ( !url_text ) { /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Error contacting the MXit WAP site. Please try again later." ) ); return; } @@ -620,7 +620,7 @@ if ( ( !parts ) || ( parts[0][0] != '0' ) ) { /* server could not find the user */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "MXit is currently unable to process the request. Please try again later." ) ); return; } diff -r c3ea1711c372 -r c80ac2d937b7 libpurple/protocols/mxit/protocol.c --- a/libpurple/protocols/mxit/protocol.c Sun Aug 21 07:37:07 2011 +0000 +++ b/libpurple/protocols/mxit/protocol.c Sun Aug 21 07:49:24 2011 +0000 @@ -408,7 +408,7 @@ res = mxit_write_sock_packet( session->fd, data, datalen ); if ( res < 0 ) { /* we must have lost the connection, so terminate it so that we can reconnect */ - purple_connection_error( session->con, _( "We have lost the connection to MXit. Please reconnect." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "We have lost the connection to MXit. Please reconnect." ) ); } } else { @@ -530,7 +530,7 @@ if ( session->last_tx <= mxit_now_milli() - ( MXIT_ACK_TIMEOUT * 1000 ) ) { /* ack timeout! so we close the connection here */ purple_debug_info( MXIT_PLUGIN_ID, "mxit_manage_queue: Timeout awaiting ACK for command '%i'\n", session->outack ); - purple_connection_error( session->con, _( "Timeout while waiting for a response from the MXit server." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Timeout while waiting for a response from the MXit server." ) ); } return; } @@ -2192,7 +2192,7 @@ session->port = atoi( host[2] ); } else { - purple_connection_error( session->con, _( "Cannot perform redirect using the specified protocol" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Cannot perform redirect using the specified protocol" ) ); goto redirect_fail; } @@ -2361,7 +2361,7 @@ if ( packet->errcode == MXIT_ERRCODE_LOGGEDOUT ) { /* we are not currently logged in, so we need to reconnect */ - purple_connection_error( session->con, _( errdesc ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( errdesc ) ); } /* packet command */ @@ -2375,7 +2375,7 @@ } else { snprintf( errmsg, sizeof( errmsg ), _( "Login error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error( session->con, errmsg ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, errmsg ); return -1; } case CP_CMD_LOGOUT : @@ -2643,7 +2643,7 @@ if ( packet.rcount < 2 ) { /* bad packet */ - purple_connection_error( session->con, _( "Invalid packet received from MXit." ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "Invalid packet received from MXit." ) ); free_rx_packet( &packet ); continue; } @@ -2708,12 +2708,12 @@ len = read( session->fd, &ch, 1 ); if ( len < 0 ) { /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); return; } else if ( len == 0 ) { /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); return; } else { @@ -2723,7 +2723,7 @@ session->rx_lbuf[session->rx_i] = '\0'; session->rx_res = atoi( &session->rx_lbuf[3] ); if ( session->rx_res > CP_MAX_PACKET ) { - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); } session->rx_state = RX_STATE_DATA; session->rx_i = 0; @@ -2734,7 +2734,7 @@ session->rx_i++; if ( session->rx_i >= sizeof( session->rx_lbuf ) ) { /* malformed packet length record (too long) */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); return; } } @@ -2745,12 +2745,12 @@ len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); if ( len < 0 ) { /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); return; } else if ( len == 0 ) { /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); + purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); return; } else { diff -r c3ea1711c372 -r c80ac2d937b7 libpurple/protocols/zephyr/zephyr.c --- a/libpurple/protocols/zephyr/zephyr.c Sun Aug 21 07:37:07 2011 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Sun Aug 21 07:49:24 2011 +0000 @@ -146,7 +146,7 @@ return TRUE; #define z_call_s(func, err) if (func != ZERR_NONE) {\ - purple_connection_error(gc, err);\ + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, err);\ return;\ } @@ -1585,7 +1585,7 @@ /* XXX z_call_s should actually try to report the com_err determined error */ if (use_tzc(zephyr)) { pid_t pid; - /* purple_connection_error(gc,"tzc not supported yet"); */ + /* purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "tzc not supported yet"); */ if ((pipe(zephyr->totzc) != 0) || (pipe(zephyr->fromtzc) != 0)) { purple_debug_error("zephyr", "pipe creation failed. killing\n"); exit(-1); @@ -1706,7 +1706,7 @@ ptr++; } if (ptr >=bufcur) { - purple_connection_error(gc,"invalid output by tzc (or bad parsing code)"); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "invalid output by tzc (or bad parsing code)"); free(buf); return; } @@ -1821,7 +1821,7 @@ purple_debug_info("zephyr","realm: %s\n",zephyr->realm); } else { - purple_connection_error(gc,"Only ZEPH0.2 supported currently"); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Only ZEPH0.2 supported currently"); return; } purple_debug_info("zephyr","does it get here\n");