From 3ad2582c4a4a6378f294f9256ecbcbdf0ae88e3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 3 May 2018 16:02:14 +0200 Subject: mir_forkThread - stronger typizatioin for thread function parameter --- plugins/StartupSilence/src/main.cpp | 79 ++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 40 deletions(-) (limited to 'plugins/StartupSilence/src/main.cpp') diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 4c525f867d..5bb39c8103 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -86,11 +86,49 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfo; } +static void __cdecl AdvSt(void*) +{ + Thread_SetName("StartupSilenc: AdvSt"); + + if ((Enabled == 1)) { + POPUPDATAT ppd = { 0 }; + wchar_t *lptzText = L""; + db_set_b(NULL, "Skin", "UseSound", 0); + EnablePopupModule(); + + if (PopUp == 1) { + lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED; + ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); + ppd.lchContact = NULL; + ppd.iSeconds = PopUpTime; + wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); + lptzText = TranslateW(MENU_NAMEW); + wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE); + PUAddPopupT(&ppd); + } + + timer = 2; + Sleep(delay * 1000); + timer = 0; + + if (PopUp == 1) { + lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED; + ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); + wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); + PUAddPopupT(&ppd); + } + if (DefEnabled == 1) { //predefined sound setting + db_set_b(NULL, "Skin", "UseSound", DefSound); + } + else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts + } +} + INT_PTR StartupSilence() { InitSettings(); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - mir_forkthread((pThreadFunc)AdvSt, nullptr); + mir_forkthread((pThreadFunc)AdvSt); CreateServiceFunction(SS_SERVICE_NAME, StartupSilenceEnabled); CreateServiceFunction(SS_SILENCE_CONNECTION, SilenceConnection); IsMenu(); @@ -220,45 +258,6 @@ void IsMenu() } } -static INT_PTR AdvSt() -{ - Thread_SetName("StartupSilenc: AdvSt"); - - if ((Enabled == 1)) { - POPUPDATAT ppd = {0}; - wchar_t * lptzText =L""; - db_set_b(NULL, "Skin", "UseSound", 0); - EnablePopupModule(); - - if (PopUp == 1) { - lptzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED; - ppd.lchIcon = IcoLib_GetIconByHandle((NonStatusAllow == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); - ppd.lchContact = NULL; - ppd.iSeconds = PopUpTime; - wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); - lptzText = TranslateW(MENU_NAMEW); - wcsncpy_s(ppd.lptzContactName, lptzText, _TRUNCATE); - PUAddPopupT(&ppd); - } - - timer = 2; - Sleep(delay * 1000); - timer = 0; - - if (PopUp == 1) { - lptzText = (DefEnabled == 1 && DefPopup == 1) ? TranslateT(ALL_ENABLED_FLT) : ALL_ENABLED; - ppd.lchIcon = IcoLib_GetIconByHandle((DefEnabled == 1 && DefPopup == 1) ? GetIconHandle(ALL_ENABLED_FLT) : GetIconHandle(MENU_NAME)); - wcsncpy_s(ppd.lptzText, lptzText, _TRUNCATE); - PUAddPopupT(&ppd); - } - if (DefEnabled == 1) { //predefined sound setting - db_set_b(NULL, "Skin", "UseSound", DefSound); - } - else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts - } - return 0; -} - INT_PTR StartupSilenceEnabled(WPARAM, LPARAM) { db_set_b(NULL, MODULE_NAME, EnabledComp, !Enabled); -- cgit v1.2.3