summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-10-16 17:20:43 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-10-16 17:20:43 +0300
commit33688bc55f818f5c0c1229605b407279e66b7499 (patch)
tree5a2f525f20c73219f5fe27a031a2036ba9ba1e23 /plugins/NewStory/src/history_array.cpp
parent46e67c5053479beafce3716ec8be4f7e997e7fc9 (diff)
fixes #4733 (NewStory: отметки о прочтении пропадают при переоткрытии окна)
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index b356038208..c510c0f7f8 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -559,7 +559,7 @@ void HistoryArray::addChatEvent(NewstoryListData *pOwner, SESSION_INFO *si, cons
}
}
-ItemData* HistoryArray::addEvent(NewstoryListData *pOwner, MCONTACT hContact, MEVENT hEvent, int count)
+void HistoryArray::addEvent(NewstoryListData *pOwner, MCONTACT hContact, MEVENT hEvent, int count, bool bNew)
{
if (count == -1)
count = MAXINT;
@@ -577,34 +577,32 @@ ItemData* HistoryArray::addEvent(NewstoryListData *pOwner, MCONTACT hContact, ME
p.pOwner = pOwner;
p.dbe.hContact = hContact;
p.dbe = hEvent;
+ p.m_bNew = bNew;
if (isChat) {
checkGC(p, si);
pPrev = p.checkPrevGC(pPrev);
}
else pPrev = p.checkPrev(pPrev);
- return &p;
}
+ else {
+ DB::ECPTR pCursor(DB::Events(hContact, hEvent));
+ for (int i = 0; i < count; i++) {
+ hEvent = pCursor.FetchNext();
+ if (!hEvent)
+ break;
- ItemData *pRet = nullptr;
- DB::ECPTR pCursor(DB::Events(hContact, hEvent));
- for (int i = 0; i < count; i++) {
- hEvent = pCursor.FetchNext();
- if (!hEvent)
- break;
-
- auto &p = allocateItem();
- p.pOwner = pOwner;
- p.dbe.hContact = hContact;
- p.dbe = hEvent;
- if (isChat) {
- checkGC(p, si);
- pPrev = p.checkPrevGC(pPrev);
+ auto &p = allocateItem();
+ p.pOwner = pOwner;
+ p.dbe.hContact = hContact;
+ p.dbe = hEvent;
+ p.m_bNew = bNew;
+ if (isChat) {
+ checkGC(p, si);
+ pPrev = p.checkPrevGC(pPrev);
+ }
+ else pPrev = p.checkPrev(pPrev);
}
- else pPrev = p.checkPrev(pPrev);
- pRet = &p;
}
-
- return pRet;
}
void HistoryArray::addNick(ItemData &pItem, wchar_t *pwszNick)