mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 23:28:09 +00:00
Fix last received chat message not being marked as read.
This commit is contained in:
parent
8517a2d0d5
commit
735268f85d
2 changed files with 11 additions and 0 deletions
|
|
@ -750,6 +750,10 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
|
|||
cr->unread_count = 1;
|
||||
else
|
||||
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);
|
||||
|
|
@ -758,6 +762,8 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
|
|||
msg->storage_id = linphone_chat_message_store(msg);
|
||||
}
|
||||
|
||||
cr->pending_message = NULL;
|
||||
|
||||
end:
|
||||
linphone_address_unref(addr);
|
||||
if (msg != NULL) linphone_chat_message_unref(msg);
|
||||
|
|
|
|||
|
|
@ -456,6 +456,11 @@ void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
|
|||
sqlite3_free(buf);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue