diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-26 19:21:04 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-26 19:21:04 +0300 |
commit | 2e8c5a5366d1b4adb49534630fa8d89d2e77634c (patch) | |
tree | 195cede9c62120bc1c37254e2ddca6df5d83c0dc /plugins/Msg_Export/src | |
parent | be005fdd7a3a801ec698dc211cd2e0dd80030fb6 (diff) |
MsgExport: support for offline files
Diffstat (limited to 'plugins/Msg_Export/src')
-rw-r--r-- | plugins/Msg_Export/src/utils.cpp | 47 | ||||
-rw-r--r-- | plugins/Msg_Export/src/version.h | 2 |
2 files changed, 40 insertions, 9 deletions
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index ba97c46228..58653db8ba 100644 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -622,13 +622,6 @@ const char *pSettings[] = LPGEN("About")
};
-static wchar_t* getEventString(DBEVENTINFO &dbei, char *&buf)
-{
- char *in = buf;
- buf += mir_strlen(buf) + 1;
- return (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(in) : mir_a2u(in);
-}
-
static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sFilePath, DB::EventInfo &dbei, bool bAppendOnly)
{
wstring sLocalUser;
@@ -776,6 +769,9 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF flags += "m";
if (dbei.flags & DBEF_READ)
flags += "r";
+ if (dbei.flags & DBEF_BOOKMARK)
+ flags += "b";
+
pRoot.push_back(JSONNode("flags", flags));
if (dbei.eventType == EVENTTYPE_FILE) {
@@ -784,6 +780,13 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF pRoot << WCHAR_PARAM("file", blob.getName());
if (mir_wstrlen(blob.getDescr()))
pRoot << WCHAR_PARAM("descr", blob.getDescr());
+ if (blob.isOffline()) {
+ pRoot << INT_PARAM("offline", 1) << INT_PARAM("fileSize", blob.getSize()) << INT_PARAM("transferred", blob.getTransferred());
+ if (mir_wstrlen(blob.getLocalName()))
+ pRoot << WCHAR_PARAM("localFile", blob.getLocalName());
+ if (mir_strlen(blob.getUrl()))
+ pRoot << CHAR_PARAM("url", blob.getUrl());
+ }
}
else {
ptrW msg(DbEvent_GetTextW(&dbei, CP_ACP));
@@ -833,6 +836,34 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF bWriteTextToFile(hFile, LPGENW("Description: "), bWriteUTF8Format);
bWriteIndentedToFile(hFile, nIndent, blob.getDescr(), bWriteUTF8Format);
}
+
+ if (blob.isOffline()) {
+ bWriteNewLine(hFile, nIndent);
+ bWriteTextToFile(hFile, LPGENW("Offline: "), bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, L"1", bWriteUTF8Format);
+
+ CMStringW val(FORMAT, L"%d", blob.getSize());
+ bWriteNewLine(hFile, nIndent);
+ bWriteTextToFile(hFile, LPGENW("Size: "), bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, val, bWriteUTF8Format);
+
+ val.Format(L"%d", blob.getTransferred());
+ bWriteNewLine(hFile, nIndent);
+ bWriteTextToFile(hFile, LPGENW("Transferred: "), bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, val, bWriteUTF8Format);
+
+ if (mir_wstrlen(blob.getLocalName())) {
+ bWriteNewLine(hFile, nIndent);
+ bWriteTextToFile(hFile, LPGENW("Path: "), bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, blob.getLocalName(), bWriteUTF8Format);
+ }
+
+ if (mir_strlen(blob.getUrl())) {
+ bWriteNewLine(hFile, nIndent);
+ bWriteTextToFile(hFile, LPGENW("URL: "), bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, _A2T(blob.getUrl()), bWriteUTF8Format);
+ }
+ }
}
break;
@@ -959,7 +990,7 @@ int nExportEvent(WPARAM hContact, LPARAM hDbEvent) }
// Write the event
- bExportEvent((MCONTACT)hContact, (MEVENT)hDbEvent, hFile, sFilePath, false);
+ bExportEvent(hContact, hDbEvent, hFile, sFilePath, false);
// Close the file
CloseHandle(hFile);
diff --git a/plugins/Msg_Export/src/version.h b/plugins/Msg_Export/src/version.h index 85d9f8cfe4..adcda2f13a 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 8
+#define __BUILD_NUM 9
#include <stdver.h>
|