mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 16:26:21 +00:00
Added roster struct, create and destroy roster on connect/disconnect
This commit is contained in:
@@ -53,7 +53,7 @@ void cmd_roster_shows_roster_when_no_args(void **state)
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
roster_init();
|
||||
roster_create();
|
||||
roster_add("bob@server.org", "bob", NULL, "both", FALSE);
|
||||
GSList *roster = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
|
||||
|
||||
@@ -62,7 +62,7 @@ void cmd_roster_shows_roster_when_no_args(void **state)
|
||||
gboolean result = cmd_roster(NULL, CMD_ROSTER, args);
|
||||
assert_true(result);
|
||||
|
||||
roster_free();
|
||||
roster_destroy();
|
||||
}
|
||||
|
||||
void cmd_roster_add_shows_message_when_no_jid(void **state)
|
||||
@@ -145,7 +145,7 @@ void cmd_roster_nick_shows_message_when_no_contact_exists(void **state)
|
||||
{
|
||||
gchar *args[] = { "nick", "bob@server.org", "bobster", NULL };
|
||||
|
||||
roster_init();
|
||||
roster_create();
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
@@ -154,7 +154,7 @@ void cmd_roster_nick_shows_message_when_no_contact_exists(void **state)
|
||||
gboolean result = cmd_roster(NULL, CMD_ROSTER, args);
|
||||
assert_true(result);
|
||||
|
||||
roster_free();
|
||||
roster_destroy();
|
||||
}
|
||||
|
||||
void cmd_roster_nick_sends_name_change_request(void **state)
|
||||
@@ -163,9 +163,9 @@ void cmd_roster_nick_sends_name_change_request(void **state)
|
||||
char *nick = "bobster";
|
||||
gchar *args[] = { "nick", jid, nick, NULL };
|
||||
|
||||
roster_init();
|
||||
roster_create();
|
||||
GSList *groups = NULL;
|
||||
groups = g_slist_append(groups, "group1");
|
||||
groups = g_slist_append(groups, strdup("group1"));
|
||||
roster_add(jid, "bob", groups, "both", FALSE);
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
@@ -181,7 +181,7 @@ void cmd_roster_nick_sends_name_change_request(void **state)
|
||||
|
||||
PContact contact = roster_get_contact(jid);
|
||||
assert_string_equal(p_contact_name(contact), nick);
|
||||
roster_free();
|
||||
roster_destroy();
|
||||
}
|
||||
|
||||
void cmd_roster_clearnick_shows_message_when_no_jid(void **state)
|
||||
@@ -200,7 +200,7 @@ void cmd_roster_clearnick_shows_message_when_no_contact_exists(void **state)
|
||||
{
|
||||
gchar *args[] = { "clearnick", "bob@server.org", NULL };
|
||||
|
||||
roster_init();
|
||||
roster_create();
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
@@ -209,7 +209,7 @@ void cmd_roster_clearnick_shows_message_when_no_contact_exists(void **state)
|
||||
gboolean result = cmd_roster(NULL, CMD_ROSTER, args);
|
||||
assert_true(result);
|
||||
|
||||
roster_free();
|
||||
roster_destroy();
|
||||
}
|
||||
|
||||
void cmd_roster_clearnick_sends_name_change_request_with_empty_nick(void **state)
|
||||
@@ -217,9 +217,9 @@ void cmd_roster_clearnick_sends_name_change_request_with_empty_nick(void **state
|
||||
char *jid = "bob@server.org";
|
||||
gchar *args[] = { "clearnick", jid, NULL };
|
||||
|
||||
roster_init();
|
||||
roster_create();
|
||||
GSList *groups = NULL;
|
||||
groups = g_slist_append(groups, "group1");
|
||||
groups = g_slist_append(groups, strdup("group1"));
|
||||
roster_add(jid, "bob", groups, "both", FALSE);
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
@@ -236,5 +236,5 @@ void cmd_roster_clearnick_sends_name_change_request_with_empty_nick(void **state
|
||||
PContact contact = roster_get_contact(jid);
|
||||
assert_null(p_contact_name(contact));
|
||||
|
||||
roster_free();
|
||||
roster_destroy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user