diff options
author | George Hazan <george.hazan@gmail.com> | 2025-04-07 13:13:36 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-04-07 13:13:40 +0300 |
commit | fee3fee5d2cda4766964b4c3a61a8b1d2ff5e128 (patch) | |
tree | d7e9304b24491b2a80552576fa60e76bcd641fe0 /protocols/Weather/src | |
parent | 1267fdc83b098432b6d4c7190ec2c4de8a4be9ee (diff) |
fixes #4961 (Weather: не все переменные перечислены в настройках плагина)
Diffstat (limited to 'protocols/Weather/src')
-rw-r--r-- | protocols/Weather/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/Weather/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/Weather/src/weather_opt.cpp | 2 | ||||
-rw-r--r-- | protocols/Weather/src/weather_update.cpp | 27 |
4 files changed, 25 insertions, 6 deletions
diff --git a/protocols/Weather/src/proto.h b/protocols/Weather/src/proto.h index afa5547431..e1115b65e3 100644 --- a/protocols/Weather/src/proto.h +++ b/protocols/Weather/src/proto.h @@ -181,6 +181,7 @@ class CWeatherProto : public PROTO<CWeatherProto> int __cdecl OptInit(WPARAM, LPARAM); CMStringW GetTextValue(int c); + void GetVarsDescr(CMStringW &str); // popups int WPShowMessage(const wchar_t *lpzText, int kind); diff --git a/protocols/Weather/src/stdafx.h b/protocols/Weather/src/stdafx.h index 70c602ed22..cf1f3240a3 100644 --- a/protocols/Weather/src/stdafx.h +++ b/protocols/Weather/src/stdafx.h @@ -147,7 +147,6 @@ void ConvertBackslashes(char *str); char *GetSearchStr(char *dis);
CMStringW GetDisplay(WEATHERINFO *w, const wchar_t *dis);
-void GetVarsDescr(CMStringW &str);
wchar_t *GetError(int code);
diff --git a/protocols/Weather/src/weather_opt.cpp b/protocols/Weather/src/weather_opt.cpp index 815fba5dd5..6203715b2a 100644 --- a/protocols/Weather/src/weather_opt.cpp +++ b/protocols/Weather/src/weather_opt.cpp @@ -418,7 +418,7 @@ public: // heading CMStringW str(TranslateT("Here is a list of custom variables that are currently available")); str += L"\n\n"; - GetVarsDescr(str); + m_proto->GetVarsDescr(str); // display the list in a message box MessageBox(nullptr, str, TranslateT("More Variables"), MB_OK | MB_ICONINFORMATION | MB_TOPMOST); diff --git a/protocols/Weather/src/weather_update.cpp b/protocols/Weather/src/weather_update.cpp index a64bf7e063..001a9d9eba 100644 --- a/protocols/Weather/src/weather_update.cpp +++ b/protocols/Weather/src/weather_update.cpp @@ -469,13 +469,32 @@ int CWeatherProto::GetWeatherData(MCONTACT hContact) return 0; } -void GetVarsDescr(CMStringW &str) +///////////////////////////////////////////////////////////////////////////////////////// + +static int enumSettings(const char *pszSetting, void *param) +{ + auto *pList = (OBJLIST<char>*)param; + if (!pList->find((char*)pszSetting)) + pList->insert(newStr(pszSetting)); + return 0; +} + +void CWeatherProto::GetVarsDescr(CMStringW &wszDescr) { - for (int i = 1; i <= 7; i++) { - if (i != 1) + OBJLIST<char> vars(10, mir_strcmp); + for (int i = 1; i <= 7; i++) + vars.insert(newStr(CMStringA(FORMAT, "Forecast Day %d", i))); + + for (auto &cc : AccContacts()) + db_enum_settings(cc, &enumSettings, WEATHERCONDITION, &vars); + + CMStringW str; + for (auto &it : vars) { + if (!str.IsEmpty()) str.Append(L", "); - str.AppendFormat(L"%%[Forecast Day %d]", i); + str.AppendFormat(L"%%[%S]", it); } + wszDescr += str; } ///////////////////////////////////////////////////////////////////////////////////////// |