From 0ae14db4428509ac2b3c8c96c0522f56249ee227 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Jan 2025 18:55:04 +0300 Subject: =?UTF-8?q?-=20fixes=20#4840=20(Weather:=20=D0=BD=D0=B5=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82=20=D0=BA=D0=BD=D0=BE?= =?UTF-8?q?=D0=BF=D0=BA=D0=B0=20"=D0=A1=D0=B0=D0=B9=D1=82"=20=D0=B2=20?= =?UTF-8?q?=D0=BE=D0=BA=D0=BD=D0=B5=20=D0=BF=D0=BE=D0=B3=D0=BE=D0=B4=D1=8B?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixes #4839 (Weather: не работает пункт меню "Читать полный прогноз" и "Карта погоды") --- protocols/Weather/src/weather_contacts.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'protocols/Weather/src') diff --git a/protocols/Weather/src/weather_contacts.cpp b/protocols/Weather/src/weather_contacts.cpp index 759380eb15..91fed3358f 100644 --- a/protocols/Weather/src/weather_contacts.cpp +++ b/protocols/Weather/src/weather_contacts.cpp @@ -25,13 +25,6 @@ the contact. #include "stdafx.h" -static void OpenUrl(wchar_t *format, wchar_t *id) -{ - wchar_t loc[512]; - mir_snwprintf(loc, format, id); - Utils_OpenUrlW(loc); -} - bool CWeatherProto::IsMyContact(MCONTACT hContact) { return hContact && !mir_strcmp(m_szModuleName, Proto_GetBaseAccountName(hContact)); @@ -62,16 +55,12 @@ INT_PTR CWeatherProto::ViewLog(WPARAM wParam, LPARAM lParam) INT_PTR CWeatherProto::LoadForecast(WPARAM wParam, LPARAM) { - wchar_t id[256], loc2[256]; + wchar_t id[256]; GetStationID(wParam, id, _countof(id)); if (id[0] != 0) { - // check if the complte forecast URL is set. If it is not, display warning and quit - if (db_get_wstatic(wParam, m_szModuleName, "InfoURL", loc2, _countof(loc2)) || loc2[0] == 0) { - MessageBox(nullptr, TranslateT("The URL for complete forecast has not been set. You can set it from the Edit Settings dialog."), TranslateT("Weather Protocol"), MB_ICONINFORMATION); - return 1; - } // set the url and open the webpage - OpenUrl(loc2, id); + CMStringA szUrl("https://www.visualcrossing.com/weather-forecast/" + mir_urlEncode(T2Utf(id)) + "/metric"); + Utils_OpenUrl(szUrl); } return 0; } @@ -82,17 +71,12 @@ INT_PTR CWeatherProto::LoadForecast(WPARAM wParam, LPARAM) INT_PTR CWeatherProto::WeatherMap(WPARAM wParam, LPARAM) { - wchar_t id[256], loc2[256]; + wchar_t id[256]; GetStationID(wParam, id, _countof(id)); if (id[0] != 0) { - // check if the weather map URL is set. If it is not, display warning and quit - if (db_get_wstatic(wParam, m_szModuleName, "MapURL", loc2, _countof(loc2)) || loc2[0] == 0) { - MessageBox(nullptr, TranslateT("The URL for weather map has not been set. You can set it from the Edit Settings dialog."), TranslateT("Weather Protocol"), MB_ICONINFORMATION); - return 1; - } - // set the url and open the webpage - OpenUrl(loc2, id); + CMStringA szUrl("https://www.visualcrossing.com/weather-history/" + mir_urlEncode(T2Utf(id)) + "/metric"); + Utils_OpenUrl(szUrl); } return 0; -- cgit v1.2.3