From ef1a349d88912a89a8dd20ca1dcb342b6dc9c2ff Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Mon, 27 May 2019 18:45:43 +0300
Subject: fixes #1963 (Remove Free for Chat, On the Phone and Out to Lunch
 statuses completely)

---
 protocols/Weather/src/stdafx.h         |  8 ++---
 protocols/Weather/src/weather_conv.cpp | 64 +++++++---------------------------
 protocols/Weather/src/weather_svcs.cpp | 10 +++---
 3 files changed, 19 insertions(+), 63 deletions(-)

(limited to 'protocols/Weather')

diff --git a/protocols/Weather/src/stdafx.h b/protocols/Weather/src/stdafx.h
index 9affd13abb..b2c3e5db15 100644
--- a/protocols/Weather/src/stdafx.h
+++ b/protocols/Weather/src/stdafx.h
@@ -75,12 +75,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define PCLOUDY   ID_STATUS_AWAY
 #define CLOUDY    ID_STATUS_NA
 #define RAIN      ID_STATUS_OCCUPIED
-#define RSHOWER   ID_STATUS_DND
-#define SNOW      ID_STATUS_FREECHAT
-#define LIGHT     ID_STATUS_INVISIBLE
-#define THUNDER   ID_STATUS_INVISIBLE
-#define SSHOWER   ID_STATUS_ONTHEPHONE
-#define FOG       ID_STATUS_OUTTOLUNCH
+#define FOG       ID_STATUS_DND
+#define SNOW      ID_STATUS_INVISIBLE
 #define UNAVAIL   40081
 
 // status
diff --git a/protocols/Weather/src/weather_conv.cpp b/protocols/Weather/src/weather_conv.cpp
index c46b079531..584cb4f1bd 100644
--- a/protocols/Weather/src/weather_conv.cpp
+++ b/protocols/Weather/src/weather_conv.cpp
@@ -316,8 +316,8 @@ void GetElev(wchar_t *tempchar, wchar_t *unit, wchar_t *str)
 // cond = the string for weather condition
 // return value = status for the icon (ONLINE, OFFLINE, etc)
 
-static const wchar_t *statusStr[10] = { L"Lightning", L"Fog", L"Snow Shower", L"Snow", L"Rain Shower", L"Rain", L"Partly Cloudy", L"Cloudy", L"Sunny", L"N/A" };
-static const WORD statusValue[10] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN, PCLOUDY, CLOUDY, SUNNY, NA };
+static const wchar_t *statusStr[10] = { L"Fog", L"Snow", L"Rain", L"Partly Cloudy", L"Cloudy", L"Sunny", L"N/A" };
+static const WORD statusValue[10] = { FOG, SNOW, RAIN, PCLOUDY, CLOUDY, SUNNY, NA };
 
 WORD GetIcon(const wchar_t* cond, WIDATA *Data)
 {
@@ -327,61 +327,23 @@ WORD GetIcon(const wchar_t* cond, WIDATA *Data)
 			return statusValue[i];
 
 	// internal detection
-	if (
-		wcsstr(cond, L"mainy sunny") != nullptr ||
-		wcsstr(cond, L"mainy clear") != nullptr ||
-		wcsstr(cond, L"partly cloudy") != nullptr ||
-		wcsstr(cond, L"mostly") != nullptr ||
-		wcsstr(cond, L"clouds") != nullptr) {
+	if (wcsstr(cond, L"mainy sunny") || wcsstr(cond, L"mainy clear") || wcsstr(cond, L"partly cloudy") || wcsstr(cond, L"mostly") || wcsstr(cond, L"clouds"))
 		return PCLOUDY;
-	}
-	else if (
-		wcsstr(cond, L"sunny") != nullptr ||
-		wcsstr(cond, L"clear") != nullptr ||
-		wcsstr(cond, L"fair") != nullptr) {
+
+	if (wcsstr(cond, L"sunny") || wcsstr(cond, L"clear") || wcsstr(cond, L"fair"))
 		return SUNNY;
-	}
-	else if (
-		wcsstr(cond, L"thunder") != nullptr ||
-		wcsstr(cond, L"t-storm") != nullptr) {
-		return LIGHT;
-	}
-	else if (
-		wcsstr(cond, L"cloud") != nullptr ||
-		wcsstr(cond, L"overcast") != nullptr) {
+
+	if (wcsstr(cond, L"cloud") || wcsstr(cond, L"overcast"))
 		return CLOUDY;
-	}
-	else if (
-		wcsstr(cond, L"fog") != nullptr ||
-		wcsstr(cond, L"mist") != nullptr ||
-		wcsstr(cond, L"smoke") != nullptr ||
-		wcsstr(cond, L"sand") != nullptr ||
-		wcsstr(cond, L"dust") != nullptr ||
-		wcsstr(cond, L"haze") != nullptr) {
+
+	if (wcsstr(cond, L"fog") || wcsstr(cond, L"mist") || wcsstr(cond, L"smoke") || wcsstr(cond, L"sand") || wcsstr(cond, L"dust") || wcsstr(cond, L"haze"))
 		return FOG;
-	}
-	else if (
-		(wcsstr(cond, L"shower") != nullptr && wcsstr(cond, L"snow") != nullptr) ||
-		wcsstr(cond, L"flurries") != nullptr) {
-		return SSHOWER;
-	}
-	else if (
-		wcsstr(cond, L"rain shower") != nullptr ||
-		wcsstr(cond, L"shower") != nullptr) {
-		return RSHOWER;
-	}
-	else if (
-		wcsstr(cond, L"snow") != nullptr ||
-		wcsstr(cond, L"ice") != nullptr ||
-		wcsstr(cond, L"freezing") != nullptr ||
-		wcsstr(cond, L"wintry") != nullptr) {
+
+	if (wcsstr(cond, L"snow") || wcsstr(cond, L"ice") || wcsstr(cond, L"freezing") || wcsstr(cond, L"wintry"))
 		return SNOW;
-	}
-	else if (
-		wcsstr(cond, L"drizzle") != nullptr ||
-		wcsstr(cond, L"rain") != nullptr) {
+
+	if (wcsstr(cond, L"thunder") || wcsstr(cond, L"t-storm") || wcsstr(cond, L"drizzle") || wcsstr(cond, L"rain"))
 		return RAIN;
-	}
 
 	// set the icon using langpack
 	for (int i = 0; i < 9; i++) {
diff --git a/protocols/Weather/src/weather_svcs.cpp b/protocols/Weather/src/weather_svcs.cpp
index 2ef10fffa9..ef021fb633 100644
--- a/protocols/Weather/src/weather_svcs.cpp
+++ b/protocols/Weather/src/weather_svcs.cpp
@@ -62,8 +62,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
 		break;
 
 	case PFLAGNUM_2:
-		ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND |
-			PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+		ret = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND;
 		break;
 
 	case PFLAGNUM_4:
@@ -71,8 +70,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM)
 		break;
 
 	case PFLAGNUM_5: /* this is PFLAGNUM_5 change when alpha SDK is released */
-		ret = PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND |
-			PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
+		ret = PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND;
 		break;
 
 	case PFLAG_UNIQUEIDTEXT:
@@ -118,8 +116,8 @@ INT_PTR WeatherGetInfo(WPARAM, LPARAM lParam)
 }
 
 // avatars
-static const wchar_t *statusStr[] = { L"Light", L"Fog", L"SShower", L"Snow", L"RShower", L"Rain", L"PCloudy", L"Cloudy", L"Sunny", L"NA" };
-static const WORD statusValue[] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN, PCLOUDY, CLOUDY, SUNNY, NA };
+static const wchar_t *statusStr[] = { L"Fog", L"Snow", L"Rain", L"PCloudy", L"Cloudy", L"Sunny", L"NA" };
+static const WORD statusValue[] = { FOG, SNOW, RAIN, PCLOUDY, CLOUDY, SUNNY, NA };
 
 INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
 {
-- 
cgit v1.2.3