diff options
author | George Hazan <george.hazan@gmail.com> | 2024-07-12 16:25:57 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-07-12 16:25:57 +0300 |
commit | e08143e37cff1be034540d89028b9dba6f0cef70 (patch) | |
tree | 1196deaa1a2f15ca83531c612128da286d6bce10 | |
parent | 1f5c34c5678de36df653da048662008bfe6e1af2 (diff) |
fixes #4530 (Weaher: недоступна кнопка "Обновить" в информации о пользователе)
-rw-r--r-- | protocols/Weather/src/weather_svcs.cpp | 17 | ||||
-rw-r--r-- | protocols/Weather/src/weather_userinfo.cpp | 14 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_internal.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/protocols.cpp | 9 |
5 files changed, 25 insertions, 19 deletions
diff --git a/protocols/Weather/src/weather_svcs.cpp b/protocols/Weather/src/weather_svcs.cpp index ced1ce5c71..daeb7f8bd1 100644 --- a/protocols/Weather/src/weather_svcs.cpp +++ b/protocols/Weather/src/weather_svcs.cpp @@ -35,17 +35,18 @@ extern VARSW g_pwszIconsName; // protocol service function for setting weather protocol status INT_PTR WeatherSetStatus(WPARAM new_status, LPARAM) { - new_status = new_status != ID_STATUS_OFFLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; - // if we don't want to show status for default station - if (!opt.NoProtoCondition && status != new_status) { + if (status != new_status) { old_status = status; - status = new_status != ID_STATUS_OFFLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; - ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status); + status = new_status = new_status != ID_STATUS_OFFLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; + + if (!opt.NoProtoCondition) { + ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status); - UpdateMenu(new_status != ID_STATUS_OFFLINE); - if (new_status != ID_STATUS_OFFLINE) - UpdateAll(FALSE, FALSE); + UpdateMenu(new_status != ID_STATUS_OFFLINE); + if (new_status != ID_STATUS_OFFLINE) + UpdateAll(FALSE, FALSE); + } } return 0; diff --git a/protocols/Weather/src/weather_userinfo.cpp b/protocols/Weather/src/weather_userinfo.cpp index b0e0bf6859..ecee919ce5 100644 --- a/protocols/Weather/src/weather_userinfo.cpp +++ b/protocols/Weather/src/weather_userinfo.cpp @@ -54,22 +54,22 @@ static int BriefDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc) // also load brief info into message box static void LoadBriefInfoText(HWND hwndDlg, MCONTACT hContact) { - WEATHERINFO winfo; wchar_t str[4096]; // load weather information from the contact into the WEATHERINFO struct - winfo = LoadWeatherInfo(hContact); + WEATHERINFO winfo = LoadWeatherInfo(hContact); // check if data exist. If not, display error message box if (!g_plugin.getByte(hContact, "IsUpdated")) - wcsncpy(str, TranslateT("No information available.\r\nPlease update weather condition first."), _countof(str) - 1); - else + SetDlgItemTextW(hwndDlg, IDC_MTEXT, TranslateT("No information available.\r\nPlease update weather condition first.")); + else { // set the display text and show the message box GetDisplay(&winfo, GetTextValue('B'), str); - SetDlgItemText(hwndDlg, IDC_MTEXT, str); + SetDlgItemTextW(hwndDlg, IDC_MTEXT, str); + } GetDisplay(&winfo, L"%c, %t", str); - SetWindowText(hwndDlg, winfo.city); - SetDlgItemText(hwndDlg, IDC_HEADERBAR, str); + SetWindowTextW(hwndDlg, winfo.city); + SetDlgItemTextW(hwndDlg, IDC_HEADERBAR, str); } // dialog process for more data in the user info window diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index fc3d37bab5..1a6d7a150f 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -317,7 +317,7 @@ public: CheckOnline();
if (!CallContactService(m_hContact, PS_GETINFO, SGIF_ONOPEN)) {
btnUpdate.Disable();
- SetTimer(m_hwnd, 1, 100, nullptr);
+ updateTimer.Start(100);
}
else ShowWindow(GetDlgItem(m_hwnd, IDC_UPDATING), SW_HIDE);
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index dd1225a5d2..d10b3262c2 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -217,7 +217,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE int GetStatus() override
{
- return (int)ProtoCallService(m_szModuleName, PS_SETSTATUS, 0, 0);
+ return (int)ProtoCallService(m_szModuleName, PS_GETSTATUS, 0, 0);
}
int SetStatus(int iNewStatus) override
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 568ee41e5d..9acb77dada 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -295,8 +295,13 @@ MIR_APP_DLL(int) Proto_GetStatus(const char *accName) if (accName == nullptr)
return ID_STATUS_OFFLINE;
- PROTOACCOUNT *pa = g_arAccounts.find((PROTOACCOUNT*)&accName);
- return (pa) ? pa->iRealStatus : ID_STATUS_OFFLINE;
+ if (auto *pa = g_arAccounts.find((PROTOACCOUNT *)&accName)) {
+ if (pa->bOldProto)
+ return ProtoCallService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ return pa->iRealStatus;
+ }
+
+ return ID_STATUS_OFFLINE;
}
/////////////////////////////////////////////////////////////////////////////////////////
|