summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/StatusManager/src/aaa_main.cpp4
-rw-r--r--plugins/StatusManager/src/commonstatus.cpp2
-rw-r--r--plugins/StatusManager/src/ks_main.cpp4
-rw-r--r--plugins/StatusManager/src/main.cpp28
-rw-r--r--plugins/StatusManager/src/ss_main.cpp14
-rw-r--r--plugins/StatusManager/src/startupstatus.h2
-rw-r--r--plugins/StatusManager/src/stdafx.h4
-rw-r--r--plugins/StatusManager/src/version.h2
8 files changed, 46 insertions, 14 deletions
diff --git a/plugins/StatusManager/src/aaa_main.cpp b/plugins/StatusManager/src/aaa_main.cpp
index aa630ccb36..49ee3e5444 100644
--- a/plugins/StatusManager/src/aaa_main.cpp
+++ b/plugins/StatusManager/src/aaa_main.cpp
@@ -519,7 +519,7 @@ void AdvancedAutoAwayLoad()
{
g_bAAASettingSame = AAAPlugin.getByte(SETTING_SAMESETTINGS);
- if (g_bMirandaLoaded)
+ if (g_plugin.bMirandaLoaded)
AAAModuleLoaded(0, 0);
else
HookEvent(ME_SYSTEM_MODULESLOADED, AAAModuleLoaded);
@@ -527,7 +527,7 @@ void AdvancedAutoAwayLoad()
void AdvancedAutoAwayUnload()
{
- if (g_bMirandaLoaded)
+ if (g_plugin.bMirandaLoaded)
AutoAwayShutdown(0, 0);
KillModuleOptions(&AAAPlugin);
diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp
index da4fbf2163..a50b1917fa 100644
--- a/plugins/StatusManager/src/commonstatus.cpp
+++ b/plugins/StatusManager/src/commonstatus.cpp
@@ -304,7 +304,7 @@ bool IsSuitableProto(PROTOACCOUNT *pa)
static int onShutdown(WPARAM, LPARAM)
{
- g_bMirandaLoaded = false;
+ g_plugin.bMirandaLoaded = false;
DestroyHookableEvent(hCSStatusChangedExEvent);
return 0;
}
diff --git a/plugins/StatusManager/src/ks_main.cpp b/plugins/StatusManager/src/ks_main.cpp
index 758b2d090a..0772dc3cb9 100644
--- a/plugins/StatusManager/src/ks_main.cpp
+++ b/plugins/StatusManager/src/ks_main.cpp
@@ -1066,7 +1066,7 @@ int KSModuleLoaded(WPARAM, LPARAM)
void KeepStatusLoad()
{
- if (g_bMirandaLoaded)
+ if (g_plugin.bMirandaLoaded)
KSModuleLoaded(0, 0);
else
HookEvent(ME_SYSTEM_MODULESLOADED, KSModuleLoaded);
@@ -1081,7 +1081,7 @@ void KeepStatusLoad()
void KeepStatusUnload()
{
- if (g_bMirandaLoaded)
+ if (g_plugin.bMirandaLoaded)
onShutdown(0, 0);
KillModuleOptions(&KSPlugin);
diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp
index 597d155589..4cc0c881d8 100644
--- a/plugins/StatusManager/src/main.cpp
+++ b/plugins/StatusManager/src/main.cpp
@@ -60,11 +60,9 @@ extern "C" __declspec(dllexport) MUUID* MirandaPluginInterfaces(void)
/////////////////////////////////////////////////////////////////////////////////////////
// plugin's entry point
-bool g_bMirandaLoaded = false;
-
int OnModulesLoaded(WPARAM, LPARAM)
{
- g_bMirandaLoaded = true;
+ g_plugin.bMirandaLoaded = true;
HookEvent(ME_OPT_INITIALISE, OnCommonOptionsInit);
@@ -79,8 +77,30 @@ int OnAccChanged(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
switch (wParam) {
+ case PRAC_CHECKED:
+ {
+ bool bFound = false, bEnabled = pa->IsEnabled();
+ for (auto &it : protoList) {
+ if (!mir_strcmp(it->m_szName, pa->szModuleName)) {
+ it->ssDisabled = !bEnabled;
+ if (g_SSEnabled && bEnabled)
+ SS_LoadDynamic(it);
+ bFound = true;
+ break;
+ }
+ }
+ if (bFound || !bEnabled)
+ break;
+ }
+ __fallthrough;
+
case PRAC_ADDED:
- protoList.insert(new SMProto(pa));
+ {
+ auto *setting = new SMProto(pa);
+ protoList.insert(setting);
+ if (g_SSEnabled)
+ SS_LoadDynamic(setting);
+ }
break;
case PRAC_REMOVED:
diff --git a/plugins/StatusManager/src/ss_main.cpp b/plugins/StatusManager/src/ss_main.cpp
index 9b586ebece..de60dd4e05 100644
--- a/plugins/StatusManager/src/ss_main.cpp
+++ b/plugins/StatusManager/src/ss_main.cpp
@@ -123,6 +123,16 @@ static void SetLastStatusMessages(TProtoSettings &ps)
}
}
+void SS_LoadDynamic(SMProto *setting)
+{
+ if (!SSPlugin.getByte(SETTING_SETPROFILE, 1))
+ return;
+
+ TProtoSettings ps;
+ ps.insert(new SMProto(*setting));
+ SetStatusEx(ps);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Account control event
@@ -409,7 +419,7 @@ static INT_PTR SrvGetProfile(WPARAM wParam, LPARAM lParam)
void StartupStatusLoad()
{
- if (g_bMirandaLoaded)
+ if (g_plugin.bMirandaLoaded)
SSModuleLoaded(0, 0);
else
HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded);
@@ -436,7 +446,7 @@ void StartupStatusLoad()
void StartupStatusUnload()
{
- if (g_bMirandaLoaded)
+ if (g_plugin.bMirandaLoaded)
OnShutdown(0, 0);
KillModuleOptions(&SSPlugin);
diff --git a/plugins/StatusManager/src/startupstatus.h b/plugins/StatusManager/src/startupstatus.h
index 9275ca5187..12a8f7900b 100644
--- a/plugins/StatusManager/src/startupstatus.h
+++ b/plugins/StatusManager/src/startupstatus.h
@@ -112,6 +112,8 @@ char* OptName(int i, const char *setting);
void StartupStatusLoad();
void StartupStatusUnload();
+void SS_LoadDynamic(SMProto *);
+
// profile
void FillStatus(SMProto &ps, int profile);
int GetProfile(int profileID, TProtoSettings &arSettings);
diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h
index 5594382334..52fdc095df 100644
--- a/plugins/StatusManager/src/stdafx.h
+++ b/plugins/StatusManager/src/stdafx.h
@@ -41,6 +41,8 @@ struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin();
+ bool bMirandaLoaded;
+
int Load() override;
int Unload() override;
};
@@ -50,13 +52,11 @@ struct CFakePlugin : public CMPluginBase
CFakePlugin(const char *szModuleName);
};
-
#include "commonstatus.h"
#include "keepstatus.h"
#include "startupstatus.h"
#include "advancedautoaway.h"
-extern bool g_bMirandaLoaded;
extern CFakePlugin AAAPlugin, KSPlugin, SSPlugin;
extern CMOption<bool> g_AAAEnabled, g_KSEnabled, g_SSEnabled;
diff --git a/plugins/StatusManager/src/version.h b/plugins/StatusManager/src/version.h
index 96f841130e..c96d924791 100644
--- a/plugins/StatusManager/src/version.h
+++ b/plugins/StatusManager/src/version.h
@@ -2,7 +2,7 @@
#define __MAJOR_VERSION 1
#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 5
+#define __BUILD_NUM 6
// other stuff for Version resource
#include <stdver.h>