diff options
author | George Hazan <ghazan@miranda.im> | 2021-02-28 22:26:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-02-28 22:26:32 +0300 |
commit | 6b7f8c2129116382c8c67d05164110238845a1e0 (patch) | |
tree | 89f2361fcdcca5e9b1ad613de501f31856dcf2bd /plugins/Clist_nicer | |
parent | b2c82971f99a2e46cf9a0819ed86154d06d1f92a (diff) |
some evident reverse iterators moved to cursors
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r-- | plugins/Clist_nicer/src/contact.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index 5d63b7e119..7cda00d4da 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -65,21 +65,20 @@ HANDLE hThreadMFUpdate = nullptr; static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep)
{
DWORD curTime = time(0);
- DWORD frequency, eventCount;
- MEVENT hEvent = db_event_last(hContact);
-
- eventCount = 0;
+ DWORD frequency, eventCount = 0;
DBEVENTINFO dbei = {};
- while (hEvent) {
+ DB::ECPTR cursor(DB::EventsRev(hContact));
+ while (MEVENT hEvent = cursor.FetchNext()) {
db_event_get(hEvent, &dbei);
- if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { // record time of last event
+ // record time of last event
+ if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
eventCount++;
- }
+
if (eventCount >= 100 || dbei.timestamp < curTime - (dwCutoffDays * 86400))
break;
- hEvent = db_event_prev(hContact, hEvent);
+
if (doSleep && mf_updatethread_running == FALSE)
return;
if (doSleep)
@@ -136,7 +135,8 @@ void MF_InitCheck(void) DWORD INTSORT_GetLastMsgTime(MCONTACT hContact)
{
- for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) {
+ DB::ECPTR cursor(DB::EventsRev(hContact));
+ while (MEVENT hDbEvent = cursor.FetchNext()) {
DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
|