From b4794ea974e77df6c8e6e096eaad562b8c3eda07 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 17 Jun 2024 14:17:35 +0300 Subject: =?UTF-8?q?fixes=20#4474=20(Msg=5FExport:=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=83=D1=87?= =?UTF-8?q?=D1=91=D1=82=D0=BD=D0=BE=D0=B9=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D0=B0=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=B0?= =?UTF-8?q?=D0=B3=D0=B0=D0=B5=D1=82=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB,=20=D0=B0=20=D0=BF=D0=BE=D1=82=D0=BE=D0=BC=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Msg_Export/src/utils.cpp | 11 +++++++---- plugins/Msg_Export/src/utils.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 97bae746d1..8544154802 100644 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -184,11 +184,11 @@ int nContactDeleted(WPARAM hContact, LPARAM) if (g_enDeleteAction == eDANothing) return 0; - wstring sFilePath = GetFilePathFromUser(hContact); + wstring sFilePath = GetFilePathFromUser(hContact, true); // Test if there is another user using this file for (auto &hOtherContact : Contacts()) - if (hContact != hOtherContact && sFilePath == GetFilePathFromUser(hOtherContact)) + if (hContact != hOtherContact && sFilePath == GetFilePathFromUser(hOtherContact, true)) return 0; // we found another contact abort mission :-) // Test to see if there is a file to delete @@ -241,8 +241,12 @@ static bool CompareNoExt(const wstring &s1, const wstring &s2) return t1 == t2; } -wstring GetFilePathFromUser(MCONTACT hContact) +wstring GetFilePathFromUser(MCONTACT hContact, bool bIgnoreRename) { + wstring sPrevFileName = _DBGetStringW(hContact, MODULENAME, "PrevFileName", L""); + if (!sPrevFileName.empty() && bIgnoreRename) + return sPrevFileName; + wstring sFilePath = g_sExportDir + _DBGetStringW(hContact, MODULENAME, "FileName", g_sDefaultFile.c_str()); if (g_bUseJson) sFilePath += L".json"; @@ -257,7 +261,6 @@ wstring GetFilePathFromUser(MCONTACT hContact) ReplaceDBPath(sFilePath); // Previous file name check to see if it has changed !! - wstring sPrevFileName = _DBGetStringW(hContact, MODULENAME, "PrevFileName", L""); if (!CompareNoExt(sNoDBPath, sPrevFileName)) { if (!sPrevFileName.empty()) { ReplaceDBPath(sPrevFileName); diff --git a/plugins/Msg_Export/src/utils.h b/plugins/Msg_Export/src/utils.h index 19a31de5b4..c39b0770ae 100644 --- a/plugins/Msg_Export/src/utils.h +++ b/plugins/Msg_Export/src/utils.h @@ -56,7 +56,7 @@ wstring __inline _DBGetStringW(MCONTACT hContact, const char *szModule, const ch void UpdateFileToColWidth(); -wstring GetFilePathFromUser(MCONTACT hContact); +wstring GetFilePathFromUser(MCONTACT hContact, bool bIgnoreRename = false); void ReplaceDefines(MCONTACT hContact, wstring &sTarget); void ReplaceTimeVariables(wstring &sRet); -- cgit v1.2.3