Send 200Ok to server if message we can't decrypt to avoid useless retransmission + adaptation of tests to this behavior

This commit is contained in:
Benjamin Reis 2017-02-20 11:19:37 +01:00
parent 7549c9dd37
commit 615f9d4e23
2 changed files with 6 additions and 1 deletions

View file

@ -679,6 +679,11 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
} else if(retval > 0) {
// Unable to decrypt message
linphone_core_notify_message_received_unable_decrypt(cr->lc, cr, msg);
reason = linphone_error_code_to_reason(retval);
linphone_chat_message_send_delivery_notification(msg, reason);
// return LinphoneReasonNone to avoid flexisip resending us a message we can't decrypt
reason = LinphoneReasonNone;
goto end;
}
}
}

View file

@ -1260,7 +1260,7 @@ static void lime_text_message_to_non_lime(bool_t sender_policy_mandatory, bool_t
if (chat_room_size == 1) {
bctbx_list_t *history = linphone_chat_room_get_history(chat_room, 0);
LinphoneChatMessage *sent_msg = (LinphoneChatMessage *)bctbx_list_get_data(history);
BC_ASSERT_EQUAL((int)linphone_chat_message_get_state(sent_msg), (int)LinphoneChatMessageStateNotDelivered, int, "%d");
BC_ASSERT_EQUAL((int)linphone_chat_message_get_state(sent_msg), (int)LinphoneChatMessageStateDelivered, int, "%d");
bctbx_list_free_with_data(history, (bctbx_list_free_func)linphone_chat_message_unref);
}
} else {