From 3538aa32babc7aa8bfaf5de4a0068300d14ea0dc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 9 Mar 2024 13:22:15 +0300 Subject: Msg_Export: old obsolete code removed --- plugins/Msg_Export/src/options.cpp | 62 +++++--------------------------------- plugins/Msg_Export/src/version.h | 2 +- 2 files changed, 8 insertions(+), 56 deletions(-) (limited to 'plugins/Msg_Export/src') diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index fd0c981c5f..a9d2ccb3fb 100644 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -21,44 +21,6 @@ const int nUINColWitdh = 80; // width in pixels of the UIN column in the List Ctrl const int nProtoColWitdh = 100; // width in pixels of the UIN column in the List Ctrl -///////////////////////////////////////////////////////////////////////////////////////// -// Class : CLDBEvent -// Superclass : -// Project : Mes_export -// Designer : Kennet Nielsen -// Version : 1.0.0 -// Date : 020422, 22 April 2002 -// -// -// Description: This class is used to store one DB event dyring the export -// All history function -// -// Version History: -// Ver: Initials: Date: Text: -// 1.0.0 KN 020422 First edition - -class CLDBEvent -{ - uint32_t time; -public: - MCONTACT hUser; - MEVENT hDbEvent; - - CLDBEvent(MCONTACT hU, MEVENT hDBE) - { - hUser = hU; - hDbEvent = hDBE; - - DBEVENTINFO dbei = {}; - db_event_get(hDbEvent, &dbei); - time = dbei.timestamp; - } - - bool operator <(const CLDBEvent& rOther) const - { return time < rOther.time; - } -}; - ///////////////////////////////////////////////////////////////////////////////////////// // Member Function : CompareFunc // Type : Global @@ -130,20 +92,15 @@ void __cdecl exportContactsMessages(struct ExportDialogData *data) SetWindowText(hStatus, TranslateT("Reading database information (Phase 1 of 2)")); // map with list to stored all DB history before it is exported - map, less > AllEvents; + std::list todo; { - // reading from the database !!! int nCur = 0; for (auto &hContact : data->contacts) { // Check if we should ignore this contact/protocol if (!bIsExportEnabled(hContact)) continue; - list &rclCurList = AllEvents[GetFilePathFromUser(hContact)]; - - DB::ECPTR pCursor(DB::Events(hContact)); - while (MEVENT hDbEvent = pCursor.FetchNext()) - rclCurList.push_back(CLDBEvent(hContact, hDbEvent)); + todo.push_back(hContact); SendMessage(hProg, PBM_SETPOS, nCur, 0); RedrawWindow(hDlg, nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW); @@ -157,18 +114,14 @@ void __cdecl exportContactsMessages(struct ExportDialogData *data) // window text update SetWindowText(hStatus, TranslateT("Sorting and writing database information (Phase 2 of 2)")); - SendMessage(hProg, PBM_SETRANGE, 0, MAKELPARAM(0, AllEvents.size() - 1)); + SendMessage(hProg, PBM_SETRANGE, 0, MAKELPARAM(0, todo.size() - 1)); SendMessage(hProg, PBM_SETPOS, 0, 0); // time to write to files !!! int nCur = 0; - for (auto &F : AllEvents) { - F.second.sort(); // Sort is preformed here !! - // events with same time will not be swaped, they will - // remain in there original order - + for (auto &hContact : todo) { // Open/create file for writing - wstring sFilePath = F.first; + wstring sFilePath = GetFilePathFromUser(hContact); MDatabaseExport *pJson = nullptr; HANDLE hFile; @@ -187,9 +140,8 @@ void __cdecl exportContactsMessages(struct ExportDialogData *data) // At first write we need to have this false (to write file header, etc.), for each next write to same file use true bool bAppendOnly = false; - for (auto &E : F.second) { - MEVENT hDbEvent = E.hDbEvent; - MCONTACT hContact = E.hUser; + DB::ECPTR pCursor(DB::Events(hContact)); + while (MEVENT hDbEvent = pCursor.FetchNext()) { if (!bExportEvent(hContact, hDbEvent, hFile, sFilePath, bAppendOnly)) break; // serious error, we should close the file and don't continue with it diff --git a/plugins/Msg_Export/src/version.h b/plugins/Msg_Export/src/version.h index 83b2c63d86..2755bd63b5 100644 --- a/plugins/Msg_Export/src/version.h +++ b/plugins/Msg_Export/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 9 +#define __BUILD_NUM 10 #include -- cgit v1.2.3