From dde9d5710cd6392592c1417032933f0ba4299d9c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 12 Mar 2010 19:35:51 +0000 Subject: Fixed jabber_util unittest. It passes, yet something still seems to be broken. :-( --- tests/check_jabber_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/check_jabber_util.c') diff --git a/tests/check_jabber_util.c b/tests/check_jabber_util.c index 4728c5ee..d105f52a 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 ); -- cgit v1.2.3 From 00a0bc5cbed11bab2446267a9f3ad76666ceee75 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 12 Mar 2010 20:28:39 +0000 Subject: Test activity_timeout and some other test tweaks. --- tests/check_jabber_util.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests/check_jabber_util.c') diff --git a/tests/check_jabber_util.c b/tests/check_jabber_util.c index d105f52a..47e1e1a0 100644 --- a/tests/check_jabber_util.c +++ b/tests/check_jabber_util.c @@ -59,14 +59,26 @@ 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" ) ); @@ -84,6 +96,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); -- cgit v1.2.3 From 842cd8dbfb98b61af33b5fe481364c3cfbeaca04 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 18 Mar 2010 11:22:17 +0000 Subject: Fixed a bug that caused full JIDs to get lost sometimes with the new way of storing full JIDs belongong to a contact. --- tests/check_jabber_util.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/check_jabber_util.c') diff --git a/tests/check_jabber_util.c b/tests/check_jabber_util.c index 47e1e1a0..bf6d3e60 100644 --- a/tests/check_jabber_util.c +++ b/tests/check_jabber_util.c @@ -83,6 +83,15 @@ static void check_buddy_add(int l) 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) -- cgit v1.2.3