diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-29 14:54:24 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-29 14:54:30 +0300 |
commit | fe0ce0abd68bed541735f3519a52a802bb87ca0a (patch) | |
tree | c9d0e2adb21a15d9707489e300b0a24855d44e5a /plugins/StatusManager/src/main.cpp | |
parent | 6e8defa9cc46283eb1e8f53ed24f80b05abc5e01 (diff) |
StatusManager:
- all protocol data really merged together;
- duplicated settings arrays removed;
- stupid protoList removed;
- fixed #1119;
- version bump
Diffstat (limited to 'plugins/StatusManager/src/main.cpp')
-rw-r--r-- | plugins/StatusManager/src/main.cpp | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp index 599e3d54ae..478112b6af 100644 --- a/plugins/StatusManager/src/main.cpp +++ b/plugins/StatusManager/src/main.cpp @@ -63,7 +63,7 @@ MUUID miidAutoAway = MIID_AUTOAWAY; MUUID* GetInterfaces(void) { - if (IsSubPluginEnabled(AAAMODULENAME)) + if (g_AAAEnabled) Interfaces[0] = miidAutoAway; return Interfaces; }; @@ -78,7 +78,40 @@ bool g_bMirandaLoaded = false; int OnModulesLoaded(WPARAM, LPARAM) { g_bMirandaLoaded = true; - HookEvent(ME_OPT_INITIALISE, CSubPluginsOptionsDlg::OnOptionsInit); + + HookEvent(ME_OPT_INITIALISE, OnCommonOptionsInit); + + //////////////////////////////////////////////////////////////////////////////////////// + + int count; + PROTOACCOUNT** protos; + Proto_EnumAccounts(&count, &protos); + + for (int i = 0; i < count; i++) + if (IsSuitableProto(protos[i])) + protoList.insert(new SMProto(protos[i])); + + return 0; +} + +int OnAccChanged(WPARAM wParam, LPARAM lParam) +{ + PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam; + switch (wParam) { + case PRAC_ADDED: + protoList.insert(new SMProto(pa)); + break; + + case PRAC_REMOVED: + for (int i = 0; i < protoList.getCount(); i++) { + if (!mir_strcmp(protoList[i].m_szName, pa->szModuleName)) { + protoList.remove(i); + break; + } + } + break; + } + return 0; } @@ -88,15 +121,17 @@ extern "C" int __declspec(dllexport) Load(void) pcli = Clist_GetInterface(); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged); InitCommonStatus(); + InitCommonOptions(); - if (IsSubPluginEnabled(KSMODULENAME)) + if (g_AAAEnabled) + AdvancedAutoAwayLoad(); + if (g_KSEnabled) KeepStatusLoad(); - if (IsSubPluginEnabled(SSMODULENAME)) + if (g_SSEnabled) StartupStatusLoad(); - if (IsSubPluginEnabled(AAAMODULENAME)) - AdvancedAutoAwayLoad(); return 0; } @@ -105,11 +140,11 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - if (IsSubPluginEnabled(KSMODULENAME)) + if (g_KSEnabled) KeepStatusUnload(); - if (IsSubPluginEnabled(SSMODULENAME)) + if (g_SSEnabled) StartupStatusUnload(); - if (IsSubPluginEnabled(AAAMODULENAME)) + if (g_AAAEnabled) AdvancedAutoAwayUnload(); return 0; } |