Changeset ae3dc99 for protocols/msn/sb.c


Ignore:
Timestamp:
2010-04-24T17:02:07Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
c521362
Parents:
b5b40ff (diff), f1b7711 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging stuff from mainline (1.2.6).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/sb.c

    rb5b40ff rae3dc99  
    180180                        i = strlen( buf );
    181181                }
     182                else if( strcmp( text, SB_KEEPALIVE_MESSAGE ) == 0 )
     183                {
     184                        buf = g_strdup( SB_KEEPALIVE_HEADERS );
     185                        i = strlen( buf );
     186                }
    182187                else
    183188                {
     
    256261       
    257262        msn_msgq_purge( ic, &sb->msgq );
     263        msn_sb_stop_keepalives( sb );
    258264       
    259265        if( sb->key ) g_free( sb->key );
     
    477483               
    478484                sb->ready = 1;
     485               
     486                msn_sb_start_keepalives( sb, FALSE );
    479487        }
    480488        else if( strcmp( cmd[0], "CAL" ) == 0 )
     
    526534                        }
    527535                       
     536                        msn_sb_start_keepalives( sb, FALSE );
     537                       
    528538                        return( st );
    529539                }
     
    587597                if( sb->who )
    588598                {
     599                        msn_sb_stop_keepalives( sb );
     600                       
    589601                        /* This is a single-person chat, and the other person is leaving. */
    590602                        g_free( sb->who );
     
    749761        return( 1 );
    750762}
     763
     764static gboolean msn_sb_keepalive( gpointer data, gint source, b_input_condition cond )
     765{
     766        struct msn_switchboard *sb = data;
     767        return sb->ready && msn_sb_sendmessage( sb, SB_KEEPALIVE_MESSAGE );
     768}
     769
     770void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial )
     771{
     772        struct buddy *b;
     773       
     774        if( sb && sb->who && sb->keepalive == 0 &&
     775            ( b = imcb_find_buddy( sb->ic, sb->who ) ) && !b->present &&
     776            set_getbool( &sb->ic->acc->set, "switchboard_keepalives" ) )
     777        {
     778                if( initial )
     779                        msn_sb_keepalive( sb, 0, 0 );
     780               
     781                sb->keepalive = b_timeout_add( 20000, msn_sb_keepalive, sb );
     782        }
     783}
     784
     785void msn_sb_stop_keepalives( struct msn_switchboard *sb )
     786{
     787        if( sb && sb->keepalive > 0 )
     788        {
     789                b_event_remove( sb->keepalive );
     790                sb->keepalive = 0;
     791        }
     792}
Note: See TracChangeset for help on using the changeset viewer.