diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/StartupSilence/src/StartupSilence.h | 13 | ||||
-rw-r--r-- | plugins/StartupSilence/src/main.cpp | 50 |
2 files changed, 30 insertions, 33 deletions
diff --git a/plugins/StartupSilence/src/StartupSilence.h b/plugins/StartupSilence/src/StartupSilence.h index ae85c86449..af5e65d2c0 100644 --- a/plugins/StartupSilence/src/StartupSilence.h +++ b/plugins/StartupSilence/src/StartupSilence.h @@ -1,4 +1,7 @@ #include <windows.h>
+#include <CommCtrl.h>
+#include <WinSock.h>
+
#include <newpluginapi.h>
#include <m_core.h>
#include <m_clist.h>
@@ -10,16 +13,14 @@ #include <m_options.h>
#include <m_system.h>
#include <m_system_cpp.h>
+#include "win2k.h"
+
#include <m_toptoolbar.h>
+
#include "version.h"
#include "resource.h"
-#include "win2k.h"
-#include "CommCtrl.h"
-#include "WinSock.h"
-#if MIRANDA_VER >= 0x0A00
static INT_PTR AdvSt();
-static INT_PTR initttb();
static INT_PTR InitMenu();
void InitSettings();
void LoadSettings();
@@ -63,5 +64,3 @@ static IconItem iconttbList[] = { {DISABLE_SILENCETTB, DISABLE_SILENCETTB, IDI_SSDISABLETTB},
{ENABLE_SILENCETTB, ENABLE_SILENCETTB, IDI_SSENABLETTB}
};
-#endif
-
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 3fa028d7b1..997f00b8b7 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -31,14 +31,13 @@ HANDLE GetIconHandle(char *szIcon); HANDLE hOptionsInitialize;
HANDLE hTTBarloaded = NULL;
HANDLE Buttons = NULL;
-HANDLE hPopups = NULL;
-static HANDLE hSturtupSilenceEnabled;
-
INT_PTR CALLBACK DlgProcOptions(HWND, UINT, WPARAM, LPARAM);
int InitializeOptions(WPARAM wParam,LPARAM lParam);
int DisablePopup(WPARAM wParam, LPARAM lParam);
+int ModulesLoaded(WPARAM wParam, LPARAM lParam);
static int CreateTTButtons(WPARAM wParam, LPARAM lParam);
void RemoveTTButtons();
+void EnablePopupModule();
BYTE Enabled;
DWORD delay;
BYTE PopUp;
@@ -54,8 +53,6 @@ char PopUpTimeComp[MAX_PATH] = ""; char MenuitemComp[MAX_PATH] = "";
char TTBButtonsComp[MAX_PATH] = "";
-int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-
static LIST<void> ttbButtons(1);
PLUGININFOEX pluginInfo={
@@ -68,7 +65,8 @@ PLUGININFOEX pluginInfo={ __COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
- 0x7b856b6a, 0xd48f, 0x4f54, { 0xb8, 0xd6, 0xc8, 0xd8, 0x6d, 0x2, 0xff, 0xc2 } // {7B856B6A-D48F-4f54-B8D6-C8D86D02FFC2}
+ // {7B856B6A-D48F-4f54-B8D6-C8D86D02FFC2}
+ 0x7b856b6a, 0xd48f, 0x4f54, {0xb8, 0xd6, 0xc8, 0xd8, 0x6d, 0x2, 0xff, 0xc2}
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
@@ -87,9 +85,8 @@ INT_PTR StartupSilence() InitSettings();
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
mir_forkthread((pThreadFunc)AdvSt, NULL);
- hSturtupSilenceEnabled = CreateServiceFunction(SS_SERVICE_NAME, SturtupSilenceEnabled);
+ CreateServiceFunction(SS_SERVICE_NAME, SturtupSilenceEnabled);
IsMenu();
- mir_forkthread((pThreadFunc)initttb, NULL);
HookEvent(ME_OPT_INITIALISE, InitializeOptions);
return 0;
}
@@ -103,18 +100,21 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- UnhookEvent(ME_OPT_INITIALISE);
if (hTTBarloaded != NULL){
- UnhookEvent(ME_TTB_MODULELOADED);
+ UnhookEvent(hTTBarloaded);
}
- UnhookEvent(hPopups);
- DestroyServiceFunction(hSturtupSilenceEnabled);
return 0;
}
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- hPopups = HookEvent(ME_POPUP_FILTER, DisablePopup);
+ HookEvent(ME_POPUP_FILTER, DisablePopup);
+ hTTBarloaded = HookEvent(ME_TTB_MODULELOADED, CreateTTButtons);
+ if (TTBButtons == 1 && hTTBarloaded != NULL) {
+ Icon_Register(hInst, "Toolbar/"MENU_NAME, iconttbList, SIZEOF(iconttbList), MENU_NAME);
+ RemoveTTButtons();
+ CreateTTButtons(0,0);
+ }
return 0;
}
@@ -125,6 +125,16 @@ int DisablePopup(WPARAM wParam, LPARAM lParam) return 0;
}
+void EnablePopupModule()
+{
+ if (ServiceExists(POPUPONOFFPP) && db_get_b(NULL,"Popup", "ModuleIsEnabled", 0) == 0) {
+ CallService(POPUPONOFFPP, NULL, NULL);
+ }
+ if (ServiceExists(POPUPONOFF) && db_get_b(NULL, "YAPP", "Enabled", 0) == 0) {
+ CallService(POPUPONOFF, NULL, NULL);
+ }
+}
+
void InitSettings()
{
if(gethostname(hostname, SIZEOF(hostname)) == 0){
@@ -179,24 +189,13 @@ void IsMenu() }
}
-static INT_PTR initttb()
-{
- Sleep(7000);
- hTTBarloaded = HookEvent(ME_TTB_MODULELOADED, CreateTTButtons);
- if (TTBButtons == 1 && hTTBarloaded != NULL){
- Icon_Register(hInst, "Toolbar/"MENU_NAME, iconttbList, SIZEOF(iconttbList), MENU_NAME);
- RemoveTTButtons();
- CreateTTButtons(0,0);
- }
- return 0;
-}
-
static INT_PTR AdvSt()
{
if ((Enabled == 1)){
POPUPDATAT ppd = {0};
TCHAR * lptzText =L"";
db_set_b(NULL, "Skin", "UseSound", 0);
+ EnablePopupModule();
if (PopUp == 1) {
lptzText = ALL_DISABLED;
@@ -270,7 +269,6 @@ void UpdateTTB() {
if (hTTBarloaded != NULL && TTBButtons == 1)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)Buttons, (Enabled == 1 ? TTBST_RELEASED : TTBST_PUSHED));
-
}
static int CreateTTButtons(WPARAM wParam, LPARAM lParam)
|