Changeset aef4828 for protocols/jabber


Ignore:
Timestamp:
2007-04-06T05:20:31Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
552e641
Parents:
0da65d5
Message:

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...

Location:
protocols/jabber
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/io.c

    r0da65d5 raef4828  
    117117                jd->fd = -1;
    118118               
    119                 hide_login_progress_error( ic, "Short write() to server" );
    120                 signoff( ic );
     119                imc_error( ic, "Short write() to server" );
     120                imc_logout( ic );
    121121                return FALSE;
    122122        }
     
    160160                if( xt_feed( jd->xt, buf, st ) < 0 )
    161161                {
    162                         hide_login_progress_error( ic, "XML stream error" );
    163                         signoff( ic );
     162                        imc_error( ic, "XML stream error" );
     163                        imc_logout( ic );
    164164                        return FALSE;
    165165                }
     
    203203                                        if( set_getbool( &ic->acc->set, "tls" ) )
    204204                                        {
    205                                                 hide_login_progress( ic, "TLS is turned on for this "
     205                                                imc_error( ic, "TLS is turned on for this "
    206206                                                          "account, but is not supported by this server" );
    207                                                 signoff( ic );
     207                                                imc_logout( ic );
    208208                                                return FALSE;
    209209                                        }
     
    216216                        else
    217217                        {
    218                                 hide_login_progress( ic, "XML stream error" );
    219                                 signoff( ic );
     218                                imc_error( ic, "XML stream error" );
     219                                imc_logout( ic );
    220220                                return FALSE;
    221221                        }
     
    227227                jd->fd = -1;
    228228               
    229                 hide_login_progress_error( ic, "Error while reading from server" );
    230                 signoff( ic );
     229                imc_error( ic, "Error while reading from server" );
     230                imc_logout( ic );
    231231                return FALSE;
    232232        }
     
    242242        if( source == -1 )
    243243        {
    244                 hide_login_progress( ic, "Could not connect to server" );
    245                 signoff( ic );
     244                imc_error( ic, "Could not connect to server" );
     245                imc_logout( ic );
    246246                return FALSE;
    247247        }
    248248       
    249         set_login_progress( ic, 1, "Connected to server, logging in" );
     249        imc_log( ic, "Connected to server, logging in" );
    250250       
    251251        return jabber_start_stream( ic );
     
    263263                jd->ssl = NULL;
    264264               
    265                 hide_login_progress( ic, "Could not connect to server" );
    266                 signoff( ic );
     265                imc_error( ic, "Could not connect to server" );
     266                imc_logout( ic );
    267267                return FALSE;
    268268        }
    269269       
    270         set_login_progress( ic, 1, "Connected to server, logging in" );
     270        imc_log( ic, "Connected to server, logging in" );
    271271       
    272272        return jabber_start_stream( ic );
     
    275275static xt_status jabber_end_of_stream( struct xt_node *node, gpointer data )
    276276{
    277         signoff( data );
     277        imc_logout( data );
    278278        return XT_ABORT;
    279279}
     
    297297                if( c && ( !trytls && !set_getbool( &ic->acc->set, "tls" ) ) )
    298298                {
    299                         hide_login_progress( ic, "Server requires TLS connections, but TLS is turned off for this account" );
    300                         signoff( ic );
     299                        imc_error( ic, "Server requires TLS connections, but TLS is turned off for this account" );
     300                        imc_logout( ic );
    301301                       
    302302                        return XT_ABORT;
     
    327327                if( !trytls && set_getbool( &ic->acc->set, "tls" ) )
    328328                {
    329                         hide_login_progress( ic, "TLS is turned on for this account, but is not supported by this server" );
    330                         signoff( ic );
     329                        imc_error( ic, "TLS is turned on for this account, but is not supported by this server" );
     330                        imc_logout( ic );
    331331                       
    332332                        return XT_ABORT;
     
    417417        jd->w_inpa = jd->r_inpa = 0;
    418418       
    419         set_login_progress( ic, 1, "Converting stream to TLS" );
     419        imc_log( ic, "Converting stream to TLS" );
    420420       
    421421        jd->ssl = ssl_starttls( jd->fd, jabber_connected_ssl, ic );
     
    452452        if( type == NULL )
    453453        {
    454                 hide_login_progress_error( ic, "Unknown stream error reported by server" );
    455                 signoff( ic );
     454                imc_error( ic, "Unknown stream error reported by server" );
     455                imc_logout( ic );
    456456                return XT_ABORT;
    457457        }
     
    462462        if( strcmp( type, "conflict" ) == 0 )
    463463        {
    464                 hide_login_progress( ic, "Account and resource used from a different location" );
     464                imc_error( ic, "Account and resource used from a different location" );
    465465                ic->wants_to_die = TRUE;
    466466        }
     
    468468        {
    469469                s = g_strdup_printf( "Stream error: %s%s%s", type, text ? ": " : "", text ? text : "" );
    470                 hide_login_progress_error( ic, s );
     470                imc_error( ic, s );
    471471                g_free( s );
    472472        }
    473473       
    474         signoff( ic );
     474        imc_logout( ic );
    475475       
    476476        return XT_ABORT;
  • protocols/jabber/iq.c

    r0da65d5 raef4828  
    3939        if( !type )
    4040        {
    41                 hide_login_progress_error( ic, "Received IQ packet without type." );
    42                 signoff( ic );
     41                imc_error( ic, "Received IQ packet without type." );
     42                imc_logout( ic );
    4343                return XT_ABORT;
    4444        }
     
    6060               
    6161                if( entry == NULL )
    62                         serv_got_crap( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
     62                        imc_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s );
    6363                else if( entry->func )
    6464                        return entry->func( ic, node, entry->node );
     
    6969                    !( s = xt_find_attr( c, "xmlns" ) ) )
    7070                {
    71                         serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
     71                        imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type );
    7272                        return XT_HANDLED;
    7373                }
     
    132132                    !( s = xt_find_attr( c, "xmlns" ) ) )
    133133                {
    134                         serv_got_crap( ic, "WARNING: Received incomplete IQ-%s packet", type );
     134                        imc_log( ic, "WARNING: Received incomplete IQ-%s packet", type );
    135135                        return XT_HANDLED;
    136136                }
     
    154154                        else
    155155                        {
    156                                 serv_got_crap( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
     156                                imc_log( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
    157157                               
    158158                                xt_free_node( reply );
     
    219219        if( !( query = xt_find_node( node->children, "query" ) ) )
    220220        {
    221                 serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
    222                 signoff( ic );
     221                imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" );
     222                imc_logout( ic );
    223223                return XT_HANDLED;
    224224        }
     
    258258                xt_free_node( reply );
    259259               
    260                 hide_login_progress( ic, "Can't find suitable authentication method" );
    261                 signoff( ic );
     260                imc_error( ic, "Can't find suitable authentication method" );
     261                imc_logout( ic );
    262262                return XT_ABORT;
    263263        }
     
    277277        if( !( type = xt_find_attr( node, "type" ) ) )
    278278        {
    279                 serv_got_crap( ic, "WARNING: Received incomplete IQ packet while authenticating" );
    280                 signoff( ic );
     279                imc_log( ic, "WARNING: Received incomplete IQ packet while authenticating" );
     280                imc_logout( ic );
    281281                return XT_HANDLED;
    282282        }
     
    284284        if( strcmp( type, "error" ) == 0 )
    285285        {
    286                 hide_login_progress( ic, "Authentication failure" );
    287                 signoff( ic );
     286                imc_error( ic, "Authentication failure" );
     287                imc_logout( ic );
    288288                return XT_ABORT;
    289289        }
     
    311311                if( c && c->text_len && ( s = strchr( c->text, '/' ) ) &&
    312312                    strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
    313                         serv_got_crap( ic, "Server changed session resource string to `%s'", s + 1 );
     313                        imc_log( ic, "Server changed session resource string to `%s'", s + 1 );
    314314               
    315315                jd->flags &= ~JFLAG_WAIT_BIND;
     
    334334        int st;
    335335       
    336         set_login_progress( ic, 1, "Authenticated, requesting buddy list" );
     336        imc_log( ic, "Authenticated, requesting buddy list" );
    337337       
    338338        node = xt_new_node( "query", NULL, NULL );
     
    353353        if( !( query = xt_find_node( node->children, "query" ) ) )
    354354        {
    355                 serv_got_crap( ic, "WARNING: Received NULL roster packet" );
     355                imc_log( ic, "WARNING: Received NULL roster packet" );
    356356                return XT_HANDLED;
    357357        }
     
    397397       
    398398        if( initial )
    399                 account_online( ic );
     399                imc_connected( ic );
    400400       
    401401        return XT_HANDLED;
     
    428428        {
    429429                s = xt_find_attr( orig, "to" ); /* If this returns NULL something's wrong.. */
    430                 serv_got_crap( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
     430                imc_log( ic, "Could not retrieve vCard of %s", s ? s : "(NULL)" );
    431431                return XT_HANDLED;
    432432        }
     
    536536        /* *sigh* */
    537537       
    538         serv_got_crap( ic, reply->str );
     538        imc_log( ic, reply->str );
    539539        g_string_free( reply, TRUE );
    540540       
  • protocols/jabber/jabber.c

    r0da65d5 raef4828  
    5959static void jabber_login( account_t *acc )
    6060{
    61         struct im_connection *ic = new_gaim_conn( acc );
     61        struct im_connection *ic = imc_new( acc );
    6262        struct jabber_data *jd = g_new0( struct jabber_data, 1 );
    6363        struct ns_srv_reply *srv = NULL;
     
    7272        if( jd->server == NULL )
    7373        {
    74                 hide_login_progress( ic, "Incomplete account name (format it like <username@jabberserver.name>)" );
    75                 signoff( ic );
     74                imc_error( ic, "Incomplete account name (format it like <username@jabberserver.name>)" );
     75                imc_logout( ic );
    7676                return;
    7777        }
     
    159159                connect_to = jd->server;
    160160       
    161         set_login_progress( ic, 0, "Connecting" );
     161        imc_log( ic, "Connecting" );
    162162       
    163163        if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN ||
    164164            set_getint( &acc->set, "port" ) > JABBER_PORT_MAX )
    165165        {
    166                 serv_got_crap( ic, "Incorrect port number, must be in the %d-%d range",
     166                imc_log( ic, "Incorrect port number, must be in the %d-%d range",
    167167                               JABBER_PORT_MIN, JABBER_PORT_MAX );
    168                 signoff( ic );
     168                imc_logout( ic );
    169169                return;
    170170        }
     
    186186        if( jd->fd == -1 )
    187187        {
    188                 hide_login_progress( ic, "Could not connect to server" );
    189                 signoff( ic );
     188                imc_error( ic, "Could not connect to server" );
     189                imc_logout( ic );
    190190        }
    191191}
     
    285285        while( bud )
    286286        {
    287                 serv_got_crap( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
     287                imc_log( ic, "Buddy %s (%d) information:\nAway state: %s\nAway message: %s",
    288288                                   bud->full_jid, bud->priority,
    289289                                   bud->away_state ? bud->away_state->full_name : "(none)",
  • protocols/jabber/presence.c

    r0da65d5 raef4828  
    4141                {
    4242                        if( set_getbool( &ic->irc->set, "debug" ) )
    43                                 serv_got_crap( ic, "WARNING: Could not handle presence information from JID: %s", from );
     43                                imc_log( ic, "WARNING: Could not handle presence information from JID: %s", from );
    4444                        return XT_HANDLED;
    4545                }
     
    7474                {
    7575                        if( set_getbool( &ic->irc->set, "debug" ) )
    76                                 serv_got_crap( ic, "WARNING: Received presence information from unknown JID: %s", from );
     76                                imc_log( ic, "WARNING: Received presence information from unknown JID: %s", from );
    7777                        return XT_HANDLED;
    7878                }
     
    103103        {
    104104                /* Not sure about this one, actually... */
    105                 serv_got_crap( ic, "%s just accepted your authorization request", from );
     105                imc_log( ic, "%s just accepted your authorization request", from );
    106106        }
    107107        else if( strcmp( type, "unsubscribe" ) == 0 || strcmp( type, "unsubscribed" ) == 0 )
  • protocols/jabber/sasl.c

    r0da65d5 raef4828  
    3838                   IQ authentication. Strange things happen when you try
    3939                   to do both... */
    40                 serv_got_crap( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
     40                imc_log( ic, "XMPP 1.0 non-compliant server seems to support SASL, please report this as a BitlBee bug!" );
    4141                return XT_HANDLED;
    4242        }
     
    4545        if( !s || strcmp( s, XMLNS_SASL ) != 0 )
    4646        {
    47                 signoff( ic );
     47                imc_logout( ic );
    4848                return XT_ABORT;
    4949        }
     
    6262        if( !sup_plain && !sup_digest )
    6363        {
    64                 hide_login_progress( ic, "No known SASL authentication schemes supported" );
    65                 signoff( ic );
     64                imc_error( ic, "No known SASL authentication schemes supported" );
     65                imc_logout( ic );
    6666                return XT_ABORT;
    6767        }
     
    279279
    280280error:
    281         hide_login_progress( ic, "Incorrect SASL challenge received" );
    282         signoff( ic );
     281        imc_error( ic, "Incorrect SASL challenge received" );
     282        imc_logout( ic );
    283283
    284284silent_error:
     
    303303        if( !s || strcmp( s, XMLNS_SASL ) != 0 )
    304304        {
    305                 signoff( ic );
     305                imc_logout( ic );
    306306                return XT_ABORT;
    307307        }
     
    309309        if( strcmp( node->name, "success" ) == 0 )
    310310        {
    311                 set_login_progress( ic, 1, "Authentication finished" );
     311                imc_log( ic, "Authentication finished" );
    312312                jd->flags |= JFLAG_AUTHENTICATED | JFLAG_STREAM_RESTART;
    313313        }
    314314        else if( strcmp( node->name, "failure" ) == 0 )
    315315        {
    316                 hide_login_progress( ic, "Authentication failure" );
    317                 signoff( ic );
     316                imc_error( ic, "Authentication failure" );
     317                imc_logout( ic );
    318318                return XT_ABORT;
    319319        }
Note: See TracChangeset for help on using the changeset viewer.