1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-07-21 18:24:14 -04:00

log_info on private carbons

This commit is contained in:
James Booth 2016-08-28 17:27:26 +01:00
parent ea9216f054
commit fca59a3110
4 changed files with 37 additions and 0 deletions

View File

@ -686,6 +686,11 @@ _handle_carbons(xmpp_stanza_t *const stanza)
return TRUE;
}
if (g_strcmp0(name, "private") == 0) {
log_info("Carbon received with private element.");
return FALSE;
}
if ((g_strcmp0(name, "received") != 0) && (g_strcmp0(name, "sent") != 0)) {
log_warning("Carbon received with unrecognised stanza name: %s", name);
return TRUE;

View File

@ -71,6 +71,7 @@ int main(int argc, char* argv[]) {
PROF_FUNC_TEST(send_disable_carbons),
PROF_FUNC_TEST(receive_carbon),
PROF_FUNC_TEST(receive_self_carbon),
PROF_FUNC_TEST(receive_private_carbon),
PROF_FUNC_TEST(send_receipt_request),
PROF_FUNC_TEST(send_receipt_on_request),

View File

@ -118,3 +118,33 @@ receive_self_carbon(void **state)
assert_true(prof_output_regex("me: .+self sent carbon"));
}
void
receive_private_carbon(void **state)
{
prof_input("/carbons on");
prof_connect();
assert_true(stbbr_received(
"<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
));
stbbr_send(
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
"<priority>10</priority>"
"<status>On my mobile</status>"
"</presence>"
);
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
prof_input("/msg Buddy1");
assert_true(prof_output_exact("unencrypted"));
stbbr_send(
"<message type='chat' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
"<body>Private carbon</body>"
"<private xmlns='urn:xmpp:carbons:2'/>"
"</message>"
);
assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
}

View File

@ -3,4 +3,5 @@ void connect_with_carbons_enabled(void **state);
void send_disable_carbons(void **state);
void receive_carbon(void **state);
void receive_self_carbon(void **state);
void receive_private_carbon(void **state);