Ignore:
Timestamp:
2010-03-18T14:38:06Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
5605be9
Parents:
6ce01be (diff), 842cd8d (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 in Jabber resource selection fix. This adds the activity_timeout
setting, which makes BitlBee send a message to bare JIDs if there was no
recent seen activity from any of the person's resources. This should fix
most issues with messages going to the wrong resource (i.e. someone's
mobile phone instead of something more sensible).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/check_jabber_util.c

    r6ce01be r638feab  
    1414       
    1515        budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" );
    16         budw1->last_act = time( NULL ) - 100;
     16        budw1->last_msg = time( NULL ) - 100;
    1717        budw2 = jabber_buddy_add( ic, "WILMER@gaast.net/Telepathy" );
    1818        budw2->priority = 2;
    19         budw2->last_act = time( NULL );
     19        budw2->last_msg = time( NULL );
    2020        budw3 = jabber_buddy_add( ic, "wilmer@GAAST.NET/bitlbee" );
    21         budw3->last_act = time( NULL ) - 200;
     21        budw3->last_msg = time( NULL ) - 200;
    2222        budw3->priority = 4;
    2323        /* TODO(wilmer): Shouldn't this just return budw3? */
     
    6060        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/Telepathy" ) );
    6161        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) );
    62         fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 );
     62       
     63        /* Test activity_timeout and GET_BUDDY_BARE_OK. */
     64        fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) == budw1 );
     65        budw1->last_msg -= 50;
     66        fail_unless( ( bud = jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) ) != NULL );
     67        fail_unless( strcmp( bud->full_jid, "wilmer@gaast.net" ) == 0 );
    6368       
    6469        fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );
    6570        fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 );
    6671       
     72        fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );
     73        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/bitlbee" ) );
     74        fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/BitlBee" ) );
     75        fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) );
     76       
    6777        /* Check if remove_bare() indeed gets rid of all. */
     78        /* disable this one for now.
    6879        fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) );
    6980        fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) );
     81        */
    7082
    7183        fail_if( jabber_buddy_remove( ic, "nekkid@lamejab.net/Illegal" ) );
    7284        fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) );
    7385        fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) );
     86       
     87        /* Fixing a bug in this branch that caused information to get lost when
     88           removing the first full JID from a list. */
     89        jabber_buddy_add( ic, "bugtest@google.com/A" );
     90        jabber_buddy_add( ic, "bugtest@google.com/B" );
     91        jabber_buddy_add( ic, "bugtest@google.com/C" );
     92        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/A" ) );
     93        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/B" ) );
     94        fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/C" ) );
    7495}
    7596
     
    85106        jd->buddies = g_hash_table_new( g_str_hash, g_str_equal );
    86107        set_add( &ic->acc->set, "resource_select", "priority", NULL, ic->acc );
     108        set_add( &ic->acc->set, "activity_timeout", "120", NULL, ic->acc );
    87109       
    88110        suite_add_tcase (s, tc_core);
Note: See TracChangeset for help on using the changeset viewer.