summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StatusManager/src')
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp1
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp5
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h2
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp8
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.h1
-rw-r--r--plugins/StatusManager/src/KeepStatus/ks_options.cpp1
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_options.cpp1
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_profiles.cpp3
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp2
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp8
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.h2
-rw-r--r--plugins/StatusManager/src/main.cpp28
-rw-r--r--plugins/StatusManager/src/options.cpp49
-rw-r--r--plugins/StatusManager/src/resource.h13
-rw-r--r--plugins/StatusManager/src/stdafx.h28
15 files changed, 138 insertions, 14 deletions
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
index 93204a033d..63971adcdf 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
@@ -513,6 +513,7 @@ int AutoAwayOptInitialise(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 1000000000;
odp.hInstance = hInst;
+ odp.hLangpack = hAAALangpack;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS);
odp.szTitle.a = LPGEN("Auto away");
odp.szGroup.a = LPGEN("Status");
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
index d0eb48801c..b9647816f2 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
@@ -22,6 +22,8 @@
#include "..\stdafx.h"
+int hAAALangpack = 0;
+
#ifdef _DEBUG
#define SECS_PER_MINUTE 20 /* speedup */
#else
@@ -587,6 +589,9 @@ int AAAModuleLoaded(WPARAM, LPARAM)
void AdvancedAutoAwayLoad()
{
+ MUUID muidLast = MIID_LAST;
+ hAAALangpack = GetPluginLangId(muidLast, 0);
+
hAAAModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, AAAModuleLoaded);
hStateChangedEvent = CreateHookableEvent(ME_AAA_STATECHANGED);
}
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
index 70118e0e38..3f3a0b3c02 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
@@ -19,6 +19,8 @@
#ifndef __ADVANCED_AUTOAWAY_HEADER
#define __ADVANCED_AUTOAWAY_HEADER
+extern int hAAALangpack;
+
#define AAAMODULENAME "AdvancedAutoAway"
#define SETTING_IGNLOCK "IgnoreLockKeys"
#define SETTING_IGNSYSKEYS "IgnoreSysKeys"
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index f975b64793..1cc209f0c7 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -19,6 +19,8 @@
#include "..\stdafx.h"
+int hKSLangpack = 0;
+
struct TimerInfo {
int timer;
int timeout;
@@ -1214,6 +1216,9 @@ int KSModuleLoaded(WPARAM, LPARAM)
void KeepStatusLoad()
{
+ MUUID muidLast = MIID_LAST;
+ hKSLangpack = GetPluginLangId(muidLast, 0);
+
hKSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, KSModuleLoaded);
CreateHookableEvent(ME_KS_CONNECTIONEVENT);
@@ -1237,9 +1242,6 @@ void KeepStatusUnload()
DestroyServiceFunction(hIsProtoEnabled);
DestroyServiceFunction(hAnnounceStat);
- if (hMainThread)
- CloseHandle(hMainThread);
-
DestroyHookableEvent(hConnectionEvent);
UnhookEvent(hKSModuleLoadedHook);
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.h b/plugins/StatusManager/src/KeepStatus/keepstatus.h
index 18e13f242c..167bb1a051 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.h
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.h
@@ -20,6 +20,7 @@
#ifndef __KEEPSTATUS_HEADER
#define __KEEPSTATUS_HEADER
+extern int hKSLangpack;
#define KSMODULENAME "KeepStatus"
#define SETTING_CHECKCONNECTION "CheckConnection"
diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp
index 0f321dfd14..1a4d6075b8 100644
--- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp
+++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp
@@ -567,6 +567,7 @@ int KeepStatusOptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
+ odp.hLangpack = hKSLangpack;
odp.szGroup.w = LPGENW("Status");
odp.szTitle.w = LPGENW("Keep status");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
index 644be1f1e6..eaa5566820 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
@@ -905,6 +905,7 @@ int StartupStatusOptionsInit(WPARAM wparam,LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
+ odp.hLangpack = hSSLangpack;
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Startup status");
odp.flags = ODPF_BOLDGROUPS;
diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
index 8abeeaa495..5cb311b605 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
@@ -57,6 +57,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
CMenuItem mi;
mi.position = 2000100000;
mi.flags = CMIF_UNICODE;
+ mi.hLangpack = hSSLangpack;
mcount = 0;
int count = GetProfileCount(0, 0);
for (int i = 0; i < count && mcount < MAX_MMITEMS; i++) {
@@ -65,7 +66,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
continue;
if (db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1) && !mi.root) {
- mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000);
+ mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000, 0, hSSLangpack);
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "1AB30D51-BABA-4B27-9288-1A12278BAD8D");
}
diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
index e9d153670a..db8f6aeb61 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
@@ -41,7 +41,7 @@ void RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM, LPARAM)
{
if (iconList[0].hIcolib == NULL)
- Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
+ Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList), NULL, hSSLangpack);
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index 2af4dc146d..b9bb67d684 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -19,6 +19,8 @@
#include "..\stdafx.h"
+int hSSLangpack = 0;
+
static UINT_PTR setStatusTimerId = 0;
static TSettingsList startupSettings(10, SSCompareSettings);
@@ -488,6 +490,9 @@ HANDLE hSSModuleLoadedHook = NULL,
void StartupStatusLoad()
{
+ MUUID muidLast = MIID_LAST;
+ hSSLangpack = GetPluginLangId(muidLast, 0);
+
hSSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded);
if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) ||
@@ -513,6 +518,9 @@ void StartupStatusLoad()
void StartupStatusUnload()
{
+ KillModuleIcons(hSSLangpack);
+ KillModuleMenus(hSSLangpack);
+
DeinitProfilesModule();
UnloadProfileModule();
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.h b/plugins/StatusManager/src/StartupStatus/startupstatus.h
index 5686e03981..e1ad779103 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.h
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.h
@@ -19,6 +19,8 @@
#ifndef __STARTUPSTATUSHEADER
#define __STARTUPSTATUSHEADER
+extern int hSSLangpack;
+
#define SSMODULENAME "StartupStatus"
struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject
diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp
index 2264b63fb2..12ea42189b 100644
--- a/plugins/StatusManager/src/main.cpp
+++ b/plugins/StatusManager/src/main.cpp
@@ -59,21 +59,41 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
/////////////////////////////////////////////////////////////////////////////////////////
// interfaces
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_AUTOAWAY, MIID_LAST };
+MUUID Interfaces[2] = {0};
+
+MUUID* GetInterfaces(void)
+{
+ if (IsSubPluginEnabled(AAAMODULENAME))
+ Interfaces[0] = MIID_AUTOAWAY;
+ return Interfaces;
+};
+
+extern "C" __declspec(dllexport) MUUID* MirandaInterfaces = GetInterfaces();
/////////////////////////////////////////////////////////////////////////////////////////
// plugin's entry point
+int OnModulesLoaded(WPARAM, LPARAM)
+{
+ HookEvent(ME_OPT_INITIALISE, CSubPluginsOptionsDlg::OnOptionsInit);
+ return 0;
+}
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+
InitCommonStatus();
- KeepStatusLoad();
- StartupStatusLoad();
- AdvancedAutoAwayLoad();
+ if (IsSubPluginEnabled(KSMODULENAME))
+ KeepStatusLoad();
+ if (IsSubPluginEnabled(SSMODULENAME))
+ StartupStatusLoad();
+ if (IsSubPluginEnabled(AAAMODULENAME))
+ AdvancedAutoAwayLoad();
return 0;
}
diff --git a/plugins/StatusManager/src/options.cpp b/plugins/StatusManager/src/options.cpp
new file mode 100644
index 0000000000..b80679a06b
--- /dev/null
+++ b/plugins/StatusManager/src/options.cpp
@@ -0,0 +1,49 @@
+#include "stdafx.h"
+
+CSubPluginsOptionsDlg::CSubPluginsOptionsDlg()
+ : CPluginDlgBase(hInst, IDD_OPT_SUBPLUGINS, MODULENAME),
+ m_enableKeepStatus(this, IDC_ENABLE_KEEPSTATUS),
+ m_enableStartupStatus(this, IDC_ENABLE_STARTUPSTATUS),
+ m_enableAdvancedAutoAway(this, IDC_ENABLE_ADVANCEDAUTOAWAY)
+{
+}
+
+void CSubPluginsOptionsDlg::OnInitDialog()
+{
+ CDlgBase::OnInitDialog();
+
+ wchar_t text[128];
+ mir_snwprintf(text, L"Enable \"%s\" *", L"Keep status");
+ m_enableKeepStatus.SetText(text);
+ m_enableKeepStatus.SetState(IsSubPluginEnabled(KSMODULENAME));
+ mir_snwprintf(text, L"Enable \"%s\" *", L"Startup status");
+ m_enableStartupStatus.SetText(text);
+ m_enableStartupStatus.SetState(IsSubPluginEnabled(SSMODULENAME));
+ mir_snwprintf(text, L"Enable \"%s\" *", L"Advanced auto away");
+ m_enableAdvancedAutoAway.SetText(text);
+ m_enableAdvancedAutoAway.SetState(IsSubPluginEnabled(AAAMODULENAME));
+}
+
+void CSubPluginsOptionsDlg::OnApply()
+{
+ char setting[128];
+ mir_snprintf(setting, "%s_enabled", KSMODULENAME);
+ db_set_b(NULL, MODULENAME, setting, m_enableKeepStatus.GetState());
+ mir_snprintf(setting, "%s_enabled", SSMODULENAME);
+ db_set_b(NULL, MODULENAME, setting, m_enableStartupStatus.GetState());
+ mir_snprintf(setting, "%s_enabled", AAAMODULENAME);
+ db_set_b(NULL, MODULENAME, setting, m_enableAdvancedAutoAway.GetState());
+}
+
+int CSubPluginsOptionsDlg::OnOptionsInit(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.hInstance = hInst;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
+ odp.szTitle.w = LPGENW("Status");
+ odp.szTab.w = LPGENW("Status manager");
+ odp.pDialog = CSubPluginsOptionsDlg::CreateOptionsPage();
+ Options_AddPage(wParam, &odp);
+
+ return 0;
+} \ No newline at end of file
diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h
index f49d2abbd5..c0e9db35e6 100644
--- a/plugins/StatusManager/src/resource.h
+++ b/plugins/StatusManager/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by resource.rc
+// Used by E:\Projects\C++\miranda-ng\plugins\StatusManager\res\resource.rc
//
#define IDD_OPT_KEEPSTATUS 101
#define IDD_OPT_KS_BASIC 101
@@ -11,8 +11,6 @@
#define IDD_OPT_STARTUPSTATUS 110
#define IDD_PUOPT_KEEPSTATUS 113
#define IDD_OPT_AUTOAWAYMSG 114
-#define IDI_TICK 117
-#define IDI_NOTICK 118
#define IDD_OPT_GENAUTOAWAY 119
#define IDD_OPT_KS_ACTION 120
#define IDD_SETSTSMSGDIALOG 121
@@ -22,6 +20,7 @@
#define IDD_OPT_KS_ADV 127
#define IDD_TRG_AAASTATECHANGE 128
#define IDI_TTBDOWN 129
+#define IDD_OPT_SUBPLUGINS 129
#define IDI_TTBUP 130
#define IDC_PROTOCOL 1000
#define IDC_STATUS 1001
@@ -145,6 +144,10 @@
#define IDC_LEAVEFIRST 1136
#define IDC_LEAVESECOND 1137
#define IDC_BECOMEACTIVE 1138
+#define IDC_ENABLE_KEEPSTATUS 1141
+#define IDC_ENABLE_STARTUPSTATUS 1142
+#define IDC_ENABLEADVANCEDAUTOAWAY 1143
+#define IDC_ENABLE_ADVANCEDAUTOAWAY 1143
#define IDC_SCREENSAVE 1145
#define IDC_TIMED 1146
#define IDC_AWAYTIME 1147
@@ -160,9 +163,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1141
+#define _APS_NEXT_CONTROL_VALUE 1144
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h
index 0e481e36ca..fcd8d0d745 100644
--- a/plugins/StatusManager/src/stdafx.h
+++ b/plugins/StatusManager/src/stdafx.h
@@ -21,10 +21,13 @@
#include <m_protocols.h>
#include <m_toptoolbar.h>
#include <m_statusplugins.h>
+#include <m_gui.h>
#include "version.h"
#include "resource.h"
+#define MODULENAME "StatusManager"
+
#include "commonstatus.h"
#include "KeepStatus\keepstatus.h"
#include "StartupStatus\startupstatus.h"
@@ -32,4 +35,29 @@
extern HINSTANCE hInst;
+static BYTE IsSubPluginEnabled(const char* name)
+{
+ char setting[128];
+ mir_snprintf(setting, "%s_enabled", name);
+ return db_get_b(NULL, MODULENAME, setting, 1);
+}
+
+class CSubPluginsOptionsDlg : CPluginDlgBase
+{
+private:
+ CCtrlCheck m_enableKeepStatus;
+ CCtrlCheck m_enableStartupStatus;
+ CCtrlCheck m_enableAdvancedAutoAway;
+
+protected:
+ void OnInitDialog();
+ void OnApply();
+
+public:
+ CSubPluginsOptionsDlg();
+
+ static int OnOptionsInit(WPARAM wParam, LPARAM);
+ static CDlgBase *CreateOptionsPage() { return new CSubPluginsOptionsDlg(); }
+};
+
#endif //_COMMON_H_