From fee3fee5d2cda4766964b4c3a61a8b1d2ff5e128 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 7 Apr 2025 13:13:36 +0300 Subject: =?UTF-8?q?fixes=20#4961=20(Weather:=20=D0=BD=D0=B5=20=D0=B2=D1=81?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D1=87=D0=B8=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B2=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=B0=D1=85=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Weather/src/weather_update.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'protocols/Weather/src/weather_update.cpp') 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*)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 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; } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3