diff options
author | George Hazan <george.hazan@gmail.com> | 2025-03-21 14:31:09 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-03-21 14:31:09 +0300 |
commit | 2d2fa8dd248ba2e3e22f13533fef4c69bfbc3c2b (patch) | |
tree | 578bccc1bde93f02704e0147b3966391809160a4 /plugins/TabSRMM/src/msgdlgother.cpp | |
parent | 0afefd8efd13f9cc88baf8baef7c445329d68091 (diff) |
fixes #4863 (NewStory: отправленные файлы по-разному показываются в табсах и в истории)
Diffstat (limited to 'plugins/TabSRMM/src/msgdlgother.cpp')
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 1bf3dde416..56cdf162d7 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -401,35 +401,31 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) bool CMsgDialog::GetFirstEvent()
{
int historyMode = g_plugin.getByte(m_hContact, "LoadHistory", Srmm::iHistoryMode);
-
- m_hDbEventFirst = db_event_firstUnread(m_hContact);
-
if (m_bActualHistory)
historyMode = LOADHISTORY_COUNT;
DB::EventInfo dbei;
- DB::ECPTR pCursor(DB::EventsRev(m_hContact, m_hDbEventFirst));
switch (historyMode) {
- case LOADHISTORY_COUNT:
- int i;
-
- // ability to load only current session's history
- if (m_bActualHistory)
- i = m_cache->getSessionMsgCount();
- else
- i = g_plugin.getWord(SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT);
+ case LOADHISTORY_UNREAD:
+ m_hDbEventFirst = db_event_firstUnread(m_hContact);
+ break;
- for (; i > 0; i--) {
- MEVENT hPrevEvent = pCursor.FetchNext();
- if (hPrevEvent == 0)
- break;
+ case LOADHISTORY_COUNT:
+ {
+ DB::ECPTR pCursor(DB::EventsRev(m_hContact));
+ int n = (m_bActualHistory) ? m_cache->getSessionMsgCount() : g_plugin.getWord(SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT);
+ while (n > 0) {
+ MEVENT hPrevEvent = pCursor.FetchNext();
+ if (hPrevEvent == 0)
+ break;
- dbei.cbBlob = 0;
- m_hDbEventFirst = hPrevEvent;
- db_event_get(m_hDbEventFirst, &dbei);
- if (!DbEventIsShown(dbei))
- i++;
+ dbei.cbBlob = 0;
+ m_hDbEventFirst = hPrevEvent;
+ db_event_get(m_hDbEventFirst, &dbei);
+ if (DbEventIsShown(dbei))
+ n--;
+ }
}
break;
@@ -441,6 +437,7 @@ bool CMsgDialog::GetFirstEvent() uint32_t firstTime = dbei.getUnixtime() - 60 * g_plugin.getWord(SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
+ DB::ECPTR pCursor(DB::EventsRev(m_hContact));
while (MEVENT hPrevEvent = pCursor.FetchNext()) {
dbei.cbBlob = 0;
db_event_get(hPrevEvent, &dbei);
|