summaryrefslogtreecommitdiff
path: root/protocols/Weather/src/weather_update.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-04-07 13:13:36 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-04-07 13:13:40 +0300
commitfee3fee5d2cda4766964b4c3a61a8b1d2ff5e128 (patch)
treed7e9304b24491b2a80552576fa60e76bcd641fe0 /protocols/Weather/src/weather_update.cpp
parent1267fdc83b098432b6d4c7190ec2c4de8a4be9ee (diff)
fixes #4961 (Weather: не все переменные перечислены в настройках плагина)
Diffstat (limited to 'protocols/Weather/src/weather_update.cpp')
-rw-r--r--protocols/Weather/src/weather_update.cpp27
1 files changed, 23 insertions, 4 deletions
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;
}
/////////////////////////////////////////////////////////////////////////////////////////