diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 5ccabdf4..9d80fb1f 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -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;
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index d6989377..617ab838 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -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),
diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c
index 94bd57a0..414284ff 100644
--- a/tests/functionaltests/test_carbons.c
+++ b/tests/functionaltests/test_carbons.c
@@ -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(
+ ""
+ ));
+
+ stbbr_send(
+ ""
+ "10"
+ "On my mobile"
+ ""
+ );
+ assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
+ prof_input("/msg Buddy1");
+ assert_true(prof_output_exact("unencrypted"));
+
+ stbbr_send(
+ ""
+ "Private carbon"
+ ""
+ ""
+ );
+
+ assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
+}
diff --git a/tests/functionaltests/test_carbons.h b/tests/functionaltests/test_carbons.h
index 6d24c8ae..ab48a009 100644
--- a/tests/functionaltests/test_carbons.h
+++ b/tests/functionaltests/test_carbons.h
@@ -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);