diff options
Diffstat (limited to 'plugins/StatusManager')
-rw-r--r-- | plugins/StatusManager/StatusManager.vcxproj | 5 | ||||
-rw-r--r-- | plugins/StatusManager/StatusManager.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/StatusManager/res/resource.rc | 26 | ||||
-rw-r--r-- | plugins/StatusManager/src/aaa_main.cpp | 2 | ||||
-rw-r--r-- | plugins/StatusManager/src/aaa_options.cpp | 4 | ||||
-rw-r--r-- | plugins/StatusManager/src/commonstatus.cpp | 22 | ||||
-rw-r--r-- | plugins/StatusManager/src/commonstatus.h | 1 | ||||
-rw-r--r-- | plugins/StatusManager/src/confirmdialog.cpp | 4 | ||||
-rw-r--r-- | plugins/StatusManager/src/ks_main.cpp | 29 | ||||
-rw-r--r-- | plugins/StatusManager/src/resource.h | 2 | ||||
-rw-r--r-- | plugins/StatusManager/src/ss_main.cpp | 45 | ||||
-rw-r--r-- | plugins/StatusManager/src/ss_options.cpp | 58 | ||||
-rw-r--r-- | plugins/StatusManager/src/startupstatus.h | 7 | ||||
-rw-r--r-- | plugins/StatusManager/src/stdafx.cxx | 2 | ||||
-rw-r--r-- | plugins/StatusManager/src/version.h | 4 |
15 files changed, 81 insertions, 133 deletions
diff --git a/plugins/StatusManager/StatusManager.vcxproj b/plugins/StatusManager/StatusManager.vcxproj index 5ae7ba06e5..5e56395372 100644 --- a/plugins/StatusManager/StatusManager.vcxproj +++ b/plugins/StatusManager/StatusManager.vcxproj @@ -52,11 +52,6 @@ <None Include="res\ttbUp.ico" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\helpers\gen_helpers.cpp"> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - </ClCompile> - </ItemGroup> - <ItemGroup> <ResourceCompile Include="res\resource.rc" /> <ResourceCompile Include="res\version.rc" /> </ItemGroup> diff --git a/plugins/StatusManager/StatusManager.vcxproj.filters b/plugins/StatusManager/StatusManager.vcxproj.filters index d077f7ec80..c5ef5304a6 100644 --- a/plugins/StatusManager/StatusManager.vcxproj.filters +++ b/plugins/StatusManager/StatusManager.vcxproj.filters @@ -41,9 +41,6 @@ <ClCompile Include="src\stdafx.cxx"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\helpers\gen_helpers.cpp"> - <Filter>Source Files</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="src\advancedautoaway.h"> diff --git a/plugins/StatusManager/res/resource.rc b/plugins/StatusManager/res/resource.rc index 415d618f52..493862193a 100644 --- a/plugins/StatusManager/res/resource.rc +++ b/plugins/StatusManager/res/resource.rc @@ -209,21 +209,19 @@ BEGIN GROUPBOX "Window on startup",IDC_STATIC,194,7,104,209 CONTROL "Set window state",IDC_SETWINSTATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,22,80,10 COMBOBOX IDC_WINSTATE,209,34,80,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Set docked",IDC_SETDOCKED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,52,80,10 - COMBOBOX IDC_DOCKED,209,64,80,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Set window location",IDC_SETWINLOCATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,82,80,10 - LTEXT "Left",IDC_STATIC,214,97,35,8 - EDITTEXT IDC_XPOS,259,94,30,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Top",IDC_STATIC,214,113,35,8 - EDITTEXT IDC_YPOS,259,110,30,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "",IDC_CURWINLOC,209,128,80,8 - CONTROL "Set window size",IDC_SETWINSIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,140,80,10 - LTEXT "Width",IDC_STATIC,214,155,35,8 - EDITTEXT IDC_WIDTH,259,152,30,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Set window location",IDC_SETWINLOCATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,59,80,10 + LTEXT "Left",IDC_STATIC,214,74,35,8 + EDITTEXT IDC_XPOS,259,71,30,14,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Top",IDC_STATIC,214,90,35,8 + EDITTEXT IDC_YPOS,259,87,30,14,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "",IDC_CURWINLOC,209,105,80,8 + CONTROL "Set window size",IDC_SETWINSIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,209,117,80,10 + LTEXT "Width",IDC_STATIC,214,132,35,8 + EDITTEXT IDC_WIDTH,259,129,30,14,ES_AUTOHSCROLL | ES_NUMBER PUSHBUTTON "Show CMDL",IDC_SHOWCMDL,14,194,53,14 - LTEXT "Height",IDC_STATIC,214,171,35,8 - EDITTEXT IDC_HEIGHT,259,168,30,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "",IDC_CURWINSIZE,209,186,80,8 + LTEXT "Height",IDC_STATIC,214,148,35,8 + EDITTEXT IDC_HEIGHT,259,145,30,14,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "",IDC_CURWINSIZE,209,163,80,8 END IDD_PUOPT_KEEPSTATUS DIALOGEX 0, 0, 264, 223 diff --git a/plugins/StatusManager/src/aaa_main.cpp b/plugins/StatusManager/src/aaa_main.cpp index f69cd394bb..37e818a05f 100644 --- a/plugins/StatusManager/src/aaa_main.cpp +++ b/plugins/StatusManager/src/aaa_main.cpp @@ -444,7 +444,7 @@ int LoadAutoAwaySetting(SMProto &autoAwaySetting, char *protoName) if (g_bAAASettingSame) flags = 0xFFFFFF; else - flags = CallProtoService(protoName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0); + flags = GetStatusFlags(protoName); mir_snprintf(setting, "%s_Lv1Status", protoName); autoAwaySetting.lv1Status = AAAPlugin.getWord(setting, (flags & StatusModeToProtoFlag(ID_STATUS_AWAY)) ? ID_STATUS_AWAY : ID_STATUS_OFFLINE); diff --git a/plugins/StatusManager/src/aaa_options.cpp b/plugins/StatusManager/src/aaa_options.cpp index 6e976fe277..08efc53cd8 100644 --- a/plugins/StatusManager/src/aaa_options.cpp +++ b/plugins/StatusManager/src/aaa_options.cpp @@ -346,7 +346,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM int flags = 0; if (!g_bAAASettingSame) - flags = CallProtoService(setting->m_szName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(setting->m_szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0); + flags = GetStatusFlags(setting->m_szName); LVITEM lvItem = { 0 }; lvItem.mask = LVIF_TEXT | LVIF_PARAM; @@ -367,7 +367,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM { int flags = 0; if (!g_bAAASettingSame) - flags = CallProtoService(setting->m_szName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(setting->m_szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0); + flags = GetStatusFlags(setting->m_szName); // clear box and add new status, loop status and check if compatible with proto SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_RESETCONTENT, 0, 0); diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp index f0ffb071b6..eaa5325616 100644 --- a/plugins/StatusManager/src/commonstatus.cpp +++ b/plugins/StatusManager/src/commonstatus.cpp @@ -251,9 +251,8 @@ int SetStatusEx(TProtoSettings &ps) // status checks long protoFlag = Proto_Status2Flag(newstatus); - int b_Caps2 = CallProtoService(p->m_szName, PS_GETCAPS, PFLAGNUM_2, 0) & protoFlag; - int b_Caps5 = CallProtoService(p->m_szName, PS_GETCAPS, PFLAGNUM_5, 0) & protoFlag; - if (newstatus != ID_STATUS_OFFLINE && (!b_Caps2 || b_Caps5)) { + int b_Caps25 = GetStatusFlags(p->m_szName) & protoFlag; + if (newstatus != ID_STATUS_OFFLINE && !b_Caps25) { // status and status message for this status not supported log_debug(0, "CommonStatus: status not supported %s", p->m_szName); continue; @@ -297,9 +296,24 @@ static INT_PTR GetProtocolCountService(WPARAM, LPARAM) return pCount; } +int GetStatusFlags(const char *szProto) +{ + auto f2 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0); + auto f5 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_5, 0); + int flags = f2 & ~f5; + if (flags == 0 && f5) + flags = PF2_ONLINE; + + return flags; +} + bool IsSuitableProto(PROTOACCOUNT *pa) { - return (pa == nullptr) ? false : pa->IsVisible(); + if (!pa || !pa->bIsVisible || !pa->IsEnabled() || !pa->ppro) + return false; + + PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName); + return (pd != nullptr && (pd->type == PROTOTYPE_PROTOCOL || pd->type == PROTOTYPE_PROTOWITHACCS)); } static int onShutdown(WPARAM, LPARAM) diff --git a/plugins/StatusManager/src/commonstatus.h b/plugins/StatusManager/src/commonstatus.h index 6695cebaa8..569eafa59a 100644 --- a/plugins/StatusManager/src/commonstatus.h +++ b/plugins/StatusManager/src/commonstatus.h @@ -49,6 +49,7 @@ wchar_t *GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int status); int GetActualStatus(PROTOCOLSETTINGEX *protoSetting); int InitCommonStatus(); bool IsSuitableProto(PROTOACCOUNT *pa); +int GetStatusFlags(const char *szProto); ///////////////////////////////////////////////////////////////////////////////////////// // external data diff --git a/plugins/StatusManager/src/confirmdialog.cpp b/plugins/StatusManager/src/confirmdialog.cpp index 5ef6a719a3..e5417e14e3 100644 --- a/plugins/StatusManager/src/confirmdialog.cpp +++ b/plugins/StatusManager/src/confirmdialog.cpp @@ -312,7 +312,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } PROTOCOLSETTINGEX *proto = (PROTOCOLSETTINGEX*)lvItem.lParam; - int flags = CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(proto->m_szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0); + int flags = GetStatusFlags(proto->m_szName); // clear box and add new status, loop status and check if compatible with proto SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_RESETCONTENT, 0, 0); int actualStatus = proto->m_status; @@ -339,7 +339,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (auto &it : statusModes) { int pf5 = CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_5, 0); - if (((flags & it.iFlag) || it.iFlag == PF2_OFFLINE) && (!(!(flags) & Proto_Status2Flag(it.iFlag)) || (pf5 & Proto_Status2Flag(it.iFlag)))) { + if (((flags & it.iFlag) || it.iFlag == PF2_OFFLINE) && (!(!(flags & Proto_Status2Flag(it.iFlag))) || (pf5 & Proto_Status2Flag(it.iFlag)))) { wchar_t *statusMode = Clist_GetStatusModeDescription(it.iStatus, 0); item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode); SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, it.iStatus); diff --git a/plugins/StatusManager/src/ks_main.cpp b/plugins/StatusManager/src/ks_main.cpp index 1fffb2c7fc..1abd2aa1ba 100644 --- a/plugins/StatusManager/src/ks_main.cpp +++ b/plugins/StatusManager/src/ks_main.cpp @@ -31,8 +31,6 @@ static HANDLE hStatusChangeHook = nullptr; static HANDLE hCSStatusChangeHook = nullptr; static HANDLE hCSStatusChangeExHook = nullptr; -static HWND hMessageWindow = nullptr; - static UINT_PTR checkConnectionTimerId = 0; static UINT_PTR afterCheckTimerId = 0; static UINT_PTR processAckTimerId = 0; @@ -65,7 +63,7 @@ INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam); static int ProcessPopup(int reason, LPARAM lParam); LRESULT CALLBACK KSPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -static uint32_t CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +static LRESULT CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); // options.c extern int KeepStatusOptionsInit(WPARAM wparam, LPARAM); @@ -80,8 +78,7 @@ void KSUnloadOptions() UnhookEvent(hCSStatusChangeExHook); hProtoAckHook = hStatusChangeHook = hCSStatusChangeHook = hCSStatusChangeExHook = nullptr; - if (IsWindow(hMessageWindow)) - DestroyWindow(hMessageWindow); + mir_unsubclassWindow(Miranda_GetSystemWindow()->GetHwnd(), MessageWndProc); if (StartTimer(IDT_CHECKCONTIN, -1, FALSE)) WSACleanup(); @@ -112,12 +109,8 @@ int KSLoadOptions() if (ServiceExists(ME_CS_STATUSCHANGE)) hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGE, CSStatusChange); hCSStatusChangeExHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx); - if (KSPlugin.getByte(SETTING_CHECKAPMRESUME, 0)) { - if (!IsWindow(hMessageWindow)) { - hMessageWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr); - SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc); - } - } + if (KSPlugin.getByte(SETTING_CHECKAPMRESUME, 0)) + mir_subclassWindow(Miranda_GetSystemWindow()->GetHwnd(), MessageWndProc); retryCount = 0; } @@ -524,8 +517,9 @@ static void CALLBACK CheckAckStatusTimer(HWND, UINT, UINT_PTR, DWORD) for (auto &it : protoList) { int curStatus = it->GetStatus(); int newStatus = Proto_GetStatus(it->m_szName); + int protoFlags = GetStatusFlags(it->m_szName); // ok, np - if (curStatus == ID_STATUS_CURRENT || curStatus == ID_STATUS_DISABLED || curStatus == newStatus || newStatus > MAX_STATUS) + if (curStatus == ID_STATUS_CURRENT || curStatus == ID_STATUS_DISABLED || curStatus == newStatus || newStatus > MAX_STATUS || !protoFlags) continue; if (IsStatusConnecting(newStatus)) { // connecting @@ -899,9 +893,9 @@ static int ProcessPopup(int reason, LPARAM lParam) if (hIcon == nullptr) hIcon = Skin_LoadIcon(SKINICON_STATUS_OFFLINE); - Netlib_Logf(0, "KeepStatus: %s", wszText.c_str()); + Netlib_LogfW(0, L"KeepStatus: %s", wszText.c_str()); return ShowPopup(wszText, hIcon); -} +} LRESULT CALLBACK KSPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -995,7 +989,7 @@ INT_PTR AnnounceStatusChangeService(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // window for suspend -static uint32_t CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static TProtoSettings *ps = nullptr; @@ -1003,7 +997,7 @@ static uint32_t CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM lP case WM_POWERBROADCAST: switch (wParam) { case PBT_APMSUSPEND: - log_info(0, "KeepStatus: suspend state detected: %08X %08X", wParam, lParam); + log_info(0, "KeepStatus: suspend state detected"); if (ps == nullptr) { ps = new TProtoSettings(protoList); for (auto &it : *ps) @@ -1040,7 +1034,7 @@ static uint32_t CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM lP break; } - return TRUE; + return mir_callNextSubclass(hwnd, MessageWndProc, msg, wParam, lParam); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1056,7 +1050,6 @@ static int onShutdown(WPARAM, LPARAM) int KSModuleLoaded(WPARAM, LPARAM) { - hMessageWindow = nullptr; KSLoadOptions(); hEvents[0] = HookEvent(ME_OPT_INITIALISE, KeepStatusOptionsInit); diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h index a96ced8f45..14dc39f971 100644 --- a/plugins/StatusManager/src/resource.h +++ b/plugins/StatusManager/src/resource.h @@ -39,8 +39,6 @@ #define IDC_MAXRETRIES 1018 #define IDC_INITDELAY 1019 #define IDC_SETPROFILEDELAY 1020 -#define IDC_DOCKED 1021 -#define IDC_SETDOCKED 1022 #define IDC_MAXDELAY 1023 #define IDC_INCREASEEXPONENTIAL 1024 #define IDC_LNOTHING 1025 diff --git a/plugins/StatusManager/src/ss_main.cpp b/plugins/StatusManager/src/ss_main.cpp index f838c1cdd7..c4e9b59eb5 100644 --- a/plugins/StatusManager/src/ss_main.cpp +++ b/plugins/StatusManager/src/ss_main.cpp @@ -23,13 +23,12 @@ CFakePlugin SSPlugin(SSMODULENAME); static HANDLE hServices[3], hEvents[3]; static UINT_PTR setStatusTimerId = 0; +static LRESULT CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); ///////////////////////////////////////////////////////////////////////////////////////// static HANDLE hProtoAckHook, hCSStatusChangeHook, hStatusChangeHook; -static HWND hMessageWindow; - static uint8_t showDialogOnStartup = 0; ///////////////////////////////////////////////////////////////////////////////////////// @@ -234,16 +233,19 @@ static int OnOkToExit(WPARAM, LPARAM) if (!Proto_GetAccount(pa->szModuleName)) continue; - char lastName[128], lastMsg[128]; - mir_snprintf(lastName, "%s%s", PREFIX_LAST, pa->szModuleName); - SSPlugin.setWord(lastName, pa->iRealStatus); - mir_snprintf(lastMsg, "%s%s", PREFIX_LASTMSG, pa->szModuleName); - SSPlugin.delSetting(lastMsg); + int iStatus = Proto_GetStatus(pa->szModuleName); + Netlib_Logf(0, "StatusManager: storing status %d for %s", iStatus, pa->szModuleName); + + char szSetting[128]; + mir_snprintf(szSetting, "%s%s", PREFIX_LAST, pa->szModuleName); + SSPlugin.setWord(szSetting, iStatus); + mir_snprintf(szSetting, "%s%s", PREFIX_LASTMSG, pa->szModuleName); + SSPlugin.delSetting(szSetting); if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG)) continue; - if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(pa->iRealStatus))) + if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus))) continue; // NewAwaySys @@ -257,7 +259,7 @@ static int OnOkToExit(WPARAM, LPARAM) CallService(MS_NAS_GETSTATE, (WPARAM)&npi, 1); } if (npi.szMsg != nullptr) { - SSPlugin.setWString(lastMsg, npi.tszMsg); + SSPlugin.setWString(szSetting, npi.tszMsg); mir_free(npi.tszMsg); } } @@ -305,8 +307,7 @@ static int OnShutdown(WPARAM, LPARAM) if (SSPlugin.getByte(SETTING_SETWINSTATE, 0)) db_set_b(0, MODULE_CLIST, SETTING_WINSTATE, (uint8_t)state); - if (hMessageWindow) - DestroyWindow(hMessageWindow); + mir_unsubclassWindow(Miranda_GetSystemWindow()->GetHwnd(), MessageWndProc); ShutdownConfirmDialog(); protoList.destroy(); @@ -314,11 +315,11 @@ static int OnShutdown(WPARAM, LPARAM) } /* Window proc for poweroff event */ -static uint32_t CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM) +static LRESULT CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_ENDSESSION: - log_debug(0, "WM_ENDSESSION"); + log_debug(0, "WM_ENDSESSION: %d", (int)wParam); if (wParam) { log_debug(0, "WM_ENDSESSION: calling exit"); OnShutdown(0, 0); @@ -327,7 +328,7 @@ static uint32_t CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM) break; } - return TRUE; + return mir_callNextSubclass(hwnd, MessageWndProc, msg, wParam, lParam); } int SSModuleLoaded(WPARAM, LPARAM) @@ -339,9 +340,8 @@ int SSModuleLoaded(WPARAM, LPARAM) /* shutdown hook for normal shutdown */ hEvents[1] = HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit); hEvents[2] = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown); - /* message window for poweroff */ - hMessageWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr); - SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc); + + mir_subclassWindow(Miranda_GetSystemWindow()->GetHwnd(), MessageWndProc); GetProfile(-1, protoList); @@ -388,7 +388,7 @@ int SSModuleLoaded(WPARAM, LPARAM) WINDOWPLACEMENT wndpl = { sizeof(wndpl) }; if (GetWindowPlacement(hClist, &wndpl)) { - if (wndpl.showCmd == SW_SHOWNORMAL && !Clist_IsDocked()) { + if (wndpl.showCmd == SW_SHOWNORMAL) { RECT rc; if (GetWindowRect(hClist, &rc)) { int x = rc.left; @@ -428,15 +428,6 @@ void StartupStatusLoad() if (SSPlugin.getByte(SETTING_SETPROFILE, 1) || SSPlugin.getByte(SETTING_OFFLINECLOSE, 0)) db_set_w(0, "CList", "Status", (uint16_t)ID_STATUS_OFFLINE); - // docking - if (SSPlugin.getByte(SETTING_SETDOCKED, 0)) { - int docked = SSPlugin.getByte(SETTING_DOCKED, DOCKED_NONE); - if (docked == DOCKED_LEFT || docked == DOCKED_RIGHT) - docked = -docked; - - db_set_b(0, MODULE_CLIST, SETTING_DOCKED, (uint8_t)docked); - } - // Create service functions; the get functions are created here; they don't rely on commonstatus hServices[0] = CreateServiceFunction(MS_SS_GETPROFILE, SrvGetProfile); hServices[1] = CreateServiceFunction(MS_SS_GETPROFILECOUNT, GetProfileCount); diff --git a/plugins/StatusManager/src/ss_options.cpp b/plugins/StatusManager/src/ss_options.cpp index 3f9e37d69b..f40f8c7ced 100644 --- a/plugins/StatusManager/src/ss_options.cpp +++ b/plugins/StatusManager/src/ss_options.cpp @@ -250,10 +250,6 @@ class CSSMainOptDlg : public CSSOptionsBaseDlg else profiles.AddString(TranslateT("default")); profiles.SetCurSel(defProfile); - chkSetDocked.Enable(db_get_b(0, MODULE_CLIST, SETTING_TOOLWINDOW, 1)); - if (!chkSetDocked.Enabled()) - chkSetDocked.SetState(false); - int val = SSPlugin.getByte(SETTING_WINSTATE, SETTING_STATE_NORMAL); SendDlgItemMessage(m_hwnd, IDC_WINSTATE, CB_RESETCONTENT, 0, 0); @@ -276,7 +272,7 @@ class CSSMainOptDlg : public CSSOptionsBaseDlg } CCtrlButton btnShowCmdl; - CCtrlCheck chkSetProfile, chkShowDialog, chkSetWinSize, chkSetWinState, chkSetWinLocation, chkSetDocked; + CCtrlCheck chkSetProfile, chkShowDialog, chkSetWinSize, chkSetWinState, chkSetWinLocation; CCtrlCombo profiles; CTimer timer; @@ -286,7 +282,6 @@ public: timer(this, 10), profiles(this, IDC_PROFILE), btnShowCmdl(this, IDC_SHOWCMDL), - chkSetDocked(this, IDC_SETDOCKED), chkSetProfile(this, IDC_SETPROFILE), chkShowDialog(this, IDC_SHOWDIALOG), chkSetWinSize(this, IDC_SETWINSIZE), @@ -297,7 +292,6 @@ public: timer.OnEvent = Callback(this, &CSSMainOptDlg::onTimer); - chkSetDocked.OnChange = Callback(this, &CSSMainOptDlg::onChange_Docked); chkSetProfile.OnChange = Callback(this, &CSSMainOptDlg::onChange_SetProfile); chkShowDialog.OnChange = Callback(this, &CSSMainOptDlg::onChange_ShowDialog); chkSetWinSize.OnChange = Callback(this, &CSSMainOptDlg::onChange_SetWinSize); @@ -312,7 +306,6 @@ public: CheckDlgButton(m_hwnd, IDC_SHOWDIALOG, SSPlugin.getByte(SETTING_SHOWDIALOG, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_SETWINSTATE, SSPlugin.getByte(SETTING_SETWINSTATE, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_SETWINLOCATION, SSPlugin.getByte(SETTING_SETWINLOCATION, 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(m_hwnd, IDC_SETDOCKED, SSPlugin.getByte(SETTING_SETDOCKED, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_SETWINSIZE, SSPlugin.getByte(SETTING_SETWINSIZE, 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_OFFLINECLOSE, SSPlugin.getByte(SETTING_OFFLINECLOSE, 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(m_hwnd, IDC_AUTODIAL, SSPlugin.getByte(SETTING_AUTODIAL, 0) ? BST_CHECKED : BST_UNCHECKED); @@ -324,22 +317,6 @@ public: SetDlgItemInt(m_hwnd, IDC_WIDTH, SSPlugin.getWord(SETTING_WIDTH, 0), FALSE); SetDlgItemInt(m_hwnd, IDC_HEIGHT, SSPlugin.getWord(SETTING_HEIGHT, 0), FALSE); - int val = SSPlugin.getByte(SETTING_DOCKED, DOCKED_NONE); - int item = SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left")); - SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_SETITEMDATA, (WPARAM)item, (LPARAM)DOCKED_LEFT); - if (val == DOCKED_LEFT) - SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_SETCURSEL, (WPARAM)item, 0); - - item = SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right")); - SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_SETITEMDATA, (WPARAM)item, (LPARAM)DOCKED_RIGHT); - if (val == DOCKED_RIGHT) - SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_SETCURSEL, (WPARAM)item, 0); - - item = SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_ADDSTRING, 0, (LPARAM)TranslateT("None")); - SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_SETITEMDATA, (WPARAM)item, (LPARAM)DOCKED_NONE); - if (val == DOCKED_NONE) - SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_SETCURSEL, (WPARAM)item, 0); - ReinitProfiles(); timer.Start(100); return true; @@ -366,12 +343,6 @@ public: SSPlugin.setByte(SETTING_WINSTATE, (uint8_t)val); } - SSPlugin.setByte(SETTING_SETDOCKED, bChecked = chkSetDocked.GetState()); - if (bChecked) { - int val = (int)SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_GETITEMDATA, SendDlgItemMessage(m_hwnd, IDC_DOCKED, CB_GETCURSEL, 0, 0), 0); - SSPlugin.setByte(SETTING_DOCKED, (uint8_t)val); - } - SSPlugin.setByte(SETTING_SETWINLOCATION, bChecked = chkSetWinLocation.GetState()); if (bChecked) { SSPlugin.setDword(SETTING_XPOS, GetDlgItemInt(m_hwnd, IDC_XPOS, nullptr, TRUE)); @@ -438,11 +409,6 @@ public: EnableWindow(GetDlgItem(m_hwnd, IDC_HEIGHT), !db_get_b(0, MODULE_CLUI, SETTING_AUTOSIZE, 0) && bChecked); } - void onChange_Docked(CCtrlCheck*) - { - EnableWindow(GetDlgItem(m_hwnd, IDC_DOCKED), chkSetDocked.GetState()); - } - void onTimer(CTimer*) { if (chkSetWinLocation.GetState() && chkSetWinSize.GetState()) { @@ -531,18 +497,19 @@ class CSSAdvancedOptDlg : public CDlgBase void SetProfile() { int sel = cmbProfile.GetCurData(); - chkCreateTTB.SetState(arProfiles[sel].createTtb); - chkShowDialog.SetState(arProfiles[sel].showDialog); - chkCreateMMI.SetState(arProfiles[sel].createMmi); - chkInSubmenu.SetState(arProfiles[sel].inSubMenu); - chkInSubmenu.Enable(arProfiles[sel].createMmi); - chkRegHotkey.SetState(arProfiles[sel].regHotkey); - edtHotkey.SendMsg(HKM_SETHOTKEY, arProfiles[sel].hotKey, 0); - edtHotkey.Enable(arProfiles[sel].regHotkey); + auto &P = arProfiles[sel]; + chkCreateTTB.SetState(P.createTtb); + chkShowDialog.SetState(P.showDialog); + chkCreateMMI.SetState(P.createMmi); + chkInSubmenu.SetState(P.inSubMenu); + chkInSubmenu.Enable(P.createMmi); + chkRegHotkey.SetState(P.regHotkey); + edtHotkey.SendMsg(HKM_SETHOTKEY, P.hotKey, 0); + edtHotkey.Enable(P.regHotkey); // fill proto list lstAccount.ResetContent(); - for (auto &it : arProfiles[sel].ps) + for (auto &it : P.ps) lstAccount.AddString(it->m_tszAccName, (LPARAM)it); lstAccount.SetCurSel(0); @@ -556,7 +523,8 @@ class CSSAdvancedOptDlg : public CDlgBase // fill status box SMProto* ps = (SMProto*)lstAccount.GetItemData(idx); - int flags = (CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_2, 0))&~(CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_5, 0)); + int flags = GetStatusFlags(ps->m_szName); + lstStatus.ResetContent(); for (auto &it : statusModes) { if ((flags & it.iFlag) || (it.iStatus == ID_STATUS_OFFLINE)) { diff --git a/plugins/StatusManager/src/startupstatus.h b/plugins/StatusManager/src/startupstatus.h index 7e3ad71123..8e81b9b63a 100644 --- a/plugins/StatusManager/src/startupstatus.h +++ b/plugins/StatusManager/src/startupstatus.h @@ -58,9 +58,6 @@ typedef struct { #define SETTING_SETWINSTATE "SetState" #define SETTING_WINSTATE "State" -#define SETTING_SETDOCKED "SetDocked" -#define SETTING_DOCKED "Docked" - #define SETTING_SHOWDIALOG "ShowDialog" #define SETTING_OFFLINECLOSE "OfflineOnClose" #define SETTING_SETPROFILE "SetStatusOnStartup" @@ -98,10 +95,6 @@ typedef struct { #define SHORTCUT_DESC L"Miranda NG" #define SHORTCUT_FILENAME L"\\Miranda NG.lnk" -#define DOCKED_NONE 0 -#define DOCKED_LEFT 1 -#define DOCKED_RIGHT 2 - #define MS_SS_MENUSETPROFILEPREFIX "StartupStatus/SetProfile_" // options diff --git a/plugins/StatusManager/src/stdafx.cxx b/plugins/StatusManager/src/stdafx.cxx index 87b7477097..72e87c2758 100644 --- a/plugins/StatusManager/src/stdafx.cxx +++ b/plugins/StatusManager/src/stdafx.cxx @@ -1,5 +1,5 @@ /*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/plugins/StatusManager/src/version.h b/plugins/StatusManager/src/version.h index ab088850f4..75190fa143 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 6
+#define __BUILD_NUM 7
// other stuff for Version resource
#include <stdver.h>
@@ -13,4 +13,4 @@ #define __DESCRIPTION "A connection checker and auto away module. Also allows you to define the status Miranda should set on startup, configurable per protocol."
#define __AUTHOR "P Boon"
#define __AUTHORWEB "https://miranda-ng.org/p/StatusManager"
-#define __COPYRIGHT "© 2003-08 P. Boon, 2008-24 George Hazan"
+#define __COPYRIGHT "© 2003-08 P. Boon, 2008-25 George Hazan"
|