From 5a09915186e4ae70cc39e9343ca02a1b860d7f94 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 May 2020 12:34:32 +0300 Subject: simple database event cycles moved to cursors --- plugins/CmdLine/src/mimcmd_handlers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/CmdLine/src') diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 74bfa10f37..7427dc3257 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1348,12 +1348,13 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re int count = stop - start + 1; if (count > 0) { int index = 0; - MEVENT hEvent = db_event_first(hContact); + DBEVENTINFO dbEvent = {}; char message[4096]; dbEvent.pBlob = (PBYTE)message; - while (hEvent) { + DB::ECPTR pCursor(DB::Events(hContact)); + while (MEVENT hEvent = pCursor.FetchNext()) { dbEvent.cbBlob = _countof(message); if (!db_event_get(hEvent, &dbEvent)) { // if successful call dbEvent.pBlob[dbEvent.cbBlob] = 0; @@ -1364,7 +1365,6 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re if (index > stop) break; - hEvent = db_event_next(hContact, hEvent); index++; } } -- cgit v1.2.3