From 840abdb4bcb86f2d4398e423735ae0c39d2ef32b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 5 Dec 2023 19:13:02 +0300 Subject: for #4000 - offline files are marked read when shown in NewStory --- plugins/NewStory/src/history_array.cpp | 16 +++++++++++----- plugins/NewStory/src/history_array.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'plugins/NewStory') diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 5b80cc4e52..c9353e88f0 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -352,11 +352,7 @@ void ItemData::load(bool bFullLoad) switch (dbe.eventType) { case EVENTTYPE_MESSAGE: - if (!(dbe.flags & DBEF_SENT)) { - if (!dbe.markedRead()) - db_event_markRead(hContact, hEvent); - Clist_RemoveEvent(-1, hEvent); - } + markRead(); __fallthrough; case EVENTTYPE_STATUSCHANGE: @@ -385,6 +381,7 @@ void ItemData::load(bool bFullLoad) buf.AppendFormat(L" [$hicon=%p$]", g_plugin.getIcon(IDI_OK)); wtext = buf.Detach(); + markRead(); break; } @@ -441,6 +438,15 @@ void ItemData::load(bool bFullLoad) dbe.unload(); } +void ItemData::markRead() +{ + if (!(dbe.flags & DBEF_SENT)) { + if (!dbe.markedRead()) + db_event_markRead(hContact, hEvent); + Clist_RemoveEvent(-1, hEvent); + } +} + void ItemData::setText() { data = MTextCreateEx(htuLog, formatRtf().GetBuffer(), MTEXT_FLG_RTF); diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index b1f5a12e2c..7ec4168bf5 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -34,6 +34,7 @@ struct ItemData ItemData* checkPrev(ItemData *pPrev); ItemData* checkPrevGC(ItemData *pPrev); void checkCreate(HWND hwnd); + void markRead(); void setText(); bool fetch(void); -- cgit v1.2.3