From 634ded759c8208a62ea1ce4dd9bb5fa708ff0c33 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 29 Aug 2018 19:28:37 +0300 Subject: fixes #1555 (Import shouldn't import .bak second time in service mode) --- plugins/Db3x_mmap/src/init.cpp | 2 +- plugins/Import/src/main.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp index cb7f239a05..473c997b2c 100644 --- a/plugins/Db3x_mmap/src/init.cpp +++ b/plugins/Db3x_mmap/src/init.cpp @@ -105,7 +105,7 @@ LBL_Error: return nullptr; } - if (SetServiceModePlugin(L"import") != ERROR_SUCCESS) { + if (SetServiceModePlugin(L"import", 1) != ERROR_SUCCESS) { if (IDYES == MessageBoxW(nullptr, TranslateT(MISSING_PLUG_MSG), L"Miranda NG", MB_YESNO)) Utils_OpenUrl("https://miranda-ng.org/p/Import"); goto LBL_Error; diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 0cf5f42e70..108ce1cee8 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -91,17 +91,19 @@ static int OnExit(WPARAM, LPARAM) return 0; } -static INT_PTR ServiceMode(WPARAM, LPARAM) +static INT_PTR ServiceMode(WPARAM wParam, LPARAM) { g_bServiceMode = true; - ptrW wszFullName(Utils_ReplaceVarsW(L"%miranda_userdata%\\%miranda_profilename%.dat.bak")); - if (!_waccess(wszFullName, 0)) { - g_iImportOptions = IOPT_ADDUNKNOWN + IOPT_COMPLETE + IOPT_CHECKDUPS; - wcsncpy_s(importFile, MAX_PATH, wszFullName, _TRUNCATE); + if (wParam == 1) { + ptrW wszFullName(Utils_ReplaceVarsW(L"%miranda_userdata%\\%miranda_profilename%.dat.bak")); + if (!_waccess(wszFullName, 0)) { + g_iImportOptions = IOPT_ADDUNKNOWN + IOPT_COMPLETE + IOPT_CHECKDUPS; + wcsncpy_s(importFile, MAX_PATH, wszFullName, _TRUNCATE); - WizardDlgParam param = { IDD_PROGRESS, (LPARAM)ProgressPageProc }; - DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(¶m)); + WizardDlgParam param = { IDD_PROGRESS, (LPARAM)ProgressPageProc }; + DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(¶m)); + } return SERVICE_CONTINUE; } -- cgit v1.2.3