Commit 735268f8 authored by Ghislain MARY's avatar Ghislain MARY

Fix last received chat message not being marked as read.

parent 8517a2d0
...@@ -750,6 +750,10 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const ...@@ -750,6 +750,10 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
cr->unread_count = 1; cr->unread_count = 1;
else else
cr->unread_count++; cr->unread_count++;
/* Mark the message as pending so that if linphone_core_chat_room_mark_as_read() is called
in the linphone_chat_room_message_received() callback, it will effectively be marked as
being read before being stored. */
cr->pending_message = msg;
} }
linphone_chat_room_message_received(cr, lc, msg); linphone_chat_room_message_received(cr, lc, msg);
...@@ -758,6 +762,8 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const ...@@ -758,6 +762,8 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
msg->storage_id = linphone_chat_message_store(msg); msg->storage_id = linphone_chat_message_store(msg);
} }
cr->pending_message = NULL;
end: end:
linphone_address_unref(addr); linphone_address_unref(addr);
if (msg != NULL) linphone_chat_message_unref(msg); if (msg != NULL) linphone_chat_message_unref(msg);
......
...@@ -456,6 +456,11 @@ void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){ ...@@ -456,6 +456,11 @@ void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
sqlite3_free(buf); sqlite3_free(buf);
ms_free(peer); ms_free(peer);
if (cr->pending_message) {
linphone_chat_message_set_state(cr->pending_message, LinphoneChatMessageStateDisplayed);
linphone_chat_message_send_display_notification(cr->pending_message);
}
cr->unread_count = 0; cr->unread_count = 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment