diff options
| author | George Hazan <george.hazan@gmail.com> | 2025-02-12 19:43:07 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2025-02-12 19:43:07 +0300 |
| commit | 0c74ee3239a1846e654653ed008c40df2e73a362 (patch) | |
| tree | 7153c37a7bb4568db5d8fca0cabd12d853f9e2b7 /plugins/StatusManager/src | |
| parent | 0835d6dd7ee1b7256104871604bc2f31beb3e197 (diff) | |
fixes #4866 (StatusManager: Startup status не видит погоду)
Diffstat (limited to 'plugins/StatusManager/src')
| -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 | 14 | ||||
| -rw-r--r-- | plugins/StatusManager/src/commonstatus.h | 1 | ||||
| -rw-r--r-- | plugins/StatusManager/src/confirmdialog.cpp | 4 | ||||
| -rw-r--r-- | plugins/StatusManager/src/ss_options.cpp | 4 | ||||
| -rw-r--r-- | plugins/StatusManager/src/version.h | 2 |
7 files changed, 19 insertions, 12 deletions
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 c8ce7d10b7..7e83949b55 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,6 +296,15 @@ static INT_PTR GetProtocolCountService(WPARAM, LPARAM) return pCount; } +int GetStatusFlags(const char *szProto) +{ + int flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_5, 0); + if (flags == 0) + flags = PF2_ONLINE; + + return flags; +} + bool IsSuitableProto(PROTOACCOUNT *pa) { if (!pa || !pa->bIsVisible || !pa->IsEnabled() || !pa->ppro) 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/ss_options.cpp b/plugins/StatusManager/src/ss_options.cpp index 4faef91bd1..8dddc81d68 100644 --- a/plugins/StatusManager/src/ss_options.cpp +++ b/plugins/StatusManager/src/ss_options.cpp @@ -557,9 +557,7 @@ 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)); - if (flags == 0) - flags = PF2_ONLINE; + int flags = GetStatusFlags(ps->m_szName); lstStatus.ResetContent(); for (auto &it : statusModes) { diff --git a/plugins/StatusManager/src/version.h b/plugins/StatusManager/src/version.h index d94fbff878..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>
|
