Add nickname support for /roster remove

Add support of name/nickname instead of only JID for `/roster remove` command.

Add tests for it as well.
This commit is contained in:
John Hernandez
2023-04-13 15:23:45 +02:00
parent 766dc76e33
commit 5b8b9074a2
9 changed files with 65 additions and 7 deletions

View File

@@ -83,6 +83,7 @@ int main(int argc, char* argv[]) {
PROF_FUNC_TEST(sends_new_item),
PROF_FUNC_TEST(sends_new_item_nick),
PROF_FUNC_TEST(sends_remove_item),
PROF_FUNC_TEST(sends_remove_item_nick),
PROF_FUNC_TEST(sends_nick_change),
PROF_FUNC_TEST(send_software_version_request),

View File

@@ -92,6 +92,35 @@ sends_remove_item(void **state)
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
}
void
sends_remove_item_nick(void **state)
{
prof_connect_with_roster(
"<item jid='buddy1@localhost' name='Bobby' subscription='both'/>"
"<item jid='buddy2@localhost' subscription='both'/>"
);
stbbr_for_query("jabber:iq:roster",
"<iq id='*' type='set'>"
"<query xmlns='jabber:iq:roster'>"
"<item jid='buddy1@localhost' subscription='remove'/>"
"</query>"
"</iq>"
);
prof_input("/roster remove Bobby");
assert_true(stbbr_received(
"<iq type='set' id='*'>"
"<query xmlns='jabber:iq:roster'>"
"<item jid='buddy1@localhost' subscription='remove'/>"
"</query>"
"</iq>"
));
assert_true(prof_output_exact("Roster item removed: buddy1@localhost"));
}
void
sends_nick_change(void **state)
{

View File

@@ -1,4 +1,5 @@
void sends_new_item(void **state);
void sends_new_item_nick(void **state);
void sends_remove_item(void **state);
void sends_remove_item_nick(void **state);
void sends_nick_change(void **state);