Remove status from cl_ev_presence_send

fixes #888
This commit is contained in:
James Booth
2017-01-15 23:59:31 +00:00
parent b64646979e
commit 2b7894ccff
16 changed files with 71 additions and 34 deletions

View File

@@ -52,6 +52,7 @@ int main(int argc, char* argv[]) {
PROF_FUNC_TEST(presence_chat_with_message),
PROF_FUNC_TEST(presence_set_priority),
PROF_FUNC_TEST(presence_includes_priority),
PROF_FUNC_TEST(presence_keeps_status),
PROF_FUNC_TEST(presence_received),
PROF_FUNC_TEST(presence_missing_resource_defaults),

View File

@@ -227,6 +227,33 @@ presence_includes_priority(void **state)
assert_true(prof_output_exact("Status set to chat (priority 25), \"Free to talk\"."));
}
void
presence_keeps_status(void **state)
{
prof_connect();
prof_input("/chat \"Free to talk\"");
assert_true(stbbr_received(
"<presence id='prof_presence_4'>"
"<show>chat</show>"
"<status>Free to talk</status>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
"</presence>"
));
assert_true(prof_output_exact("Status set to chat (priority 0), \"Free to talk\"."));
prof_input("/priority 25");
assert_true(stbbr_received(
"<presence id='prof_presence_5'>"
"<show>chat</show>"
"<status>Free to talk</status>"
"<priority>25</priority>"
"<c hash='sha-1' xmlns='http://jabber.org/protocol/caps' ver='*' node='http://www.profanity.im'/>"
"</presence>"
));
assert_true(prof_output_exact("Priority set to 25."));
}
void
presence_received(void **state)
{

View File

@@ -10,5 +10,6 @@ void presence_chat(void **state);
void presence_chat_with_message(void **state);
void presence_set_priority(void **state);
void presence_includes_priority(void **state);
void presence_keeps_status(void **state);
void presence_received(void **state);
void presence_missing_resource_defaults(void **state);

View File

@@ -806,17 +806,15 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
expect_any(accounts_get_account, name);
will_return(accounts_get_account, account);
#endif
will_return(connection_get_presence_msg, "Free to chat");
expect_value(presence_send, status, RESOURCE_ONLINE);
expect_string(presence_send, msg, "Free to chat");
expect_value(presence_send, idle, 0);
expect_value(presence_send, signed_status, NULL);
expect_cons_show("Updated online priority for account a_account: 10");
expect_cons_show("");
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
assert_true(result);
}

View File

@@ -78,6 +78,8 @@ GList * session_get_available_resources(void)
return NULL;
}
void connection_set_presence_msg(const char *const message) {}
gboolean
connection_send_stanza(const char *const stanza)
{
@@ -153,10 +155,9 @@ void presence_join_room(const char *const room, const char *const nick, const ch
void presence_change_room_nick(const char * const room, const char * const nick) {}
void presence_leave_chat_room(const char * const room_jid) {}
void presence_send(resource_presence_t status, const char * const msg, int idle, char *signed_status)
void presence_send(resource_presence_t status, int idle, char *signed_status)
{
check_expected(status);
check_expected(msg);
check_expected(idle);
check_expected(signed_status);
}