From 06ce95f68afe7b4454e50eb23e9891d6e5f30742 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Jan 2014 22:55:04 +0000 Subject: Refactored roster_change_name --- src/roster_list.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/roster_list.h') diff --git a/src/roster_list.h b/src/roster_list.h index 9382081b..85a4cffc 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -37,7 +37,7 @@ gboolean roster_contact_offline(const char * const barejid, void roster_reset_search_attempts(void); void roster_init(void); void roster_free(void); -void roster_change_name(const char * const barejid, const char * const new_name); +void roster_change_name(PContact contact, const char * const new_name); void roster_remove(const char * const name, const char * const barejid); void roster_update(const char * const barejid, const char * const name, GSList *groups, const char * const subscription, gboolean pending_out); -- cgit 1.4.1-2-gfad0 From 1d716e48adf7dc6a2639131450c1ca74d48ea105 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Jan 2014 23:08:11 +0000 Subject: Removed roster_list dependency on xmpp module --- src/command/commands.c | 6 ++++-- src/roster_list.c | 42 ++++++++++++++++-------------------------- src/roster_list.h | 4 ++-- 3 files changed, 22 insertions(+), 30 deletions(-) (limited to 'src/roster_list.h') diff --git a/src/command/commands.c b/src/command/commands.c index a301efd4..57a6b151 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1009,7 +1009,8 @@ cmd_group(gchar **args, struct cmd_help_t help) return TRUE; } - roster_add_to_group(group, barejid); + roster_add_to_group(group, pcontact); + roster_send_add_to_group(group, pcontact); return TRUE; } @@ -1035,7 +1036,8 @@ cmd_group(gchar **args, struct cmd_help_t help) return TRUE; } - roster_remove_from_group(group, barejid); + roster_remove_from_group(group, pcontact); + roster_send_remove_from_group(group, pcontact); return TRUE; } diff --git a/src/roster_list.c b/src/roster_list.c index c4329a3b..62d99323 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -31,7 +31,6 @@ #include "jid.h" #include "tools/autocomplete.h" #include "profanity.h" -#include "xmpp/xmpp.h" // nicknames static Autocomplete name_ac; @@ -336,41 +335,32 @@ roster_get_group(const char * const group) } void -roster_add_to_group(const char * const group, const char * const barejid) +roster_add_to_group(const char * const group, PContact contact) { - PContact contact = g_hash_table_lookup(contacts, barejid); + assert(contact != NULL); - if (contact != NULL) { - if (p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_already_in_group(p_contact_name(contact), group); - } else { - prof_handle_already_in_group(p_contact_barejid(contact), group); - } - return; + if (p_contact_in_group(contact, group)) { + if (p_contact_name(contact) != NULL) { + prof_handle_already_in_group(p_contact_name(contact), group); + } else { + prof_handle_already_in_group(p_contact_barejid(contact), group); } - - roster_send_add_to_group(group, contact); - + return; } } void -roster_remove_from_group(const char * const group, const char * const barejid) +roster_remove_from_group(const char * const group, PContact contact) { - PContact contact = g_hash_table_lookup(contacts, barejid); + assert(contact != NULL); - if (contact != NULL) { - if (!p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_not_in_group(p_contact_name(contact), group); - } else { - prof_handle_not_in_group(p_contact_barejid(contact), group); - } - return; + if (!p_contact_in_group(contact, group)) { + if (p_contact_name(contact) != NULL) { + prof_handle_not_in_group(p_contact_name(contact), group); + } else { + prof_handle_not_in_group(p_contact_barejid(contact), group); } - - roster_send_remove_from_group(group, contact); + return; } } diff --git a/src/roster_list.h b/src/roster_list.h index 85a4cffc..8fe2b5bd 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -50,8 +50,8 @@ char * roster_find_contact(char *search_str); char * roster_find_resource(char *search_str); GSList * roster_get_group(const char * const group); GSList * roster_get_groups(void); -void roster_add_to_group(const char * const group, const char * const barejid); -void roster_remove_from_group(const char * const group, const char * const barejid); +void roster_add_to_group(const char * const group, PContact contact); +void roster_remove_from_group(const char * const group, PContact contact); char * roster_find_group(char *search_str); char * roster_find_jid(char *search_str); -- cgit 1.4.1-2-gfad0 From 76484665fd0df4e559f7a6732819130dc98b68a7 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Jan 2014 23:24:48 +0000 Subject: Removed prof_handle group functions --- src/command/commands.c | 18 ++++++++++++++---- src/profanity.c | 16 ---------------- src/profanity.h | 2 -- src/roster_list.c | 30 ------------------------------ src/roster_list.h | 2 -- 5 files changed, 14 insertions(+), 54 deletions(-) (limited to 'src/roster_list.h') diff --git a/src/command/commands.c b/src/command/commands.c index 57a6b151..e6588c11 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1009,8 +1009,13 @@ cmd_group(gchar **args, struct cmd_help_t help) return TRUE; } - roster_add_to_group(group, pcontact); - roster_send_add_to_group(group, pcontact); + if (p_contact_in_group(pcontact, group)) { + const char *display_name = p_contact_name_or_jid(pcontact); + ui_contact_already_in_group(display_name, group); + ui_current_page_off(); + } else { + roster_send_add_to_group(group, pcontact); + } return TRUE; } @@ -1036,8 +1041,13 @@ cmd_group(gchar **args, struct cmd_help_t help) return TRUE; } - roster_remove_from_group(group, pcontact); - roster_send_remove_from_group(group, pcontact); + if (!p_contact_in_group(pcontact, group)) { + const char *display_name = p_contact_name_or_jid(pcontact); + ui_contact_not_in_group(display_name, group); + ui_current_page_off(); + } else { + roster_send_remove_from_group(group, pcontact); + } return TRUE; } diff --git a/src/profanity.c b/src/profanity.c index 3ee032fd..9178d056 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -117,22 +117,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name) g_timer_destroy(timer); } -void -prof_handle_already_in_group(const char * const contact, - const char * const group) -{ - ui_contact_already_in_group(contact, group); - ui_current_page_off(); -} - -void -prof_handle_not_in_group(const char * const contact, - const char * const group) -{ - ui_contact_not_in_group(contact, group); - ui_current_page_off(); -} - void prof_handle_roster_add(const char * const barejid, const char * const name) { diff --git a/src/profanity.h b/src/profanity.h index a448c436..5e826fc4 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -31,7 +31,5 @@ void prof_run(const int disable_tls, char *log_level, char *account_name); void prof_handle_idle(void); void prof_handle_activity(void); void prof_handle_roster_add(const char * const barejid, const char * const name); -void prof_handle_already_in_group(const char * const contact, const char * const group); -void prof_handle_not_in_group(const char * const contact, const char * const group); #endif diff --git a/src/roster_list.c b/src/roster_list.c index 62d99323..7945101a 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -334,36 +334,6 @@ roster_get_group(const char * const group) return result; } -void -roster_add_to_group(const char * const group, PContact contact) -{ - assert(contact != NULL); - - if (p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_already_in_group(p_contact_name(contact), group); - } else { - prof_handle_already_in_group(p_contact_barejid(contact), group); - } - return; - } -} - -void -roster_remove_from_group(const char * const group, PContact contact) -{ - assert(contact != NULL); - - if (!p_contact_in_group(contact, group)) { - if (p_contact_name(contact) != NULL) { - prof_handle_not_in_group(p_contact_name(contact), group); - } else { - prof_handle_not_in_group(p_contact_barejid(contact), group); - } - return; - } -} - GSList * roster_get_groups(void) { diff --git a/src/roster_list.h b/src/roster_list.h index 8fe2b5bd..a7198e5c 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -50,8 +50,6 @@ char * roster_find_contact(char *search_str); char * roster_find_resource(char *search_str); GSList * roster_get_group(const char * const group); GSList * roster_get_groups(void); -void roster_add_to_group(const char * const group, PContact contact); -void roster_remove_from_group(const char * const group, PContact contact); char * roster_find_group(char *search_str); char * roster_find_jid(char *search_str); -- cgit 1.4.1-2-gfad0 From db973457d0b3548f767f9849ce8ca7816dcbd36e Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 5 Jan 2014 23:54:29 +0000 Subject: Refactored roster add/update --- src/profanity.c | 7 ---- src/profanity.h | 1 - src/roster_list.c | 70 ++++++++++++++----------------- src/roster_list.h | 2 +- src/server_events.c | 7 ++++ src/server_events.h | 1 + src/xmpp/roster.c | 12 +++++- tests/test_roster_list.c | 104 +++++++++++++++++++++++------------------------ 8 files changed, 101 insertions(+), 103 deletions(-) (limited to 'src/roster_list.h') diff --git a/src/profanity.c b/src/profanity.c index 9178d056..dae91aea 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -117,13 +117,6 @@ prof_run(const int disable_tls, char *log_level, char *account_name) g_timer_destroy(timer); } -void -prof_handle_roster_add(const char * const barejid, const char * const name) -{ - ui_roster_add(barejid, name); - ui_current_page_off(); -} - void prof_handle_idle(void) { diff --git a/src/profanity.h b/src/profanity.h index 5e826fc4..c55e6c47 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -30,6 +30,5 @@ void prof_run(const int disable_tls, char *log_level, char *account_name); void prof_handle_idle(void); void prof_handle_activity(void); -void prof_handle_roster_add(const char * const barejid, const char * const name); #endif diff --git a/src/roster_list.c b/src/roster_list.c index 7945101a..1341320f 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -30,7 +30,6 @@ #include "contact.h" #include "jid.h" #include "tools/autocomplete.h" -#include "profanity.h" // nicknames static Autocomplete name_ac; @@ -201,60 +200,51 @@ roster_update(const char * const barejid, const char * const name, GSList *groups, const char * const subscription, gboolean pending_out) { PContact contact = g_hash_table_lookup(contacts, barejid); + assert(contact != NULL); - if (contact == NULL) { - roster_add(barejid, name, groups, subscription, pending_out, FALSE); - } else { - p_contact_set_subscription(contact, subscription); - p_contact_set_pending_out(contact, pending_out); + p_contact_set_subscription(contact, subscription); + p_contact_set_pending_out(contact, pending_out); - const char * const new_name = name; - const char * current_name = NULL; - if (p_contact_name(contact) != NULL) { - current_name = strdup(p_contact_name(contact)); - } + const char * const new_name = name; + const char * current_name = NULL; + if (p_contact_name(contact) != NULL) { + current_name = strdup(p_contact_name(contact)); + } - p_contact_set_name(contact, new_name); - p_contact_set_groups(contact, groups); - _replace_name(current_name, new_name, barejid); + p_contact_set_name(contact, new_name); + p_contact_set_groups(contact, groups); + _replace_name(current_name, new_name, barejid); - // add groups - while (groups != NULL) { - autocomplete_add(groups_ac, groups->data); - groups = g_slist_next(groups); - } + // add groups + while (groups != NULL) { + autocomplete_add(groups_ac, groups->data); + groups = g_slist_next(groups); } } gboolean roster_add(const char * const barejid, const char * const name, GSList *groups, - const char * const subscription, gboolean pending_out, gboolean from_initial) + const char * const subscription, gboolean pending_out) { - gboolean added = FALSE; PContact contact = g_hash_table_lookup(contacts, barejid); + if (contact != NULL) { + return FALSE; + } - if (contact == NULL) { - contact = p_contact_new(barejid, name, groups, subscription, NULL, - pending_out); - - // add groups - while (groups != NULL) { - autocomplete_add(groups_ac, groups->data); - groups = g_slist_next(groups); - } - - g_hash_table_insert(contacts, strdup(barejid), contact); - autocomplete_add(barejid_ac, barejid); - _add_name_and_barejid(name, barejid); - - if (!from_initial) { - prof_handle_roster_add(barejid, name); - } + contact = p_contact_new(barejid, name, groups, subscription, NULL, + pending_out); - added = TRUE; + // add groups + while (groups != NULL) { + autocomplete_add(groups_ac, groups->data); + groups = g_slist_next(groups); } - return added; + g_hash_table_insert(contacts, strdup(barejid), contact); + autocomplete_add(barejid_ac, barejid); + _add_name_and_barejid(name, barejid); + + return TRUE; } char * diff --git a/src/roster_list.h b/src/roster_list.h index a7198e5c..58490609 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -42,7 +42,7 @@ void roster_remove(const char * const name, const char * const barejid); void roster_update(const char * const barejid, const char * const name, GSList *groups, const char * const subscription, gboolean pending_out); gboolean roster_add(const char * const barejid, const char * const name, GSList *groups, - const char * const subscription, gboolean pending_out, gboolean from_initial); + const char * const subscription, gboolean pending_out); char * roster_barejid_from_name(const char * const name); GSList * roster_get_contacts(void); gboolean roster_has_pending_subscriptions(void); diff --git a/src/server_events.c b/src/server_events.c index cbf2de3c..ac940c86 100644 --- a/src/server_events.c +++ b/src/server_events.c @@ -366,3 +366,10 @@ handle_roster_remove(const char * const barejid) ui_roster_remove(barejid); ui_current_page_off(); } + +void +handle_roster_add(const char * const barejid, const char * const name) +{ + ui_roster_add(barejid, name); + ui_current_page_off(); +} diff --git a/src/server_events.h b/src/server_events.h index b79e9c7b..ce3c3b49 100644 --- a/src/server_events.h +++ b/src/server_events.h @@ -71,5 +71,6 @@ void handle_group_add(const char * const contact, void handle_group_remove(const char * const contact, const char * const group); void handle_roster_remove(const char * const barejid); +void handle_roster_add(const char * const barejid, const char * const name); #endif diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index 3da8c7d3..a70436e7 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -255,7 +255,15 @@ _roster_handle_push(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, GSList *groups = _get_groups_from_item(item); // update the local roster - roster_update(barejid, name, groups, sub, pending_out); + PContact contact = roster_get_contact(barejid); + if (contact == NULL) { + gboolean added = roster_add(barejid, name, groups, sub, pending_out); + if (added) { + handle_roster_add(barejid, name); + } + } else { + roster_update(barejid, name, groups, sub, pending_out); + } } return 1; @@ -289,7 +297,7 @@ _roster_handle_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, GSList *groups = _get_groups_from_item(item); - gboolean added = roster_add(barejid, name, groups, sub, pending_out, TRUE); + gboolean added = roster_add(barejid, name, groups, sub, pending_out); if (!added) { log_warning("Attempt to add contact twice: %s", barejid); diff --git a/tests/test_roster_list.c b/tests/test_roster_list.c index 104921ba..a5612072 100644 --- a/tests/test_roster_list.c +++ b/tests/test_roster_list.c @@ -20,7 +20,7 @@ void empty_list_when_none_added(void **state) void contains_one_element(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); assert_int_equal(1, g_slist_length(list)); roster_free(); @@ -29,7 +29,7 @@ void contains_one_element(void **state) void first_element_correct(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); PContact james = list->data; @@ -40,8 +40,8 @@ void first_element_correct(void **state) void contains_two_elements(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); assert_int_equal(2, g_slist_length(list)); @@ -51,8 +51,8 @@ void contains_two_elements(void **state) void first_and_second_elements_correct(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); PContact first = list->data; @@ -66,9 +66,9 @@ void first_and_second_elements_correct(void **state) void contains_three_elements(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); assert_int_equal(3, g_slist_length(list)); @@ -78,9 +78,9 @@ void contains_three_elements(void **state) void first_three_elements_correct(void **state) { roster_init(); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); + roster_add("Bob", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("James", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); PContact bob = list->data; PContact dave = (g_slist_next(list))->data; @@ -95,10 +95,10 @@ void first_three_elements_correct(void **state) void add_twice_at_beginning_adds_once(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); PContact first = list->data; PContact second = (g_slist_next(list))->data; @@ -114,10 +114,10 @@ void add_twice_at_beginning_adds_once(void **state) void add_twice_in_middle_adds_once(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); PContact first = list->data; PContact second = (g_slist_next(list))->data; @@ -133,10 +133,10 @@ void add_twice_in_middle_adds_once(void **state) void add_twice_at_end_adds_once(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); + roster_add("James", NULL, NULL, NULL, FALSE); GSList *list = roster_get_contacts(); PContact first = list->data; PContact second = (g_slist_next(list))->data; @@ -152,9 +152,9 @@ void add_twice_at_end_adds_once(void **state) void find_first_exists(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); char *search = (char *) malloc(2 * sizeof(char)); strcpy(search, "B"); @@ -169,9 +169,9 @@ void find_first_exists(void **state) void find_second_exists(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); char *result = roster_find_contact("Dav"); assert_string_equal("Dave", result); @@ -182,9 +182,9 @@ void find_second_exists(void **state) void find_third_exists(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); char *result = roster_find_contact("Ja"); assert_string_equal("James", result); @@ -195,9 +195,9 @@ void find_third_exists(void **state) void find_returns_null(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); char *result = roster_find_contact("Mike"); assert_null(result); @@ -215,9 +215,9 @@ void find_on_empty_returns_null(void **state) void find_twice_returns_second_when_two_match(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamie", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Jamie", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); char *result1 = roster_find_contact("Jam"); char *result2 = roster_find_contact(result1); @@ -230,16 +230,16 @@ void find_twice_returns_second_when_two_match(void **state) void find_five_times_finds_fifth(void **state) { roster_init(); - roster_add("Jama", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamb", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Mike", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Dave", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamm", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamn", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Matt", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamo", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamy", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamz", NULL, NULL, NULL, FALSE, TRUE); + roster_add("Jama", NULL, NULL, NULL, FALSE); + roster_add("Jamb", NULL, NULL, NULL, FALSE); + roster_add("Mike", NULL, NULL, NULL, FALSE); + roster_add("Dave", NULL, NULL, NULL, FALSE); + roster_add("Jamm", NULL, NULL, NULL, FALSE); + roster_add("Jamn", NULL, NULL, NULL, FALSE); + roster_add("Matt", NULL, NULL, NULL, FALSE); + roster_add("Jamo", NULL, NULL, NULL, FALSE); + roster_add("Jamy", NULL, NULL, NULL, FALSE); + roster_add("Jamz", NULL, NULL, NULL, FALSE); char *result1 = roster_find_contact("Jam"); char *result2 = roster_find_contact(result1); @@ -258,9 +258,9 @@ void find_five_times_finds_fifth(void **state) void find_twice_returns_first_when_two_match_and_reset(void **state) { roster_init(); - roster_add("James", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Jamie", NULL, NULL, NULL, FALSE, TRUE); - roster_add("Bob", NULL, NULL, NULL, FALSE, TRUE); + roster_add("James", NULL, NULL, NULL, FALSE); + roster_add("Jamie", NULL, NULL, NULL, FALSE); + roster_add("Bob", NULL, NULL, NULL, FALSE); char *result1 = roster_find_contact("Jam"); roster_reset_search_attempts(); -- cgit 1.4.1-2-gfad0