diff options
Diffstat (limited to 'tests/check_jabber_util.c')
| -rw-r--r-- | tests/check_jabber_util.c | 30 | 
1 files changed, 26 insertions, 4 deletions
| diff --git a/tests/check_jabber_util.c b/tests/check_jabber_util.c index 4728c5ee..bf6d3e60 100644 --- a/tests/check_jabber_util.c +++ b/tests/check_jabber_util.c @@ -13,12 +13,12 @@ static void check_buddy_add(int l)  	struct jabber_buddy *budw1, *budw2, *budw3, *budn, *bud;  	budw1 = jabber_buddy_add( ic, "wilmer@gaast.net/BitlBee" ); -	budw1->last_act = time( NULL ) - 100; +	budw1->last_msg = time( NULL ) - 100;  	budw2 = jabber_buddy_add( ic, "WILMER@gaast.net/Telepathy" );  	budw2->priority = 2; -	budw2->last_act = time( NULL ); +	budw2->last_msg = time( NULL );  	budw3 = jabber_buddy_add( ic, "wilmer@GAAST.NET/bitlbee" ); -	budw3->last_act = time( NULL ) - 200; +	budw3->last_msg = time( NULL ) - 200;  	budw3->priority = 4;  	/* TODO(wilmer): Shouldn't this just return budw3? */  	fail_if( jabber_buddy_add( ic, "wilmer@gaast.net/Telepathy" ) != NULL ); @@ -59,18 +59,39 @@ static void check_buddy_add(int l)  	fail_if( jabber_buddy_by_jid( ic, "wilmer@GAAST.NET/telepathy", GET_BUDDY_CREAT ) == budw2 );  	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/Telepathy" ) );  	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/telepathy" ) ); -	fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); +	 +	/* Test activity_timeout and GET_BUDDY_BARE_OK. */ +	fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) == budw1 ); +	budw1->last_msg -= 50; +	fail_unless( ( bud = jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) ) != NULL ); +	fail_unless( strcmp( bud->full_jid, "wilmer@gaast.net" ) == 0 );  	fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) );  	fail_unless( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) == budw1 ); +	fail_if( jabber_buddy_remove( ic, "wilmer@gaast.net" ) ); +	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/bitlbee" ) ); +	fail_unless( jabber_buddy_remove( ic, "wilmer@gaast.net/BitlBee" ) ); +	fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", GET_BUDDY_BARE_OK ) ); +	  	/* Check if remove_bare() indeed gets rid of all. */ +	/* disable this one for now.  	fail_unless( jabber_buddy_remove_bare( ic, "wilmer@gaast.net" ) );  	fail_if( jabber_buddy_by_jid( ic, "wilmer@gaast.net", 0 ) ); +	*/  	fail_if( jabber_buddy_remove( ic, "nekkid@lamejab.net/Illegal" ) );  	fail_unless( jabber_buddy_remove( ic, "nekkid@lamejab.net" ) );  	fail_if( jabber_buddy_by_jid( ic, "nekkid@lamejab.net", 0 ) ); +	 +	/* Fixing a bug in this branch that caused information to get lost when +	   removing the first full JID from a list. */ +	jabber_buddy_add( ic, "bugtest@google.com/A" ); +	jabber_buddy_add( ic, "bugtest@google.com/B" ); +	jabber_buddy_add( ic, "bugtest@google.com/C" ); +	fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/A" ) ); +	fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/B" ) ); +	fail_unless( jabber_buddy_remove( ic, "bugtest@google.com/C" ) );  }  Suite *jabber_util_suite (void) @@ -84,6 +105,7 @@ Suite *jabber_util_suite (void)  	ic->proto_data = jd = g_new0( struct jabber_data, 1 );  	jd->buddies = g_hash_table_new( g_str_hash, g_str_equal );  	set_add( &ic->acc->set, "resource_select", "priority", NULL, ic->acc ); +	set_add( &ic->acc->set, "activity_timeout", "120", NULL, ic->acc );  	suite_add_tcase (s, tc_core);  	tcase_add_test (tc_core, check_buddy_add); | 
