summaryrefslogtreecommitdiff
path: root/plugins/Msg_Export/src/options.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2017-02-05 22:07:01 +0100
committerRobert Pösel <robyer@seznam.cz>2017-02-05 22:46:17 +0100
commitd8142b3a62a0e0e5cb715f95f2e03d9bf808dff0 (patch)
treeaf524b3076b8e3eabb29c7b39e1791d1fc334838 /plugins/Msg_Export/src/options.cpp
parent63946d6a451ba85b0a098959590632da64a1f014 (diff)
Msg_Export: Optimize exporting all history (fixes #609)
Makes export about 10x faster.
Diffstat (limited to 'plugins/Msg_Export/src/options.cpp')
-rwxr-xr-xplugins/Msg_Export/src/options.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp
index dc40c7c1cd..cf55041001 100755
--- a/plugins/Msg_Export/src/options.cpp
+++ b/plugins/Msg_Export/src/options.cpp
@@ -237,11 +237,25 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected)
// events with same time will not be swaped, they will
// remain in there original order
+ // Open/create file for writing
+ wstring sFilePath = FileIterator->first;
+ HANDLE hFile = openCreateFile(sFilePath);
+ if (hFile == INVALID_HANDLE_VALUE) {
+ DisplayErrorDialog(LPGENW("Failed to open or create file :\n"), sFilePath, NULL);
+ continue;
+ }
+
list< CLDBEvent >::const_iterator iterator;
for (iterator = FileIterator->second.begin(); iterator != FileIterator->second.end(); ++iterator) {
MEVENT hDbEvent = (*iterator).hDbEvent;
- nExportEvent((WPARAM)(*iterator).hUser, (LPARAM)hDbEvent);
+ MCONTACT hContact = (*iterator).hUser;
+ if (!bExportEvent(hContact, hDbEvent, hFile, sFilePath))
+ break; // serious error, we should close the file and don't continue with it
}
+
+ // Close the file
+ CloseHandle(hFile);
+
SendMessage(hProg, PBM_SETPOS, ++nCur, 0);
RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
}