summaryrefslogtreecommitdiff
path: root/protocols/Weather/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-01-26 19:10:34 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-01-26 19:10:34 +0300
commite82b9be1d927117f969a90f5273196b4faccc969 (patch)
tree72d825c947d337015f9f8f8f84bf4c1021c82e25 /protocols/Weather/src
parent5a55cb63fde0e53047bd785fca8ffb88d9102918 (diff)
fixes #4838 (Weather: нет данных во всплывающем окне)
Diffstat (limited to 'protocols/Weather/src')
-rw-r--r--protocols/Weather/src/weather_update.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/protocols/Weather/src/weather_update.cpp b/protocols/Weather/src/weather_update.cpp
index 603afd16a5..cfc5e95a7a 100644
--- a/protocols/Weather/src/weather_update.cpp
+++ b/protocols/Weather/src/weather_update.cpp
@@ -423,16 +423,9 @@ int CWeatherProto::GetWeatherData(MCONTACT hContact)
else if (szIcon == "cloudy")
cond = CLOUDY;
- for (auto &it : arValues) {
- ConvertDataValue(it);
- db_set_ws(hContact, WEATHERCONDITION, _T2A(it->Name), it->Value);
- }
-
// writing forecast
int iFore = 0;
for (auto &fore : root["days"]) {
- arValues.destroy();
- arValues.insert(new WIDATAITEM(L"Update", L"", fore["datetime"].as_mstring()));
getData(arValues, fore);
CMStringW result;
@@ -441,6 +434,9 @@ int CWeatherProto::GetWeatherData(MCONTACT hContact)
if (it->Value.IsEmpty())
continue;
+ if (iFore == 0)
+ db_set_ws(hContact, WEATHERCONDITION, _T2A(it->Name), it->Value);
+
if (!result.IsEmpty())
result += L"; ";
result.AppendFormat(L"%s - %s", TranslateW(it->Name), it->Value.c_str());
@@ -448,6 +444,7 @@ int CWeatherProto::GetWeatherData(MCONTACT hContact)
CMStringA szSetting(FORMAT, "Forecast Day %d", iFore++);
db_set_ws(hContact, WEATHERCONDITION, szSetting, result);
+ arValues.destroy();
}
// assign condition icon