diff options
Diffstat (limited to 'protocols/Weather/src/weather_update.cpp')
-rw-r--r-- | protocols/Weather/src/weather_update.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/protocols/Weather/src/weather_update.cpp b/protocols/Weather/src/weather_update.cpp index a03e0aeeca..2af9dc3cc8 100644 --- a/protocols/Weather/src/weather_update.cpp +++ b/protocols/Weather/src/weather_update.cpp @@ -360,9 +360,26 @@ static wchar_t *moon2str(double phase) return TranslateT("Waning crescent"); } +static CMStringW parseConditions(const CMStringW &str) +{ + CMStringW ret; + int iStart = 0; + while (true) { + auto substr = str.Tokenize(L",", iStart); + if (substr.IsEmpty()) + break; + + substr.Trim(); + if (!ret.IsEmpty()) + ret += ", "; + ret += TranslateW(substr); + } + return ret; +} + static void getData(OBJLIST<WIDATAITEM> &arValues, const JSONNode &node) { - arValues.insert(new WIDATAITEM(LPGENW("Condition"), L"", node["conditions"].as_mstring())); + arValues.insert(new WIDATAITEM(LPGENW("Condition"), L"", parseConditions(node["conditions"].as_mstring()))); arValues.insert(new WIDATAITEM(LPGENW("Temperature"), L"C", node["temp"].as_mstring())); arValues.insert(new WIDATAITEM(LPGENW("High"), L"C", node["tempmax"].as_mstring())); arValues.insert(new WIDATAITEM(LPGENW("Low"), L"C", node["tempmin"].as_mstring())); |