From 2bf9d8e3bc1e51e28a94f8e5bbdd685fa0a71279 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Jan 2021 21:39:50 +0300 Subject: Import to use faster cursors --- plugins/Import/src/import.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/Import/src') diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 8ebafa0aa4..22716620bf 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -878,8 +878,11 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int BYTE *eventBuf = (PBYTE)mir_alloc(cbAlloc); // Get the start of the event chain - MEVENT hEvent = srcDb->FindFirstEvent(hContact); - for (int i = 0; hEvent; i++, hEvent = srcDb->FindNextEvent(hContact, hEvent)) { + int i = 0; + DB::ECPTR pCursor(srcDb->EventCursor(hContact, 0)); + while (MEVENT hEvent = pCursor.FetchNext()) { + i++; + // Copy the event and import it DBEVENTINFO dbei = {}; dbei.cbBlob = srcDb->GetBlobSize(hEvent); -- cgit v1.2.3