From e4d69943332fdf15ecbbe3ea7e593a3119869827 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Apr 2023 17:00:16 +0300 Subject: database events that go to the group chats to be marked read as well --- src/mir_app/src/chat_log.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index f0d0065e15..425f80753e 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -302,10 +302,12 @@ void CRtfLogWindow::CreateChatRtfEvent(RtfChatLogStreamData *streamData, const L void CRtfLogWindow::CreateChatRtfMessage(RtfChatLogStreamData *streamData, const LOGINFO &lin, CMStringA &buf) { + auto *si = streamData->si; + buf.AppendFormat("%s ", Log_SetStyle(lin.bIsHighlighted ? 16 : lin.getIndex())); CMStringW wszCaption; - bool bTextUsed = Chat_GetDefaultEventDescr(streamData->si, &lin, wszCaption); + bool bTextUsed = Chat_GetDefaultEventDescr(si, &lin, wszCaption); if (!wszCaption.IsEmpty()) { wszCaption.AppendChar(' '); lin.write(streamData, !bTextUsed, buf, wszCaption); @@ -316,6 +318,13 @@ void CRtfLogWindow::CreateChatRtfMessage(RtfChatLogStreamData *streamData, const if (lin.hEvent) { DB::EventInfo dbei(lin.hEvent); if (dbei) { + if (!dbei.markedRead()) { + if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm()) { + db_event_markRead(si->hContact, lin.hEvent); + g_clistApi.pfnRemoveEvent(si->hContact, lin.hEvent); + } + } + if (dbei.eventType == EVENTTYPE_FILE) { DB::FILE_BLOB blob(dbei); if (blob.isOffline()) { -- cgit v1.2.3