Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r0dd6570 raef2077  
    261261        struct im_connection *ic = d;
    262262       
     263        if( ( ic->flags & OPT_PONGS ) && !( ic->flags & OPT_PONGED ) )
     264        {
     265                /* This protocol is expected to ack keepalives and hasn't
     266                   since the last time we were here. */
     267                imcb_error( ic, "Connection timeout" );
     268                imc_logout( ic, TRUE );
     269                return FALSE;
     270        }
     271        ic->flags &= ~OPT_PONGED;
     272       
    263273        if( ic->acc->prpl->keepalive )
    264274                ic->acc->prpl->keepalive( ic );
    265275       
    266276        return TRUE;
     277}
     278
     279void start_keepalives( struct im_connection *ic, int interval )
     280{
     281        b_event_remove( ic->keepalive );
     282        ic->keepalive = b_timeout_add( interval, send_keepalive, ic );
     283       
     284        /* Connecting successfully counts as a first successful pong. */
     285        if( ic->flags & OPT_PONGS )
     286                ic->flags |= OPT_PONGED;
    267287}
    268288
     
    277297        imcb_log( ic, "Logged in" );
    278298       
    279         b_event_remove( ic->keepalive );
    280         ic->keepalive = b_timeout_add( 60000, send_keepalive, ic );
    281299        ic->flags |= OPT_LOGGED_IN;
     300        start_keepalives( ic, 60000 );
    282301       
    283302        /* Necessary to send initial presence status, even if we're not away. */
Note: See TracChangeset for help on using the changeset viewer.