From 5d1a3ebfcdaac300c0cd38f75fe82ee1f185f7e4 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 14 Mar 2017 10:21:52 +0100 Subject: [PATCH] Prevent message state from going to early states if it has reached the delivered to user or displayed state. --- coreapi/chat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 3ae49d132..cfcfae604 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -144,8 +144,9 @@ static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) { void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state) { /* do not invoke callbacks on orphan messages */ if (state != msg->state && msg->chat_room != NULL) { - if ((msg->state == LinphoneChatMessageStateDisplayed) && (state == LinphoneChatMessageStateDeliveredToUser)) { - /* If the message has been displayed we must not go back to the delivered to user state. */ + if (((msg->state == LinphoneChatMessageStateDisplayed) || (msg->state == LinphoneChatMessageStateDeliveredToUser)) + && ((state == LinphoneChatMessageStateDeliveredToUser) || (state == LinphoneChatMessageStateDelivered) || (state == LinphoneChatMessageStateNotDelivered))) { + /* If the message has been displayed or delivered to user we must not go back to the delivered or not delivered state. */ return; } ms_message("Chat message %p: moving from state %s to %s", msg, linphone_chat_message_state_to_string(msg->state),