Changeset aef4828 for protocols/msn


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/msn
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    r0da65d5 raef4828  
    3939static void msn_login( account_t *acc )
    4040{
    41         struct im_connection *ic = new_gaim_conn( acc );
     41        struct im_connection *ic = imc_new( acc );
    4242        struct msn_data *md = g_new0( struct msn_data, 1 );
    4343       
     
    4747        if( strchr( acc->user, '@' ) == NULL )
    4848        {
    49                 hide_login_progress( ic, "Invalid account name" );
    50                 signoff( ic );
     49                imc_error( ic, "Invalid account name" );
     50                imc_logout( ic );
    5151                return;
    5252        }
    5353       
    54         set_login_progress( ic, 1, "Connecting" );
     54        imc_log( ic, "Connecting" );
    5555       
    5656        md->fd = proxy_connect( "messenger.hotmail.com", 1863, msn_ns_connected, ic );
    5757        if( md->fd < 0 )
    5858        {
    59                 hide_login_progress( ic, "Could not connect to server" );
    60                 signoff( ic );
     59                imc_error( ic, "Could not connect to server" );
     60                imc_logout( ic );
    6161                return;
    6262        }
     
    9696                                m = l->data;
    9797                       
    98                                 serv_got_crap( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
     98                                imc_log( ic, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
    9999                                g_free( m->who );
    100100                                g_free( m->text );
     
    228228{
    229229        /* Just make an URL and let the user fetch the info */
    230         serv_got_crap( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
     230        imc_log( ic, "%s\n%s: %s%s", _("User Info"), _("For now, fetch yourself"), PROFILE_URL, who );
    231231}
    232232
     
    373373        if( strlen( value ) > 129 )
    374374        {
    375                 serv_got_crap( ic, "Maximum name length exceeded" );
     375                imc_log( ic, "Maximum name length exceeded" );
    376376                return NULL;
    377377        }
  • protocols/msn/msn_util.c

    r0da65d5 raef4828  
    3636        if( st != len )
    3737        {
    38                 hide_login_progress_error( ic, "Short write() to main server" );
    39                 signoff( ic );
     38                imc_error( ic, "Short write() to main server" );
     39                imc_logout( ic );
    4040                return( 0 );
    4141        }
     
    4646int msn_logged_in( struct im_connection *ic )
    4747{
    48         account_online( ic );
     48        imc_connected( ic );
    4949       
    5050        return( 0 );
  • protocols/msn/ns.c

    r0da65d5 raef4828  
    4747        if( source == -1 )
    4848        {
    49                 hide_login_progress( ic, "Could not connect to server" );
    50                 signoff( ic );
     49                imc_error( ic, "Could not connect to server" );
     50                imc_logout( ic );
    5151                return FALSE;
    5252        }
     
    7676        {
    7777                ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );
    78                 set_login_progress( ic, 1, "Connected to server, waiting for reply" );
     78                imc_log( ic, "Connected to server, waiting for reply" );
    7979        }
    8080       
     
    8989        if( msn_handler( md->handler ) == -1 ) /* Don't do this on ret == 0, it's already done then. */
    9090        {
    91                 hide_login_progress( ic, "Error while reading from server" );
    92                 signoff( ic );
     91                imc_error( ic, "Error while reading from server" );
     92                imc_logout( ic );
    9393               
    9494                return FALSE;
     
    114114                if( cmd[2] && strncmp( cmd[2], "MSNP8", 5 ) != 0 )
    115115                {
    116                         hide_login_progress( ic, "Unsupported protocol" );
    117                         signoff( ic );
     116                        imc_error( ic, "Unsupported protocol" );
     117                        imc_logout( ic );
    118118                        return( 0 );
    119119                }
     
    143143                        if( !server )
    144144                        {
    145                                 hide_login_progress_error( ic, "Syntax error" );
    146                                 signoff( ic );
     145                                imc_error( ic, "Syntax error" );
     146                                imc_logout( ic );
    147147                                return( 0 );
    148148                        }
     
    151151                        server = cmd[3];
    152152                       
    153                         set_login_progress( ic, 1, "Transferring to other server" );
     153                        imc_log( ic, "Transferring to other server" );
    154154                       
    155155                        md->fd = proxy_connect( server, port, msn_ns_connected, ic );
     
    162162                        if( !server )
    163163                        {
    164                                 hide_login_progress_error( ic, "Syntax error" );
    165                                 signoff( ic );
     164                                imc_error( ic, "Syntax error" );
     165                                imc_logout( ic );
    166166                                return( 0 );
    167167                        }
     
    172172                        if( strcmp( cmd[4], "CKI" ) != 0 )
    173173                        {
    174                                 hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
    175                                 signoff( ic );
     174                                imc_error( ic, "Unknown authentication method for switchboard" );
     175                                imc_logout( ic );
    176176                                return( 0 );
    177177                        }
     
    204204                else
    205205                {
    206                         hide_login_progress_error( ic, "Syntax error" );
    207                         signoff( ic );
     206                        imc_error( ic, "Syntax error" );
     207                        imc_logout( ic );
    208208                        return( 0 );
    209209                }
     
    216216                        if( !passport_get_id( msn_auth_got_passport_id, ic, ic->username, ic->password, cmd[4] ) )
    217217                        {
    218                                 hide_login_progress_error( ic, "Error while contacting Passport server" );
    219                                 signoff( ic );
     218                                imc_error( ic, "Error while contacting Passport server" );
     219                                imc_logout( ic );
    220220                                return( 0 );
    221221                        }
     
    236236                        }
    237237                       
    238                         set_login_progress( ic, 1, "Authenticated, getting buddy list" );
     238                        imc_log( ic, "Authenticated, getting buddy list" );
    239239                       
    240240                        g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );
     
    243243                else
    244244                {
    245                         hide_login_progress( ic, "Unknown authentication type" );
    246                         signoff( ic );
     245                        imc_error( ic, "Unknown authentication type" );
     246                        imc_logout( ic );
    247247                        return( 0 );
    248248                }
     
    252252                if( num_parts != 4 )
    253253                {
    254                         hide_login_progress_error( ic, "Syntax error" );
    255                         signoff( ic );
     254                        imc_error( ic, "Syntax error" );
     255                        imc_logout( ic );
    256256                        return( 0 );
    257257                }
     
    261261                if( md->handler->msglen <= 0 )
    262262                {
    263                         hide_login_progress_error( ic, "Syntax error" );
    264                         signoff( ic );
     263                        imc_error( ic, "Syntax error" );
     264                        imc_logout( ic );
    265265                        return( 0 );
    266266                }
     
    292292                if( num_parts != 4 && num_parts != 5 )
    293293                {
    294                         hide_login_progress( ic, "Syntax error" );
    295                         signoff( ic );
     294                        imc_error( ic, "Syntax error" );
     295                        imc_logout( ic );
    296296                        return( 0 );
    297297                }
     
    328328                        if( ic->flags & OPT_LOGGED_IN )
    329329                        {
    330                                 serv_got_crap( ic, "Successfully transferred to different server" );
     330                                imc_log( ic, "Successfully transferred to different server" );
    331331                                g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 );
    332332                                return( msn_write( ic, buf, strlen( buf ) ) );
     
    344344                if( num_parts != 4 )
    345345                {
    346                         hide_login_progress_error( ic, "Syntax error" );
    347                         signoff( ic );
     346                        imc_error( ic, "Syntax error" );
     347                        imc_logout( ic );
    348348                        return( 0 );
    349349                }
     
    363363                if( num_parts != 3 )
    364364                {
    365                         hide_login_progress_error( ic, "Syntax error" );
    366                         signoff( ic );
     365                        imc_error( ic, "Syntax error" );
     366                        imc_logout( ic );
    367367                        return( 0 );
    368368                }
     
    385385                if( num_parts != 6 )
    386386                {
    387                         hide_login_progress_error( ic, "Syntax error" );
    388                         signoff( ic );
     387                        imc_error( ic, "Syntax error" );
     388                        imc_logout( ic );
    389389                        return( 0 );
    390390                }
     
    413413                if( num_parts != 5 )
    414414                {
    415                         hide_login_progress_error( ic, "Syntax error" );
    416                         signoff( ic );
     415                        imc_error( ic, "Syntax error" );
     416                        imc_logout( ic );
    417417                        return( 0 );
    418418                }
     
    438438                if( num_parts != 7 )
    439439                {
    440                         hide_login_progress_error( ic, "Syntax error" );
    441                         signoff( ic );
     440                        imc_error( ic, "Syntax error" );
     441                        imc_logout( ic );
    442442                        return( 0 );
    443443                }
     
    448448                if( !server )
    449449                {
    450                         hide_login_progress_error( ic, "Syntax error" );
    451                         signoff( ic );
     450                        imc_error( ic, "Syntax error" );
     451                        imc_logout( ic );
    452452                        return( 0 );
    453453                }
     
    458458                if( strcmp( cmd[3], "CKI" ) != 0 )
    459459                {
    460                         hide_login_progress_error( ic, "Unknown authentication method for switchboard" );
    461                         signoff( ic );
     460                        imc_error( ic, "Unknown authentication method for switchboard" );
     461                        imc_logout( ic );
    462462                        return( 0 );
    463463                }
     
    478478                        if( strchr( cmd[4], '@' ) == NULL )
    479479                        {
    480                                 hide_login_progress_error( ic, "Syntax error" );
    481                                 signoff( ic );
     480                                imc_error( ic, "Syntax error" );
     481                                imc_logout( ic );
    482482                                return( 0 );
    483483                        }
     
    499499                if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 )
    500500                {
    501                         hide_login_progress_error( ic, "Someone else logged in with your account" );
     501                        imc_error( ic, "Someone else logged in with your account" );
    502502                        ic->wants_to_die = 1;
    503503                }
    504504                else if( cmd[1] && strcmp( cmd[1], "SSD" ) == 0 )
    505505                {
    506                         hide_login_progress_error( ic, "Terminating session because of server shutdown" );
     506                        imc_error( ic, "Terminating session because of server shutdown" );
    507507                }
    508508                else
    509509                {
    510                         hide_login_progress_error( ic, "Session terminated by remote server (reason unknown)" );
    511                 }
    512                
    513                 signoff( ic );
     510                        imc_error( ic, "Session terminated by remote server (reason unknown)" );
     511                }
     512               
     513                imc_logout( ic );
    514514                return( 0 );
    515515        }
     
    518518                if( num_parts != 5 )
    519519                {
    520                         hide_login_progress_error( ic, "Syntax error" );
    521                         signoff( ic );
     520                        imc_error( ic, "Syntax error" );
     521                        imc_logout( ic );
    522522                        return( 0 );
    523523                }
     
    546546        else if( strcmp( cmd[0], "IPG" ) == 0 )
    547547        {
    548                 do_error_dialog( ic, "Received IPG command, we don't handle them yet.", "MSN" );
     548                imc_error( ic, "Received IPG command, we don't handle them yet." );
    549549               
    550550                md->handler->msglen = atoi( cmd[1] );
     
    552552                if( md->handler->msglen <= 0 )
    553553                {
    554                         hide_login_progress_error( ic, "Syntax error" );
    555                         signoff( ic );
     554                        imc_error( ic, "Syntax error" );
     555                        imc_logout( ic );
    556556                        return( 0 );
    557557                }
     
    562562                const struct msn_status_code *err = msn_status_by_number( num );
    563563               
    564                 g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text );
    565                 do_error_dialog( ic, buf, "MSN" );
     564                imc_error( ic, "Error reported by MSN server: %s", err->text );
    566565               
    567566                if( err->flags & STATUS_FATAL )
    568567                {
    569                         signoff( ic );
     568                        imc_logout( ic );
    570569                        return( 0 );
    571570                }
     
    617616                                {
    618617                                        if( arg1 )
    619                                                 serv_got_crap( ic, "The server is going down for maintenance in %s minutes.", arg1 );
     618                                                imc_log( ic, "The server is going down for maintenance in %s minutes.", arg1 );
    620619                                }
    621620                               
     
    634633                                if( inbox && folders )
    635634                                {
    636                                         serv_got_crap( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
     635                                        imc_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
    637636                                }
    638637                        }
     
    644643                                if( from && fromname )
    645644                                {
    646                                         serv_got_crap( ic, "Received an e-mail message from %s <%s>.", fromname, from );
     645                                        imc_log( ic, "Received an e-mail message from %s <%s>.", fromname, from );
    647646                                }
    648647                        }
     
    677676                                       rep->error_string ? rep->error_string : "Unknown error" );
    678677               
    679                 hide_login_progress( ic, err );
    680                 signoff( ic );
     678                imc_error( ic, err );
     679                imc_logout( ic );
    681680               
    682681                g_free( err );
  • protocols/msn/sb.c

    r0da65d5 raef4828  
    222222                g_slist_free( sb->msgq );
    223223               
    224                 serv_got_crap( ic, "Warning: Closing down MSN switchboard connection with "
     224                imc_log( ic, "Warning: Closing down MSN switchboard connection with "
    225225                                   "unsent message to %s, you'll have to resend it.",
    226226                                   sb->who ? sb->who : "(unknown)" );
     
    321321        if( strcmp( cmd[0], "XFR" ) == 0 )
    322322        {
    323                 hide_login_progress_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
    324                 signoff( ic );
     323                imc_error( ic, "Received an XFR from a switchboard server, unable to comply! This is likely to be a bug, please report it!" );
     324                imc_logout( ic );
    325325                return( 0 );
    326326        }
     
    528528                const struct msn_status_code *err = msn_status_by_number( num );
    529529               
    530                 g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text );
    531                 do_error_dialog( ic, buf, "MSN" );
     530                imc_error( ic, "Error reported by switchboard server: %s", err->text );
    532531               
    533532                if( err->flags & STATUS_SB_FATAL )
     
    538537                else if( err->flags & STATUS_FATAL )
    539538                {
    540                         signoff( ic );
     539                        imc_logout( ic );
    541540                        return 0;
    542541                }
Note: See TracChangeset for help on using the changeset viewer.