summaryrefslogtreecommitdiff
path: root/plugins/Msg_Export/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-11 17:07:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-11 17:07:04 +0300
commit8f9292d483fcf3a10d9284512359c4562f5311eb (patch)
tree3593ca1eb6a5a4c3b2ef454fa6b4944d4b8da8c4 /plugins/Msg_Export/src
parent5f4f070347d20fc85b588138217aa744141e8053 (diff)
DB::FILE_BLOB - file events' access unification
Diffstat (limited to 'plugins/Msg_Export/src')
-rw-r--r--plugins/Msg_Export/src/utils.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp
index 6efee874e7..ba97c46228 100644
--- a/plugins/Msg_Export/src/utils.cpp
+++ b/plugins/Msg_Export/src/utils.cpp
@@ -629,7 +629,7 @@ static wchar_t* getEventString(DBEVENTINFO &dbei, char *&buf)
return (dbei.flags & DBEF_UTF) ? mir_utf8decodeW(in) : mir_a2u(in);
}
-static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sFilePath, DBEVENTINFO &dbei, bool bAppendOnly)
+static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sFilePath, DB::EventInfo &dbei, bool bAppendOnly)
{
wstring sLocalUser;
wstring sRemoteUser;
@@ -779,13 +779,11 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF
pRoot.push_back(JSONNode("flags", flags));
if (dbei.eventType == EVENTTYPE_FILE) {
- char *p = (char*)dbei.pBlob + sizeof(uint32_t);
- ptrW wszFileName(getEventString(dbei, p));
- ptrW wszDescr(getEventString(dbei, p));
+ DB::FILE_BLOB blob(dbei);
- pRoot << WCHAR_PARAM("file", wszFileName);
- if (mir_wstrlen(wszDescr))
- pRoot << WCHAR_PARAM("descr", wszDescr);
+ pRoot << WCHAR_PARAM("file", blob.getName());
+ if (mir_wstrlen(blob.getDescr()))
+ pRoot << WCHAR_PARAM("descr", blob.getDescr());
}
else {
ptrW msg(DbEvent_GetTextW(&dbei, CP_ACP));
@@ -824,18 +822,16 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF
case EVENTTYPE_FILE:
{
- char *p = (char*)dbei.pBlob + sizeof(uint32_t);
- ptrW wszFileName(getEventString(dbei, p));
- ptrW wszDescr(getEventString(dbei, p));
+ DB::FILE_BLOB blob(dbei);
const wchar_t *pszType = LPGENW("File: ");
bWriteTextToFile(hFile, pszType, bWriteUTF8Format);
- bWriteIndentedToFile(hFile, nIndent, wszFileName, bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, blob.getName(), bWriteUTF8Format);
- if (mir_wstrlen(wszDescr)) {
+ if (mir_wstrlen(blob.getDescr())) {
bWriteNewLine(hFile, nIndent);
bWriteTextToFile(hFile, LPGENW("Description: "), bWriteUTF8Format);
- bWriteIndentedToFile(hFile, nIndent, wszDescr, bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, blob.getDescr(), bWriteUTF8Format);
}
}
break;