summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-08-29 19:28:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-08-29 19:28:47 +0300
commit634ded759c8208a62ea1ce4dd9bb5fa708ff0c33 (patch)
tree3b43e4205996717669737182455a423aeeb27b79
parent7bf8d7b243bb4d667b07c20858a15880b0625cce (diff)
fixes #1555 (Import shouldn't import .bak second time in service mode)
-rw-r--r--include/newpluginapi.h2
-rw-r--r--libs/win32/mir_app.libbin180424 -> 180434 bytes
-rw-r--r--libs/win64/mir_app.libbin175658 -> 175678 bytes
-rw-r--r--plugins/Db3x_mmap/src/init.cpp2
-rw-r--r--plugins/Import/src/main.cpp16
-rw-r--r--src/mir_app/src/newplugins.cpp8
6 files changed, 17 insertions, 11 deletions
diff --git a/include/newpluginapi.h b/include/newpluginapi.h
index d1209ca99b..ca4b95487b 100644
--- a/include/newpluginapi.h
+++ b/include/newpluginapi.h
@@ -56,7 +56,7 @@ __forceinline bool operator!=(const MUUID &p1, const MUUID &p2)
MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int langId);
MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid);
-MIR_APP_DLL(int) SetServiceModePlugin(const wchar_t *wszPluginName);
+MIR_APP_DLL(int) SetServiceModePlugin(const wchar_t *wszPluginName, WPARAM = 0, LPARAM = 0);
/////////////////////////////////////////////////////////////////////////////////////////
// Used to define the end of the MirandaPluginInterface list
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index e048e1bc92..b29369fad2 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 1f50e89955..39f1bc1dea 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
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(&param));
+ WizardDlgParam param = { IDD_PROGRESS, (LPARAM)ProgressPageProc };
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WIZARD), nullptr, WizardDlgProc, LPARAM(&param));
+ }
return SERVICE_CONTINUE;
}
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 876ec44280..6be83b3358 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -578,6 +578,8 @@ int UnloadPlugin(wchar_t* buf, int bufLen)
/////////////////////////////////////////////////////////////////////////////////////////
// Service plugins functions
+static WPARAM g_srvWParam = 0, g_srvLParam = 0;
+
int LaunchServicePlugin(pluginEntry *p)
{
// plugin load failed - terminating Miranda
@@ -589,7 +591,7 @@ int LaunchServicePlugin(pluginEntry *p)
p->bLoaded = true;
}
- INT_PTR res = CallService(MS_SERVICEMODE_LAUNCH, 0, 0);
+ INT_PTR res = CallService(MS_SERVICEMODE_LAUNCH, g_srvWParam, g_srvLParam);
if (res != CALLSERVICE_NOTFOUND)
return res;
@@ -598,7 +600,7 @@ int LaunchServicePlugin(pluginEntry *p)
return SERVICE_FAILED;
}
-MIR_APP_DLL(int) SetServiceModePlugin(const wchar_t *wszPluginName)
+MIR_APP_DLL(int) SetServiceModePlugin(const wchar_t *wszPluginName, WPARAM wParam, LPARAM lParam)
{
size_t cbLen = mir_wstrlen(wszPluginName);
if (cbLen == 0)
@@ -607,6 +609,8 @@ MIR_APP_DLL(int) SetServiceModePlugin(const wchar_t *wszPluginName)
for (auto &p : servicePlugins) {
if (!wcsnicmp(p->pluginname, wszPluginName, cbLen)) {
plugin_service = p;
+ g_srvWParam = wParam;
+ g_srvLParam = lParam;
return 0;
}
}