From e82b9be1d927117f969a90f5273196b4faccc969 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Jan 2025 19:10:34 +0300 Subject: =?UTF-8?q?fixes=20#4838=20(Weather:=20=D0=BD=D0=B5=D1=82=20=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=D0=BE=20=D0=B2=D1=81?= =?UTF-8?q?=D0=BF=D0=BB=D1=8B=D0=B2=D0=B0=D1=8E=D1=89=D0=B5=D0=BC=20=D0=BE?= =?UTF-8?q?=D0=BA=D0=BD=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Weather/src/weather_update.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 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 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 -- cgit v1.2.3