summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewStory/src/history_control.cpp')
-rw-r--r--plugins/NewStory/src/history_control.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index f56d5b4661..b2b83ebc44 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -120,7 +120,10 @@ static void __cdecl sttLoadItems(void *param)
auto *pData = (NewstoryListData *)param;
for (int i = pData->totalCount-1; i >= 0; i--) {
- pData->LoadItem(i);
+ auto *pItem = pData->LoadItem(i, true);
+ if (pItem->dbe.eventType == EVENTTYPE_MESSAGE && !(pItem->dbe.flags & DBEF_SENT) && !pItem->dbe.markedRead())
+ PostMessage(pData->m_hwnd, UM_MARKREAD, WPARAM(pItem), 0);
+
if ((i % 100) == 0)
Sleep(50);
}
@@ -366,7 +369,7 @@ void NewstoryListData::EndEditItem(bool bAccept)
ptrA szUtf(mir_utf8encodeW(pItem->wtext));
dbei.cbBlob = (int)mir_strlen(szUtf) + 1;
- dbei.pBlob = (uint8_t *)szUtf.get();
+ dbei.pBlob = szUtf.get();
db_event_edit(pItem->hEvent, &dbei);
}
@@ -552,13 +555,13 @@ void NewstoryListData::HitTotal(int yCurr, int yTotal)
FixScrollPosition();
}
-ItemData* NewstoryListData::LoadItem(int idx)
+ItemData* NewstoryListData::LoadItem(int idx, bool bBack)
{
if (totalCount == 0)
return nullptr;
mir_cslock lck(m_csItems);
- return (bSortAscending) ? items.get(idx, true) : items.get(totalCount - 1 - idx, true);
+ return (bSortAscending) ? items.get(idx, true, bBack) : items.get(totalCount - 1 - idx, true, bBack);
}
void NewstoryListData::OpenFolder()
@@ -1105,6 +1108,11 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
break;
+ case UM_MARKREAD:
+ if (auto *pItem = (ItemData *)wParam)
+ pItem->markRead();
+ break;
+
case WM_SIZE:
data->OnResize(LOWORD(lParam), HIWORD(lParam));
break;