summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-01-29 06:47:37 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-01-29 06:47:37 +0000
commit4a38e2b5de9f41f8bb3fa74457f98b2b69b9d56c (patch)
tree16f6eb44c346276721a92d257a7f9fc3779e1d5e
parent55d1905cffff485f577d49654a18362cbcfb61ec (diff)
added ability to restart with current profile
git-svn-id: http://svn.miranda-ng.org/main/trunk@3328 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/delphi/m_system.inc3
-rw-r--r--include/m_system.h3
-rw-r--r--plugins/Actman/services.ini4
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp3
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp11
-rw-r--r--plugins/ProfileManager/src/pmanagerEx.cpp11
-rw-r--r--plugins/Restart/src/restart.cpp11
-rw-r--r--src/modules/plugins/pluginopts.cpp2
-rw-r--r--src/modules/utils/utils.cpp13
9 files changed, 20 insertions, 41 deletions
diff --git a/include/delphi/m_system.inc b/include/delphi/m_system.inc
index 45f1fc818e..a59723bc05 100644
--- a/include/delphi/m_system.inc
+++ b/include/delphi/m_system.inc
@@ -56,7 +56,8 @@ const
ME_SYSTEM_SHUTDOWN:PAnsiChar = 'Miranda/System/Shutdown';
{ restarts miranda ( 0.8+ )
- wParam=lParam=0
+ wParam=0 or 1. 1 - restart with current profile, 0 - restart in default profile or profile manager
+ lParam=0
}
MS_SYSTEM_RESTART:PAnsiChar = 'Miranda/System/Restart';
diff --git a/include/m_system.h b/include/m_system.h
index 4347c7a962..75638261a5 100644
--- a/include/m_system.h
+++ b/include/m_system.h
@@ -66,7 +66,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ME_SYSTEM_SHUTDOWN "Miranda/System/Shutdown"
//restarts miranda (0.8+)
-//wParam = lParam = 0
+//wParam = 0 or 1. 1 - restart with current profile, 0 - restart in default profile or profile manager
+//lParam = 0
#define MS_SYSTEM_RESTART "Miranda/System/Restart"
//miranda/system/oktoexit event
diff --git a/plugins/Actman/services.ini b/plugins/Actman/services.ini
index 1de3148fdd..7806525e81 100644
--- a/plugins/Actman/services.ini
+++ b/plugins/Actman/services.ini
@@ -189,9 +189,9 @@ descr=Locks & hides Miranda's contact list and message sessions until password i
[Service:Miranda/System/Restart]
alias=MS_SYSTEM_RESTART
-wparam=0
+wparam=0 or 1. 1 - restart with current profile, 0 - restart in default profile or profile manager
lparam=0
-descr=Restarts Miranda (try to use together with CloseAction service) ver.0.8+
+descr=Restarts Miranda ver.0.8+
[Service:mRadio/PlayStop]
alias=MS_RADIO_PLAYSTOP
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index fef2ebb9f1..2e7f8ba142 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -159,8 +159,7 @@ VOID __stdcall ExitMe(void*)
VOID __stdcall RestartMe(void*)
{
- CallService("CloseAction", 0, 0);
- CallService(MS_SYSTEM_RESTART, 0, 0);
+ CallService(MS_SYSTEM_RESTART, 1, 0);
}
BOOL Exists(LPCTSTR strName)
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index facbf0b9d1..54702c5c27 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -170,16 +170,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
void __stdcall RestartMe(void*)
{
- TCHAR mirandaPath[MAX_PATH], cmdLine[100];
- PROCESS_INFORMATION pi;
- STARTUPINFO si = {0};
- si.cb = sizeof(si);
- GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
- TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), profilename);
- CallService("CloseAction", 0, 0);
- CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- mir_free(profilename);
+ CallService(MS_SYSTEM_RESTART, 1, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp
index 6383a3d03a..b4e9a20329 100644
--- a/plugins/ProfileManager/src/pmanagerEx.cpp
+++ b/plugins/ProfileManager/src/pmanagerEx.cpp
@@ -85,16 +85,7 @@ static INT_PTR CheckDb(WPARAM wParam, LPARAM lParam)
static INT_PTR RestartMe(WPARAM wParam, LPARAM lParam)
{
- TCHAR mirandaPath[MAX_PATH], cmdLine[100];
- PROCESS_INFORMATION pi;
- STARTUPINFO si = {0};
- si.cb = sizeof(si);
- GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
- TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), profilename);
- CallService("CloseAction", 0, 0);
- CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- mir_free(profilename);
+ CallService(MS_SYSTEM_RESTART, 1, 0);
return 0;
}
diff --git a/plugins/Restart/src/restart.cpp b/plugins/Restart/src/restart.cpp
index ce1fd383d0..cd323a5d50 100644
--- a/plugins/Restart/src/restart.cpp
+++ b/plugins/Restart/src/restart.cpp
@@ -40,16 +40,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
static INT_PTR RestartMe(WPARAM wParam, LPARAM lParam)
{
- TCHAR mirandaPath[MAX_PATH], cmdLine[100];
- PROCESS_INFORMATION pi;
- STARTUPINFO si = {0};
- si.cb = sizeof(si);
- GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
- TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), profilename);
- CallService("CloseAction", 0, 0);
- CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- mir_free(profilename);
+ CallService(MS_SYSTEM_RESTART, 1, 0);
return 0;
}
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp
index 3a0e5b7163..fc011535c5 100644
--- a/src/modules/plugins/pluginopts.cpp
+++ b/src/modules/plugins/pluginopts.cpp
@@ -441,7 +441,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (needRestart) {
mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T("\n%s"), TranslateT("Do you want to restart it now?"));
if (MessageBox(NULL, bufRestart, _T("Miranda NG"), MB_ICONWARNING | MB_YESNO) == IDYES)
- CallService(MS_SYSTEM_RESTART, 0, 0);
+ CallService(MS_SYSTEM_RESTART, 1, 0);
}
}
}
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp
index a672074ed7..4f165bbd6c 100644
--- a/src/modules/utils/utils.cpp
+++ b/src/modules/utils/utils.cpp
@@ -420,14 +420,19 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam)
}
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR RestartMiranda(WPARAM, LPARAM)
+static INT_PTR RestartMiranda(WPARAM wParam, LPARAM)
{
- TCHAR mirandaPath[ MAX_PATH ], cmdLine[ 100 ];
+ TCHAR mirandaPath[MAX_PATH], cmdLine[100];
PROCESS_INFORMATION pi;
- STARTUPINFO si = { 0 };
+ STARTUPINFO si = {0};
si.cb = sizeof(si);
GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId());
+ if (wParam) {
+ TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d /profile=%s"), mirandaPath, GetCurrentProcessId(), profilename);
+ mir_free(profilename);
+ } else
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("\"%s\" /restart:%d"), mirandaPath, GetCurrentProcessId());
CallService("CloseAction", 0, 0);
CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
return 0;