From ba688c1ade0ac44a02294dda3e486469820bb31a Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Wed, 14 Nov 2018 00:16:27 +0300
Subject: Weather -> g_plugin

---
 plugins/Weather/src/stdafx.h             |  22 +++-
 plugins/Weather/src/weather.cpp          |  12 +--
 plugins/Weather/src/weather_addstn.cpp   |  42 ++++----
 plugins/Weather/src/weather_contacts.cpp |  72 +++++++-------
 plugins/Weather/src/weather_data.cpp     |  40 ++++----
 plugins/Weather/src/weather_http.cpp     |   2 +-
 plugins/Weather/src/weather_icons.cpp    |   4 +-
 plugins/Weather/src/weather_mwin.cpp     |  46 ++++-----
 plugins/Weather/src/weather_opt.cpp      | 166 +++++++++++++++----------------
 plugins/Weather/src/weather_popup.cpp    |   5 +-
 plugins/Weather/src/weather_svcs.cpp     |  68 ++++++-------
 plugins/Weather/src/weather_update.cpp   |  50 +++++-----
 plugins/Weather/src/weather_userinfo.cpp |  18 ++--
 13 files changed, 281 insertions(+), 266 deletions(-)

(limited to 'plugins/Weather')

diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h
index 74cecbed62..c49cad06e3 100644
--- a/plugins/Weather/src/stdafx.h
+++ b/plugins/Weather/src/stdafx.h
@@ -63,6 +63,26 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 //============  CONSTANTS  ============
 
+// name
+#define MODULENAME         "Weather"
+#define WEATHERPROTOTEXT   "Weather"
+#define DEFCURRENTWEATHER  "WeatherCondition"
+#define WEATHERCONDITION   "Current"
+
+// weather conditions
+#define SUNNY     ID_STATUS_ONLINE
+#define NA        ID_STATUS_OFFLINE
+#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 UNAVAIL   40081
+
 // status
 #define NOSTATUSDATA	1
 
@@ -75,7 +95,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define WDBM_DETAILDISPLAY	2
 
 // more info list column width
-#define LIST_COLUMN		150
+#define LIST_COLUMN		 150
 
 // others
 #define NODATA			TranslateT("N/A")
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index d8720af41d..a324f74f13 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -75,9 +75,9 @@ static const PLUGININFOEX pluginInfoEx =
 };
 
 CMPlugin::CMPlugin() :
-	PLUGIN<CMPlugin>(WEATHERPROTONAME, pluginInfoEx)
+	PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
 {
-	opt.NoProtoCondition = db_get_b(0, WEATHERPROTONAME, "NoStatus", true);
+	opt.NoProtoCondition = g_plugin.getByte("NoStatus", true);
 	RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL);
 	SetUniqueId("ID");
 }
@@ -111,7 +111,7 @@ int OnToolbarLoaded(WPARAM, LPARAM)
 	ttb.pszTooltipDn = LPGEN("Auto Update Disabled");
 	ttb.hIconHandleUp = GetIconHandle("main");
 	ttb.hIconHandleDn = GetIconHandle("disabled");
-	ttb.dwFlags = (db_get_b(0, WEATHERPROTONAME, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
+	ttb.dwFlags = (g_plugin.getByte("AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
 	hTBButton = g_plugin.addTTB(&ttb);
 	return 0;
 }
@@ -194,12 +194,12 @@ int CMPlugin::Load()
 	InitServices();
 
 	// add sound event
-	g_plugin.addSound("weatherupdated", _A2W(WEATHERPROTONAME), LPGENW("Condition Changed"));
-	g_plugin.addSound("weatheralert", _A2W(WEATHERPROTONAME), LPGENW("Alert Issued"));
+	g_plugin.addSound("weatherupdated", _A2W(MODULENAME), LPGENW("Condition Changed"));
+	g_plugin.addSound("weatheralert", _A2W(MODULENAME), LPGENW("Alert Issued"));
 
 	// window needed for popup commands
 	wchar_t SvcFunc[100];
-	mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
+	mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(MODULENAME));
 	hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
 		CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr);
 	SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 686fe935c5..c40fd5c431 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -44,7 +44,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
 		if (IsMyContact(hContact)) {
 			DBVARIANT dbv;
 			// check ID to see if the contact already exist in the database
-			if (!db_get_ws(hContact, WEATHERPROTONAME, "ID", &dbv)) {
+			if (!g_plugin.getWString(hContact, "ID", &dbv)) {
 				if (!mir_wstrcmpi(psr->email.w, dbv.pwszVal)) {
 					// remove the flag for not on list and hidden, thus make the contact visible
 					// and add them on the list
@@ -64,7 +64,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
 	// if contact with the same ID was not found, add it
 	if (psr->cbSize < sizeof(PROTOSEARCHRESULT)) return 0;
 	MCONTACT hContact = db_add_contact();
-	Proto_AddToContact(hContact, WEATHERPROTONAME);
+	Proto_AddToContact(hContact, MODULENAME);
 	// suppress online notification for the new contact
 	CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
 
@@ -75,28 +75,28 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
 	// set settings by obtaining the default for the service 
 	if (psr->lastName.w[0] != 0) {
 		WIDATA *sData = GetWIData(svc);
-		db_set_ws(hContact, WEATHERPROTONAME, "MapURL", sData->DefaultMap);
-		db_set_s(hContact, WEATHERPROTONAME, "InfoURL", sData->DefaultURL);
+		g_plugin.setWString(hContact, "MapURL", sData->DefaultMap);
+		g_plugin.setString(hContact, "InfoURL", sData->DefaultURL);
 	}
 	else { // if no valid service is found, create empty strings for MapURL and InfoURL
-		db_set_s(hContact, WEATHERPROTONAME, "MapURL", "");
-		db_set_s(hContact, WEATHERPROTONAME, "InfoURL", "");
+		g_plugin.setString(hContact, "MapURL", "");
+		g_plugin.setString(hContact, "InfoURL", "");
 	}
 	// write the other info and settings to the database
-	db_set_ws(hContact, WEATHERPROTONAME, "ID", psr->email.w);
-	db_set_ws(hContact, WEATHERPROTONAME, "Nick", psr->nick.w);
-	db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
+	g_plugin.setWString(hContact, "ID", psr->email.w);
+	g_plugin.setWString(hContact, "Nick", psr->nick.w);
+	g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
 
 	AvatarDownloaded(hContact);
 
 	wchar_t str[256];
 	mir_snwprintf(str, TranslateT("Current weather information for %s."), psr->nick.w);
-	db_set_ws(hContact, WEATHERPROTONAME, "About", str);
+	g_plugin.setWString(hContact, "About", str);
 
 	// make the last update tags to something invalid
-	db_set_s(hContact, WEATHERPROTONAME, "LastLog", "never");
-	db_set_s(hContact, WEATHERPROTONAME, "LastCondition", "None");
-	db_set_s(hContact, WEATHERPROTONAME, "LastTemperature", "None");
+	g_plugin.setString(hContact, "LastLog", "never");
+	g_plugin.setString(hContact, "LastCondition", "None");
+	g_plugin.setString(hContact, "LastTemperature", "None");
 
 	// ignore status change
 	db_set_dw(hContact, "Ignore", "Mask", 8);
@@ -107,13 +107,13 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
 		GetStationID(hContact, opt.Default, _countof(opt.Default));
 
 		opt.DefStn = hContact;
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+		if (!g_plugin.getWString(hContact, "Nick", &dbv)) {
 			// notification message box
 			mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.pwszVal);
 			db_free(&dbv);
 			MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
 		}
-		db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
+		g_plugin.setWString("Default", opt.Default);
 	}
 	// display the Edit Settings dialog box
 	EditSettings(hContact, 0);
@@ -145,7 +145,7 @@ static void __cdecl BasicSearchTimerProc(LPVOID)
 		result = IDSearch(sttSID, sttSearchId);
 
 	// broadcast the search result
-	ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId);
+	ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId);
 
 	// exit the search
 	sttSearchId = -1;
@@ -175,7 +175,7 @@ static void __cdecl NameSearchTimerProc(LPVOID)
 			NameSearch(name1, sttSearchId);	// search nickname field
 
 	// broadcast the result
-	ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId);
+	ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)sttSearchId);
 
 	// exit the search
 	sttSearchId = -1;
@@ -260,7 +260,7 @@ int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *s
 	psr.firstName.w = L" ";
 	psr.lastName.w = svcname;
 	psr.email.w = newID;
-	ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
+	ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
 
 	return 0;
 }
@@ -290,7 +290,7 @@ int IDSearch(wchar_t *sID, const int searchId)
 		psr.firstName.w = L" ";
 		psr.lastName.w = L"";
 		psr.email.w = TranslateT("<Enter station ID here>");		// to be entered
-		ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
+		ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
 	}
 
 	return 0;
@@ -353,7 +353,7 @@ int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar
 				psr.lastName.w = svcname;
 				psr.email.w = sID;
 				psr.id.w = sID;
-				ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
+				ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
 				mir_free(szData);
 				return 0;
 			}
@@ -391,7 +391,7 @@ int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar
 					psr.lastName.w = svcname;
 					psr.email.w = sID;
 					psr.id.w = sID;
-					ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
+					ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
 				}
 			}
 		}
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp
index 2f1b66d03d..fd3b731699 100644
--- a/plugins/Weather/src/weather_contacts.cpp
+++ b/plugins/Weather/src/weather_contacts.cpp
@@ -41,7 +41,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam)
 {
 	// see if the log path is set
 	DBVARIANT dbv;
-	if (!db_get_ws(wParam, WEATHERPROTONAME, "Log", &dbv)) {
+	if (!g_plugin.getWString(wParam, "Log", &dbv)) {
 		if (dbv.pszVal[0] != 0)
 			ShellExecute((HWND)lParam, L"open", dbv.pwszVal, L"", L"", SW_SHOW);
 		db_free(&dbv);
@@ -60,7 +60,7 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM)
 	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, WEATHERPROTONAME, "InfoURL", loc2, _countof(loc2)) || loc2[0] == 0) {
+		if (db_get_wstatic(wParam, MODULENAME, "InfoURL", loc2, _countof(loc2)) || loc2[0] == 0) {
 			MessageBox(nullptr, NO_FORECAST_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
 			return 1;
 		}
@@ -78,7 +78,7 @@ INT_PTR WeatherMap(WPARAM wParam, LPARAM)
 	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, WEATHERPROTONAME, "MapURL", loc2, _countof(loc2)) || loc2[0] == 0) {
+		if (db_get_wstatic(wParam, MODULENAME, "MapURL", loc2, _countof(loc2)) || loc2[0] == 0) {
 			MessageBox(nullptr, NO_MAP_URL, TranslateT("Weather Protocol"), MB_ICONINFORMATION);
 			return 1;
 		}
@@ -158,17 +158,17 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
 
 		// start to get the settings
 		// if the setting not exist, leave the dialog box blank
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "ID", &dbv)) {
+		if (!g_plugin.getWString(hContact, "ID", &dbv)) {
 			SetDlgItemText(hwndDlg, IDC_ID, dbv.pwszVal);
 			// check if the station is a default station
 			CheckDlgButton(hwndDlg, IDC_DEFA, mir_wstrcmp(dbv.pwszVal, opt.Default) != 0 ? BST_CHECKED : BST_UNCHECKED);
 			db_free(&dbv);
 		}
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+		if (!g_plugin.getWString(hContact, "Nick", &dbv)) {
 			SetDlgItemText(hwndDlg, IDC_NAME, dbv.pwszVal);
 			db_free(&dbv);
 		}
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "Log", &dbv)) {
+		if (!g_plugin.getWString(hContact, "Log", &dbv)) {
 			SetDlgItemText(hwndDlg, IDC_LOG, dbv.pwszVal);
 			// if the log path is not empty, check the checkbox for external log
 			if (dbv.pwszVal[0]) CheckDlgButton(hwndDlg, IDC_External, BST_CHECKED);
@@ -178,21 +178,21 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
 		EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External));
 
 		// other checkbox options
-		CheckDlgButton(hwndDlg, IDC_DPop, db_get_b(hContact, WEATHERPROTONAME, "DPopUp", FALSE) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_DAutoUpdate, db_get_b(hContact, WEATHERPROTONAME, "DAutoUpdate", FALSE) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_Internal, db_get_b(hContact, WEATHERPROTONAME, "History", 0) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_DPop, g_plugin.getByte(hContact, "DPopUp", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_DAutoUpdate, g_plugin.getByte(hContact, "DAutoUpdate", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_Internal, g_plugin.getByte(hContact, "History", 0) ? BST_CHECKED : BST_UNCHECKED);
 
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "InfoURL", &dbv)) {
+		if (!g_plugin.getWString(hContact, "InfoURL", &dbv)) {
 			SetDlgItemText(hwndDlg, IDC_IURL, dbv.pwszVal);
 			db_free(&dbv);
 		}
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "MapURL", &dbv)) {
+		if (!g_plugin.getWString(hContact, "MapURL", &dbv)) {
 			SetDlgItemText(hwndDlg, IDC_MURL, dbv.pwszVal);
 			db_free(&dbv);
 		}
 
 		// display the dialog box and free memory
-		Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, WEATHERPROTONAME, "EditSetting_");
+		Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, MODULENAME, "EditSetting_");
 		ShowWindow(hwndDlg, SW_SHOW);
 		break;
 
@@ -341,38 +341,38 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
 			// temporary disable the protocol while applying the change
 			// start writing the new settings to database
 			GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
-			db_set_ws(hContact, WEATHERPROTONAME, "ID", str);
+			g_plugin.setWString(hContact, "ID", str);
 			if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFA)) {	// if default station is set
 				mir_wstrcpy(opt.Default, str);
 				opt.DefStn = hContact;
-				db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
+				g_plugin.setWString("Default", opt.Default);
 			}
 			GetDlgItemText(hwndDlg, IDC_NAME, city, _countof(city));
-			db_set_ws(hContact, WEATHERPROTONAME, "Nick", city);
+			g_plugin.setWString(hContact, "Nick", city);
 			mir_snwprintf(str2, TranslateT("Current weather information for %s."), city);
 			if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)) {
 				GetDlgItemText(hwndDlg, IDC_LOG, str, _countof(str));
-				db_set_ws(hContact, WEATHERPROTONAME, "Log", str);
+				g_plugin.setWString(hContact, "Log", str);
 			}
-			else db_unset(hContact, WEATHERPROTONAME, "Log");
+			else g_plugin.delSetting(hContact, "Log");
 
 			GetDlgItemText(hwndDlg, IDC_IURL, str, _countof(str));
-			db_set_ws(hContact, WEATHERPROTONAME, "InfoURL", str);
+			g_plugin.setWString(hContact, "InfoURL", str);
 
 			GetDlgItemText(hwndDlg, IDC_MURL, str, _countof(str));
-			db_set_ws(hContact, WEATHERPROTONAME, "MapURL", str);
-			db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
-			db_set_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
+			g_plugin.setWString(hContact, "MapURL", str);
+			g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
+			g_plugin.setWord(hContact, "StatusIcon", ID_STATUS_OFFLINE);
 			AvatarDownloaded(hContact);
-			db_set_ws(hContact, WEATHERPROTONAME, "About", str2);
-			db_set_b(hContact, WEATHERPROTONAME, "History", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_Internal));
-			db_set_b(hContact, WEATHERPROTONAME, "Overwrite", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_Overwrite));
-			db_set_b(hContact, WEATHERPROTONAME, "File", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External));
-			db_set_b(hContact, WEATHERPROTONAME, "DPopUp", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DPop));
-			db_set_b(hContact, WEATHERPROTONAME, "DAutoUpdate", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DAutoUpdate));
+			g_plugin.setWString(hContact, "About", str2);
+			g_plugin.setByte(hContact, "History", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_Internal));
+			g_plugin.setByte(hContact, "Overwrite", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_Overwrite));
+			g_plugin.setByte(hContact, "File", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External));
+			g_plugin.setByte(hContact, "DPopUp", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DPop));
+			g_plugin.setByte(hContact, "DAutoUpdate", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DAutoUpdate));
 
 			// re-enable the protocol and update the data for the station
-			db_set_s(hContact, WEATHERPROTONAME, "LastCondition", "None");
+			g_plugin.setString(hContact, "LastCondition", "None");
 			UpdateSingleStation(hContact, 0);
 			__fallthrough;
 
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
 		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
 
 		WindowList_Remove(hWindowList, hwndDlg);
-		Utils_SaveWindowPosition(hwndDlg, NULL, WEATHERPROTONAME, "EditSetting_");
+		Utils_SaveWindowPosition(hwndDlg, NULL, MODULENAME, "EditSetting_");
 		break;
 	}
 	return FALSE;
@@ -437,7 +437,7 @@ int ContactDeleted(WPARAM wParam, LPARAM)
 	removeWindow(wParam);
 
 	// exit this function if it is not default station
-	ptrW tszID(db_get_wsa(wParam, WEATHERPROTONAME, "ID"));
+	ptrW tszID(g_plugin.getWStringA(wParam, "ID"));
 	if (tszID != NULL)
 		if (mir_wstrcmp(tszID, opt.Default))
 			return 0;
@@ -445,8 +445,8 @@ int ContactDeleted(WPARAM wParam, LPARAM)
 	// now the default station is deleted, try to get a new one
 
 	// start looking for other weather stations
-	for (auto &hContact : Contacts(WEATHERPROTONAME)) {
-		tszID = db_get_wsa(hContact, WEATHERPROTONAME, "ID");
+	for (auto &hContact : Contacts(MODULENAME)) {
+		tszID = g_plugin.getWStringA(hContact, "ID");
 		if (tszID == NULL)
 			continue;
 
@@ -455,13 +455,13 @@ int ContactDeleted(WPARAM wParam, LPARAM)
 		if (mir_wstrcmp(opt.Default, tszID)) {
 			wcsncpy_s(opt.Default, tszID, _TRUNCATE);
 			opt.DefStn = hContact;
-			ptrW tszNick(db_get_wsa(hContact, WEATHERPROTONAME, "Nick"));
+			ptrW tszNick(g_plugin.getWStringA(hContact, "Nick"));
 			if (tszNick != NULL) {
 				wchar_t str[255];
 				mir_snwprintf(str, TranslateT("%s is now the default weather station"), (wchar_t*)tszNick);
 				MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
 			}
-			db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
+			g_plugin.setWString("Default", opt.Default);
 			return 0;		// exit this function quickly
 		}
 	}
@@ -469,12 +469,12 @@ int ContactDeleted(WPARAM wParam, LPARAM)
 	// got here if no more weather station left
 	opt.Default[0] = 0;	// no default station
 	opt.DefStn = NULL;
-	db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
+	g_plugin.setWString("Default", opt.Default);
 	return 0;
 }
 
 BOOL IsMyContact(MCONTACT hContact)
 {
 	const char *szProto = GetContactProto(hContact);
-	return szProto != nullptr && mir_strcmp(WEATHERPROTONAME, szProto) == 0;
+	return szProto != nullptr && mir_strcmp(MODULENAME, szProto) == 0;
 }
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp
index dfe095e386..f6492b5a1e 100644
--- a/plugins/Weather/src/weather_data.cpp
+++ b/plugins/Weather/src/weather_data.cpp
@@ -33,7 +33,7 @@ saving individual weather data for a weather contact.
 void GetStationID(MCONTACT hContact, wchar_t* id, int idlen)
 {
 	// accessing the database
-	if (db_get_wstatic(hContact, WEATHERPROTONAME, "ID", id, idlen))
+	if (db_get_wstatic(hContact, MODULENAME, "ID", id, idlen))
 		id[0] = 0;
 }
 
@@ -49,7 +49,7 @@ WEATHERINFO LoadWeatherInfo(MCONTACT hContact)
 	winfo.hContact = hContact;
 	GetStationID(hContact, winfo.id, _countof(winfo.id));
 
-	if (db_get_wstatic(hContact, WEATHERPROTONAME, "Nick", winfo.city, _countof(winfo.city)))
+	if (db_get_wstatic(hContact, MODULENAME, "Nick", winfo.city, _countof(winfo.city)))
 		wcsncpy(winfo.city, NODATA, _countof(winfo.city) - 1);
 	if (db_get_wstatic(hContact, WEATHERCONDITION, "Update", winfo.update, _countof(winfo.update)))
 		wcsncpy(winfo.update, NODATA, _countof(winfo.update) - 1);
@@ -80,7 +80,7 @@ WEATHERINFO LoadWeatherInfo(MCONTACT hContact)
 	if (db_get_wstatic(hContact, WEATHERCONDITION, "Feel", winfo.feel, _countof(winfo.feel)))
 		wcsncpy(winfo.feel, NODATA, _countof(winfo.feel) - 1);
 
-	winfo.status = (WORD)db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
+	winfo.status = g_plugin.getWord(hContact, "StatusIcon", ID_STATUS_OFFLINE);
 	return winfo;
 }
 
@@ -112,36 +112,36 @@ void EraseAllInfo()
 	MCONTACT LastContact = NULL;
 	DBVARIANT dbv;
 	// loop through all contacts
-	for (auto &hContact : Contacts(WEATHERPROTONAME)) {
-		db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
-		db_set_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
+	for (auto &hContact : Contacts(MODULENAME)) {
+		g_plugin.setWord(hContact, "Status", ID_STATUS_OFFLINE);
+		g_plugin.setWord(hContact, "StatusIcon", ID_STATUS_OFFLINE);
 		db_unset(hContact, "CList", "MyHandle");
 		// clear all data
-		if (db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
-			db_set_ws(hContact, WEATHERPROTONAME, "Nick", TranslateT("<Enter city name here>"));
-			db_set_s(hContact, WEATHERPROTONAME, "LastLog", "never");
-			db_set_s(hContact, WEATHERPROTONAME, "LastCondition", "None");
-			db_set_s(hContact, WEATHERPROTONAME, "LastTemperature", "None");
+		if (g_plugin.getWString(hContact, "Nick", &dbv)) {
+			g_plugin.setWString(hContact, "Nick", TranslateT("<Enter city name here>"));
+			g_plugin.setString(hContact, "LastLog", "never");
+			g_plugin.setString(hContact, "LastCondition", "None");
+			g_plugin.setString(hContact, "LastTemperature", "None");
 		}
 		else db_free(&dbv);
 
 		DBDataManage(hContact, WDBM_REMOVE, 0, 0);
 		db_set_s(hContact, "UserInfo", "MyNotes", "");
 		// reset update tag
-		db_set_b(hContact, WEATHERPROTONAME, "IsUpdated", FALSE);
+		g_plugin.setByte(hContact, "IsUpdated", FALSE);
 		// reset logging settings
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "Log", &dbv)) {
-			db_set_b(hContact, WEATHERPROTONAME, "File", (BYTE)(dbv.pwszVal[0] != 0));
+		if (!g_plugin.getWString(hContact, "Log", &dbv)) {
+			g_plugin.setByte(hContact, "File", (BYTE)(dbv.pwszVal[0] != 0));
 			db_free(&dbv);
 		}
-		else db_set_b(hContact, WEATHERPROTONAME, "File", FALSE);
+		else g_plugin.setByte(hContact, "File", FALSE);
 
 		// if no default station find, assign a new one
 		if (opt.Default[0] == 0) {
 			GetStationID(hContact, opt.Default, _countof(opt.Default));
 
 			opt.DefStn = hContact;
-			if (!db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv)) {
+			if (!g_plugin.getWString(hContact, "Nick", &dbv)) {
 				mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.pwszVal);
 				db_free(&dbv);
 				MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
@@ -149,7 +149,7 @@ void EraseAllInfo()
 		}
 		// get the handle of the default station
 		if (opt.DefStn == NULL) {
-			if (!db_get_ws(hContact, WEATHERPROTONAME, "ID", &dbv)) {
+			if (!g_plugin.getWString(hContact, "ID", &dbv)) {
 				if (!mir_wstrcmp(dbv.pwszVal, opt.Default))
 					opt.DefStn = hContact;
 				db_free(&dbv);
@@ -163,19 +163,19 @@ void EraseAllInfo()
 	// if (ContactCount != 0) status = ONLINE;
 	// in case where the default station is missing
 	if (opt.DefStn == NULL && ContactCount != 0) {
-		if (!db_get_ws(LastContact, WEATHERPROTONAME, "ID", &dbv)) {
+		if (!g_plugin.getWString(LastContact, "ID", &dbv)) {
 			wcsncpy(opt.Default, dbv.pwszVal, _countof(opt.Default) - 1);
 			db_free(&dbv);
 		}
 		opt.DefStn = LastContact;
-		if (!db_get_ws(LastContact, WEATHERPROTONAME, "Nick", &dbv)) {
+		if (!g_plugin.getWString(LastContact, "Nick", &dbv)) {
 			mir_snwprintf(str, TranslateT("%s is now the default weather station"), dbv.pwszVal);
 			db_free(&dbv);
 			MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
 		}
 	}
 	// save option in case of default station changed
-	db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
+	g_plugin.setWString("Default", opt.Default);
 }
 
 void ConvertDataValue(WIDATAITEM *UpdateData, wchar_t *Data)
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index 514bec27e5..09679980e6 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -151,7 +151,7 @@ void NetlibInit(void)
 {
 	NETLIBUSER nlu = {};
 	nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE;
-	nlu.szSettingsModule = WEATHERPROTONAME;
+	nlu.szSettingsModule = MODULENAME;
 	nlu.szDescriptiveName.w = TranslateT("Weather HTTP connections");
 	hNetlibUser = Netlib_RegisterUser(&nlu);
 }
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp
index aab1c1e562..fe6cd34f24 100644
--- a/plugins/Weather/src/weather_icons.cpp
+++ b/plugins/Weather/src/weather_icons.cpp
@@ -39,13 +39,13 @@ static IconItem iconList[] =
 
 void InitIcons(void)
 {
-	g_plugin.registerIcon(WEATHERPROTONAME, iconList, WEATHERPROTONAME);
+	g_plugin.registerIcon(MODULENAME, iconList, MODULENAME);
 }
 
 HICON LoadIconEx(const char* name, bool big)
 {
 	char szSettingName[100];
-	mir_snprintf(szSettingName, "%s_%s", WEATHERPROTONAME, name);
+	mir_snprintf(szSettingName, "%s_%s", MODULENAME, name);
 	return IcoLib_GetIcon(szSettingName, big);
 }
 
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 7f7992a6b0..043b35df0c 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -136,32 +136,30 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
 			RECT r, rc;
 
 			if (GetUpdateRect(hwnd, &r, FALSE)) {
-				PAINTSTRUCT ps;
-				LOGFONT lfnt, lfnt1;
-				COLORREF fntc, fntc1;
-				COLORREF clr;
 				int picSize = opt.AvatarSize;
 				HICON hIcon = nullptr;
 
 				if (!data->haveAvatar) {
-					int statusIcon = db_get_w(data->hContact, WEATHERPROTONAME, "Status", 0);
+					int statusIcon = g_plugin.getWord(data->hContact, "Status");
 
 					picSize = GetSystemMetrics(SM_CXICON);
-					hIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon, true);
+					hIcon = Skin_LoadProtoIcon(MODULENAME, statusIcon, true);
 					if ((INT_PTR)hIcon == CALLSERVICE_NOTFOUND) {
 						picSize = GetSystemMetrics(SM_CXSMICON);
-						hIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, statusIcon);
+						hIcon = Skin_LoadProtoIcon(MODULENAME, statusIcon);
 					}
 				}
 
-				clr = db_get_dw(0, WEATHERPROTONAME, "ColorMwinFrame", GetSysColor(COLOR_3DFACE));
-				fntc = Font_GetW(_A2W(WEATHERPROTONAME), LPGENW("Frame Font"), &lfnt);
-				fntc1 = Font_GetW(_A2W(WEATHERPROTONAME), LPGENW("Frame Title Font"), &lfnt1);
+				LOGFONT lfnt, lfnt1;
+				COLORREF clr = g_plugin.getDword("ColorMwinFrame", GetSysColor(COLOR_3DFACE));
+				COLORREF fntc = Font_GetW(_A2W(MODULENAME), LPGENW("Frame Font"), &lfnt);
+				COLORREF fntc1 = Font_GetW(_A2W(MODULENAME), LPGENW("Frame Title Font"), &lfnt1);
 
 				ptrW tszInfo(db_get_wsa(data->hContact, WEATHERCONDITION, "WeatherInfo"));
 
 				GetClientRect(hwnd, &rc);
 
+				PAINTSTRUCT ps;
 				HDC hdc = BeginPaint(hwnd, &ps);
 
 				if (ServiceExists(MS_SKIN_DRAWGLYPH)) {
@@ -230,7 +228,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
 static void addWindow(MCONTACT hContact)
 {
 	DBVARIANT dbv;
-	if (db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv))
+	if (g_plugin.getWString(hContact, "Nick", &dbv))
 		return;
 
 	wchar_t winname[512];
@@ -251,18 +249,18 @@ static void addWindow(MCONTACT hContact)
 	Frame.height = 32;
 	int frameID = g_plugin.addFrame(&Frame);
 
-	db_set_dw(hContact, WEATHERPROTONAME, "mwin", frameID);
+	g_plugin.setDword(hContact, "mwin", frameID);
 	db_set_b(hContact, "CList", "Hidden", TRUE);
 }
 
 void removeWindow(MCONTACT hContact)
 {
-	DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0);
+	DWORD frameId = g_plugin.getDword(hContact, "mwin");
 
 	WindowList_Remove(hMwinWindowList, WindowList_Find(hMwinWindowList, hContact));
 	CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
 
-	db_set_dw(hContact, WEATHERPROTONAME, "mwin", 0);
+	g_plugin.setDword(hContact, "mwin", 0);
 	db_unset(hContact, "CList", "Hidden");
 }
 
@@ -285,7 +283,7 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM)
 
 int BuildContactMenu(WPARAM wparam, LPARAM)
 {
-	int flags = db_get_dw(wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0;
+	int flags = g_plugin.getDword(wparam, "mwin") ? CMIF_CHECKED : 0;
 	Menu_ModifyItem(hMwinMenu, nullptr, INVALID_HANDLE_VALUE, flags);
 	return 0;
 }
@@ -317,17 +315,17 @@ void InitMwin(void)
 	RegisterClass(&wndclass);
 
 	ColourIDW colourid = {};
-	mir_strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME);
+	mir_strcpy(colourid.dbSettingsGroup, MODULENAME);
 	mir_strcpy(colourid.setting, "ColorMwinFrame");
 	mir_wstrcpy(colourid.name, LPGENW("Frame Background"));
-	mir_wstrcpy(colourid.group, _A2W(WEATHERPROTONAME));
+	mir_wstrcpy(colourid.group, _A2W(MODULENAME));
 	colourid.defcolour = GetSysColor(COLOR_3DFACE);
 	g_plugin.addColor(&colourid);
 
 	FontIDW fontid = {};
 	fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
-	mir_strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME);
-	mir_wstrcpy(fontid.group, _A2W(WEATHERPROTONAME));
+	mir_strcpy(fontid.dbSettingsGroup, MODULENAME);
+	mir_wstrcpy(fontid.group, _A2W(MODULENAME));
 	mir_wstrcpy(fontid.name, LPGENW("Frame Font"));
 	mir_strcpy(fontid.setting, "fnt0");
 
@@ -337,7 +335,7 @@ void InitMwin(void)
 
 	fontid.deffontsettings.charset = DEFAULT_CHARSET;
 	mir_wstrcpy(fontid.deffontsettings.szFace, L"Verdana");
-	mir_wstrcpy(fontid.backgroundGroup, _A2W(WEATHERPROTONAME));
+	mir_wstrcpy(fontid.backgroundGroup, _A2W(MODULENAME));
 	mir_wstrcpy(fontid.backgroundName, LPGENW("Frame Background"));
 	g_plugin.addFont(&fontid);
 
@@ -346,8 +344,8 @@ void InitMwin(void)
 	mir_strcpy(fontid.setting, "fnt1");
 	g_plugin.addFont(&fontid);
 
-	for (auto &hContact : Contacts(WEATHERPROTONAME))
-		if (db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0))
+	for (auto &hContact : Contacts(MODULENAME))
+		if (g_plugin.getDword(hContact, "mwin"))
 			addWindow(hContact);
 
 	hFontHook = HookEvent(ME_FONT_RELOAD, RedrawFrame);
@@ -355,8 +353,8 @@ void InitMwin(void)
 
 void DestroyMwin(void)
 {
-	for (auto &hContact : Contacts(WEATHERPROTONAME)) {
-		DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0);
+	for (auto &hContact : Contacts(MODULENAME)) {
+		DWORD frameId = g_plugin.getDword(hContact, "mwin");
 		if (frameId)
 			CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
 	}
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index 3bb684331e..fdde8ff97a 100644
--- a/plugins/Weather/src/weather_opt.cpp
+++ b/plugins/Weather/src/weather_opt.cpp
@@ -97,100 +97,100 @@ void LoadOptions(void)
 	memset(&opt, 0, sizeof(opt));
 
 	// main options
-	opt.StartupUpdate = db_get_b(0, WEATHERPROTONAME, "StartupUpdate", true);
-	opt.AutoUpdate = db_get_b(0, WEATHERPROTONAME, "AutoUpdate", true);
-	opt.UpdateTime = db_get_w(0, WEATHERPROTONAME, "UpdateTime", 30);
-	opt.NoProtoCondition = db_get_b(0, WEATHERPROTONAME, "NoStatus", true);
-	opt.UpdateOnlyConditionChanged = db_get_b(0, WEATHERPROTONAME, "CondChangeAsUpdate", true);
-	opt.RemoveOldData = db_get_b(0, WEATHERPROTONAME, "RemoveOld", false);
-	opt.MakeItalic = db_get_b(0, WEATHERPROTONAME, "MakeItalic", true);
-	opt.AvatarSize = db_get_b(0, WEATHERPROTONAME, "AvatarSize", 128);
+	opt.StartupUpdate = g_plugin.getByte("StartupUpdate", true);
+	opt.AutoUpdate = g_plugin.getByte("AutoUpdate", true);
+	opt.UpdateTime = g_plugin.getWord("UpdateTime", 30);
+	opt.NoProtoCondition = g_plugin.getByte("NoStatus", true);
+	opt.UpdateOnlyConditionChanged = g_plugin.getByte("CondChangeAsUpdate", true);
+	opt.RemoveOldData = g_plugin.getByte("RemoveOld", false);
+	opt.MakeItalic = g_plugin.getByte("MakeItalic", true);
+	opt.AvatarSize = g_plugin.getByte("AvatarSize", 128);
 
 	// units
-	opt.tUnit = db_get_w(0, WEATHERPROTONAME, "tUnit", 1);
-	opt.wUnit = db_get_w(0, WEATHERPROTONAME, "wUnit", 2);
-	opt.vUnit = db_get_w(0, WEATHERPROTONAME, "vUnit", 1);
-	opt.pUnit = db_get_w(0, WEATHERPROTONAME, "pUnit", 4);
-	opt.dUnit = db_get_w(0, WEATHERPROTONAME, "dUnit", 1);
-	opt.eUnit = db_get_w(0, WEATHERPROTONAME, "eUnit", 2);
-
-	ptrW szValue(db_get_wsa(NULL, WEATHERPROTONAME, "DegreeSign"));
+	opt.tUnit = g_plugin.getWord("tUnit", 1);
+	opt.wUnit = g_plugin.getWord("wUnit", 2);
+	opt.vUnit = g_plugin.getWord("vUnit", 1);
+	opt.pUnit = g_plugin.getWord("pUnit", 4);
+	opt.dUnit = g_plugin.getWord("dUnit", 1);
+	opt.eUnit = g_plugin.getWord("eUnit", 2);
+
+	ptrW szValue(g_plugin.getWStringA("DegreeSign"));
 	wcsncpy_s(opt.DegreeSign, (szValue == NULL) ? L"" : szValue, _TRUNCATE);
 
-	opt.DoNotAppendUnit = db_get_b(0, WEATHERPROTONAME, "DoNotAppendUnit", 0);
-	opt.NoFrac = db_get_b(0, WEATHERPROTONAME, "NoFractions", 0);
+	opt.DoNotAppendUnit = g_plugin.getByte("DoNotAppendUnit", 0);
+	opt.NoFrac = g_plugin.getByte("NoFractions", 0);
 
 	// texts
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "DisplayText"))
+	if (szValue = g_plugin.getWStringA("DisplayText"))
 		wSetData(&opt.cText, TranslateW(szValue));
 	else
 		SetTextDefault("C");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "BriefTextTitle"))
+	if (szValue = g_plugin.getWStringA("BriefTextTitle"))
 		wSetData(&opt.bTitle, TranslateW(szValue));
 	else
 		SetTextDefault("b");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "BriefText"))
+	if (szValue = g_plugin.getWStringA("BriefText"))
 		wSetData(&opt.bText, TranslateW(szValue));
 	else
 		SetTextDefault("B");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "NoteText"))
+	if (szValue = g_plugin.getWStringA("NoteText"))
 		wSetData(&opt.nText, TranslateW(szValue));
 	else
 		SetTextDefault("N");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "ExtText"))
+	if (szValue = g_plugin.getWStringA("ExtText"))
 		wSetData(&opt.eText, TranslateW(szValue));
 	else
 		SetTextDefault("E");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "HistoryText"))
+	if (szValue = g_plugin.getWStringA("HistoryText"))
 		wSetData(&opt.hText, TranslateW(szValue));
 	else
 		SetTextDefault("H");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "ExtraText"))
+	if (szValue = g_plugin.getWStringA("ExtraText"))
 		wSetData(&opt.xText, TranslateW(szValue));
 	else
 		SetTextDefault("X");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "StatusText"))
+	if (szValue = g_plugin.getWStringA("StatusText"))
 		wSetData(&opt.sText, TranslateW(szValue));
 	else
 		SetTextDefault("S");
 
 	// advanced
-	opt.DisCondIcon = db_get_b(0, WEATHERPROTONAME, "DisableConditionIcon", false);
+	opt.DisCondIcon = g_plugin.getByte("DisableConditionIcon", false);
 	// popup options
-	opt.UsePopup = db_get_b(0, WEATHERPROTONAME, "UsePopUp", true);
-	opt.UpdatePopup = db_get_b(0, WEATHERPROTONAME, "UpdatePopup", true);
-	opt.AlertPopup = db_get_b(0, WEATHERPROTONAME, "AlertPopup", true);
-	opt.PopupOnChange = db_get_b(0, WEATHERPROTONAME, "PopUpOnChange", true);
-	opt.ShowWarnings = db_get_b(0, WEATHERPROTONAME, "ShowWarnings", true);
+	opt.UsePopup = g_plugin.getByte("UsePopUp", true);
+	opt.UpdatePopup = g_plugin.getByte("UpdatePopup", true);
+	opt.AlertPopup = g_plugin.getByte("AlertPopup", true);
+	opt.PopupOnChange = g_plugin.getByte("PopUpOnChange", true);
+	opt.ShowWarnings = g_plugin.getByte("ShowWarnings", true);
 	// popup colors
-	opt.BGColour = db_get_dw(0, WEATHERPROTONAME, "BackgroundColour", GetSysColor(COLOR_BTNFACE));
-	opt.TextColour = db_get_dw(0, WEATHERPROTONAME, "TextColour", GetSysColor(COLOR_WINDOWTEXT));
-	opt.UseWinColors = (BOOL)db_get_b(0, WEATHERPROTONAME, "UseWinColors", false);
+	opt.BGColour = g_plugin.getDword("BackgroundColour", GetSysColor(COLOR_BTNFACE));
+	opt.TextColour = g_plugin.getDword("TextColour", GetSysColor(COLOR_WINDOWTEXT));
+	opt.UseWinColors = g_plugin.getByte("UseWinColors", false);
 	// popup actions
-	opt.LeftClickAction = db_get_dw(0, WEATHERPROTONAME, "LeftClickAction", IDM_M2);
-	opt.RightClickAction = db_get_dw(0, WEATHERPROTONAME, "RightClickAction", IDM_M1);
+	opt.LeftClickAction = g_plugin.getDword("LeftClickAction", IDM_M2);
+	opt.RightClickAction = g_plugin.getDword("RightClickAction", IDM_M1);
 	// popup delay
-	opt.pDelay = db_get_dw(0, WEATHERPROTONAME, "PopupDelay", 0);
+	opt.pDelay = g_plugin.getDword("PopupDelay", 0);
 	// popup texts
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "PopupTitle"))
+	if (szValue = g_plugin.getWStringA("PopupTitle"))
 		wSetData(&opt.pTitle, szValue);
 	else
 		SetTextDefault("P");
 
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "PopupText"))
+	if (szValue = g_plugin.getWStringA("PopupText"))
 		wSetData(&opt.pText, szValue);
 	else
 		SetTextDefault("p");
 
 	// misc
-	if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "Default"))
+	if (szValue = g_plugin.getWStringA("Default"))
 		wcsncpy_s(opt.Default, szValue, _TRUNCATE);
 	else
 		opt.Default[0] = 0;
@@ -200,55 +200,55 @@ void LoadOptions(void)
 void SaveOptions(void)
 {
 	// main options
-	db_set_b(0, WEATHERPROTONAME, "StartupUpdate", (BYTE)opt.StartupUpdate);
-	db_set_b(0, WEATHERPROTONAME, "AutoUpdate", (BYTE)opt.AutoUpdate);
-	db_set_w(0, WEATHERPROTONAME, "UpdateTime", opt.UpdateTime);
-	db_set_b(0, WEATHERPROTONAME, "NoStatus", (BYTE)opt.NoProtoCondition);
-	db_set_b(0, WEATHERPROTONAME, "CondChangeAsUpdate", (BYTE)opt.UpdateOnlyConditionChanged);
-	db_set_b(0, WEATHERPROTONAME, "RemoveOld", (BYTE)opt.RemoveOldData);
-	db_set_b(0, WEATHERPROTONAME, "MakeItalic", (BYTE)opt.MakeItalic);
-	db_set_b(0, WEATHERPROTONAME, "AvatarSize", (BYTE)opt.AvatarSize);
+	g_plugin.setByte("StartupUpdate", (BYTE)opt.StartupUpdate);
+	g_plugin.setByte("AutoUpdate", (BYTE)opt.AutoUpdate);
+	g_plugin.setWord("UpdateTime", opt.UpdateTime);
+	g_plugin.setByte("NoStatus", (BYTE)opt.NoProtoCondition);
+	g_plugin.setByte("CondChangeAsUpdate", (BYTE)opt.UpdateOnlyConditionChanged);
+	g_plugin.setByte("RemoveOld", (BYTE)opt.RemoveOldData);
+	g_plugin.setByte("MakeItalic", (BYTE)opt.MakeItalic);
+	g_plugin.setByte("AvatarSize", (BYTE)opt.AvatarSize);
 	// units
-	db_set_w(0, WEATHERPROTONAME, "tUnit", opt.tUnit);
-	db_set_w(0, WEATHERPROTONAME, "wUnit", opt.wUnit);
-	db_set_w(0, WEATHERPROTONAME, "vUnit", opt.vUnit);
-	db_set_w(0, WEATHERPROTONAME, "pUnit", opt.pUnit);
-	db_set_w(0, WEATHERPROTONAME, "dUnit", opt.dUnit);
-	db_set_w(0, WEATHERPROTONAME, "eUnit", opt.eUnit);
-	db_set_ws(0, WEATHERPROTONAME, "DegreeSign", opt.DegreeSign);
-	db_set_b(0, WEATHERPROTONAME, "DoNotAppendUnit", (BYTE)opt.DoNotAppendUnit);
-	db_set_b(0, WEATHERPROTONAME, "NoFractions", (BYTE)opt.NoFrac);
+	g_plugin.setWord("tUnit", opt.tUnit);
+	g_plugin.setWord("wUnit", opt.wUnit);
+	g_plugin.setWord("vUnit", opt.vUnit);
+	g_plugin.setWord("pUnit", opt.pUnit);
+	g_plugin.setWord("dUnit", opt.dUnit);
+	g_plugin.setWord("eUnit", opt.eUnit);
+	g_plugin.setWString("DegreeSign", opt.DegreeSign);
+	g_plugin.setByte("DoNotAppendUnit", (BYTE)opt.DoNotAppendUnit);
+	g_plugin.setByte("NoFractions", (BYTE)opt.NoFrac);
 	// texts
-	db_set_ws(0, WEATHERPROTONAME, "DisplayText", opt.cText);
-	db_set_ws(0, WEATHERPROTONAME, "BriefTextTitle", opt.bTitle);
-	db_set_ws(0, WEATHERPROTONAME, "BriefText", opt.bText);
-	db_set_ws(0, WEATHERPROTONAME, "NoteText", opt.nText);
-	db_set_ws(0, WEATHERPROTONAME, "ExtText", opt.eText);
-	db_set_ws(0, WEATHERPROTONAME, "HistoryText", opt.hText);
-	db_set_ws(0, WEATHERPROTONAME, "ExtraText", opt.xText);
-	db_set_ws(0, WEATHERPROTONAME, "StatusText", opt.sText);
+	g_plugin.setWString("DisplayText", opt.cText);
+	g_plugin.setWString("BriefTextTitle", opt.bTitle);
+	g_plugin.setWString("BriefText", opt.bText);
+	g_plugin.setWString("NoteText", opt.nText);
+	g_plugin.setWString("ExtText", opt.eText);
+	g_plugin.setWString("HistoryText", opt.hText);
+	g_plugin.setWString("ExtraText", opt.xText);
+	g_plugin.setWString("StatusText", opt.sText);
 	// advanced
-	db_set_b(0, WEATHERPROTONAME, "DisableConditionIcon", (BYTE)opt.DisCondIcon);
+	g_plugin.setByte("DisableConditionIcon", (BYTE)opt.DisCondIcon);
 	// popup options
-	db_set_b(0, WEATHERPROTONAME, "UsePopUp", (BYTE)opt.UsePopup);
-	db_set_b(0, WEATHERPROTONAME, "UpdatePopup", (BYTE)opt.UpdatePopup);
-	db_set_b(0, WEATHERPROTONAME, "AlertPopup", (BYTE)opt.AlertPopup);
-	db_set_b(0, WEATHERPROTONAME, "PopUpOnChange", (BYTE)opt.PopupOnChange);
-	db_set_b(0, WEATHERPROTONAME, "ShowWarnings", (BYTE)opt.ShowWarnings);
+	g_plugin.setByte("UsePopUp", (BYTE)opt.UsePopup);
+	g_plugin.setByte("UpdatePopup", (BYTE)opt.UpdatePopup);
+	g_plugin.setByte("AlertPopup", (BYTE)opt.AlertPopup);
+	g_plugin.setByte("PopUpOnChange", (BYTE)opt.PopupOnChange);
+	g_plugin.setByte("ShowWarnings", (BYTE)opt.ShowWarnings);
 	// popup colors
-	db_set_dw(0, WEATHERPROTONAME, "BackgroundColour", opt.BGColour);
-	db_set_dw(0, WEATHERPROTONAME, "TextColour", opt.TextColour);
-	db_set_b(0, WEATHERPROTONAME, "UseWinColors", (BYTE)opt.UseWinColors);
+	g_plugin.setDword("BackgroundColour", opt.BGColour);
+	g_plugin.setDword("TextColour", opt.TextColour);
+	g_plugin.setByte("UseWinColors", (BYTE)opt.UseWinColors);
 	// popup actions
-	db_set_dw(0, WEATHERPROTONAME, "LeftClickAction", opt.LeftClickAction);
-	db_set_dw(0, WEATHERPROTONAME, "RightClickAction", opt.RightClickAction);
+	g_plugin.setDword("LeftClickAction", opt.LeftClickAction);
+	g_plugin.setDword("RightClickAction", opt.RightClickAction);
 	// popup delay
-	db_set_dw(0, WEATHERPROTONAME, "PopupDelay", opt.pDelay);
+	g_plugin.setDword("PopupDelay", opt.pDelay);
 	// popup texts
-	db_set_ws(0, WEATHERPROTONAME, "PopupTitle", opt.pTitle);
-	db_set_ws(0, WEATHERPROTONAME, "PopupText", opt.pText);
+	g_plugin.setWString("PopupTitle", opt.pTitle);
+	g_plugin.setWString("PopupText", opt.pText);
 	// misc stuff
-	db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
+	g_plugin.setWString("Default", opt.Default);
 }
 //============  MAIN OPTIONS  ============
 
@@ -329,8 +329,8 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
 			// change the status for weather protocol
 			if (IsDlgButtonChecked(hdlg, IDC_PROTOCOND) && opt.DefStn != NULL) {
 				old_status = status;
-				status = db_get_w(opt.DefStn, WEATHERPROTONAME, "StatusIcon", NOSTATUSDATA);
-				ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
+				status = g_plugin.getWord(opt.DefStn, "StatusIcon", NOSTATUSDATA);
+				ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
 			}
 
 			// get update time and remove the old timer
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index d40cc5e99f..19c56c5b73 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -125,14 +125,13 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
 int WeatherPopup(WPARAM hContact, LPARAM lParam)
 {
 	// determine if the popup should display or not
-	if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) &&
-		!db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0)) {
+	if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) && !g_plugin.getByte(hContact, "DPopUp")) {
 		WEATHERINFO winfo = LoadWeatherInfo(hContact);
 
 		// setup the popup
 		POPUPDATAT ppd = { 0 };
 		ppd.lchContact = hContact;
-		ppd.PluginData = ppd.lchIcon = Skin_LoadProtoIcon(WEATHERPROTONAME, winfo.status);
+		ppd.PluginData = ppd.lchIcon = Skin_LoadProtoIcon(MODULENAME, winfo.status);
 		GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName);
 		GetDisplay(&winfo, opt.pText, ppd.lptzText);
 		ppd.PluginWindowProc = PopupDlgProc;
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index 64fc17b9a3..e4d8d6e5ff 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -40,7 +40,7 @@ INT_PTR WeatherSetStatus(WPARAM new_status, LPARAM)
 	if (!opt.NoProtoCondition && status != new_status) {
 		old_status = status;
 		status = new_status != ID_STATUS_OFFLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
-		ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
+		ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
 
 		UpdateMenu(new_status != ID_STATUS_OFFLINE);
 		if (new_status != ID_STATUS_OFFLINE)
@@ -106,7 +106,7 @@ INT_PTR WeatherLoadIcon(WPARAM wParam, LPARAM)
 static void __cdecl AckThreadProc(HANDLE param)
 {
 	Sleep(100);
-	ProtoBroadcastAck(WEATHERPROTONAME, (DWORD_PTR)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1);
+	ProtoBroadcastAck(MODULENAME, (DWORD_PTR)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1);
 }
 
 // nothing to do here because weather proto do not need to retrieve contact info form network
@@ -134,7 +134,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
 	if (chop) *chop = '\0';
 	else szSearchPath[0] = 0;
 
-	int iStatus = db_get_w(pai->hContact, WEATHERPROTONAME, "StatusIcon", 0);
+	int iStatus = g_plugin.getWord(pai->hContact, "StatusIcon");
 	for (i = 0; i < 10; i++)
 		if (statusValue[i] == iStatus)
 			break;
@@ -163,9 +163,9 @@ void AvatarDownloaded(MCONTACT hContact)
 	ai.hContact = hContact;
 
 	if (WeatherGetAvatarInfo(GAIF_FORCE, (LPARAM)&ai) == GAIR_SUCCESS)
-		ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai);
+		ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai);
 	else
-		ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr);
+		ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, nullptr);
 }
 
 static void __cdecl WeatherGetAwayMsgThread(void *arg)
@@ -175,10 +175,10 @@ static void __cdecl WeatherGetAwayMsgThread(void *arg)
 	MCONTACT hContact = (DWORD_PTR)arg;
 	DBVARIANT dbv;
 	if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) {
-		ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.pwszVal);
+		ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.pwszVal);
 		db_free(&dbv);
 	}
-	else ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1);
+	else ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1);
 }
 
 static INT_PTR WeatherGetAwayMsg(WPARAM, LPARAM lParam)
@@ -195,21 +195,21 @@ static INT_PTR WeatherGetAwayMsg(WPARAM, LPARAM lParam)
 // protocol services
 void InitServices(void)
 {
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_GETCAPS, WeatherGetCaps);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_GETNAME, WeatherGetName);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_LOADICON, WeatherLoadIcon);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_SETSTATUS, WeatherSetStatus);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_GETSTATUS, WeatherGetStatus);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_BASICSEARCH, WeatherBasicSearch);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_SEARCHBYEMAIL, WeatherBasicSearch);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_ADDTOLIST, WeatherAddToList);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PSS_GETINFO, WeatherGetInfo);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_GETAVATARINFO, WeatherGetAvatarInfo);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PSS_GETAWAYMSG, WeatherGetAwayMsg);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_CREATEADVSEARCHUI, WeatherCreateAdvancedSearchUI);
-	CreateProtoServiceFunction(WEATHERPROTONAME, PS_SEARCHBYADVANCED, WeatherAdvancedSearch);
-
-	CreateProtoServiceFunction(WEATHERPROTONAME, MS_WEATHER_GETDISPLAY, GetDisplaySvcFunc);
+	CreateProtoServiceFunction(MODULENAME, PS_GETCAPS, WeatherGetCaps);
+	CreateProtoServiceFunction(MODULENAME, PS_GETNAME, WeatherGetName);
+	CreateProtoServiceFunction(MODULENAME, PS_LOADICON, WeatherLoadIcon);
+	CreateProtoServiceFunction(MODULENAME, PS_SETSTATUS, WeatherSetStatus);
+	CreateProtoServiceFunction(MODULENAME, PS_GETSTATUS, WeatherGetStatus);
+	CreateProtoServiceFunction(MODULENAME, PS_BASICSEARCH, WeatherBasicSearch);
+	CreateProtoServiceFunction(MODULENAME, PS_SEARCHBYEMAIL, WeatherBasicSearch);
+	CreateProtoServiceFunction(MODULENAME, PS_ADDTOLIST, WeatherAddToList);
+	CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, WeatherGetInfo);
+	CreateProtoServiceFunction(MODULENAME, PS_GETAVATARINFO, WeatherGetAvatarInfo);
+	CreateProtoServiceFunction(MODULENAME, PSS_GETAWAYMSG, WeatherGetAwayMsg);
+	CreateProtoServiceFunction(MODULENAME, PS_CREATEADVSEARCHUI, WeatherCreateAdvancedSearchUI);
+	CreateProtoServiceFunction(MODULENAME, PS_SEARCHBYADVANCED, WeatherAdvancedSearch);
+
+	CreateProtoServiceFunction(MODULENAME, MS_WEATHER_GETDISPLAY, GetDisplaySvcFunc);
 }
 
 //============  MENU INITIALIZATION  ============
@@ -218,7 +218,7 @@ void UpdateMenu(BOOL State)
 {
 	// update option setting
 	opt.CAutoUpdate = State;
-	db_set_b(0, WEATHERPROTONAME, "AutoUpdate", (BYTE)State);
+	g_plugin.setByte("AutoUpdate", (BYTE)State);
 
 	if (State) { // to enable auto-update
 		Menu_ModifyItem(hEnableDisableMenu, LPGENW("Auto Update Enabled"), GetIconHandle("main"));
@@ -236,7 +236,7 @@ void UpdatePopupMenu(BOOL State)
 {
 	// update option setting
 	opt.UsePopup = State;
-	db_set_b(0, WEATHERPROTONAME, "UsePopup", (BYTE)opt.UsePopup);
+	g_plugin.setByte("UsePopup", (BYTE)opt.UsePopup);
 
 	if (State) // to enable popup
 		Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Disable &weather notification"), GetIconHandle("popup"));
@@ -271,7 +271,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("update");
 	mi.name.a = LPGEN("Update Weather");
 	mi.pszService = MS_WEATHER_UPDATE;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	SET_UID(mi, 0x45361b4, 0x8de, 0x44b4, 0x8f, 0x11, 0x9b, 0xe9, 0x6e, 0xa8, 0x83, 0x54);
 	CreateServiceFunction(MS_WEATHER_REFRESH, UpdateSingleRemove);
@@ -279,7 +279,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("update2");
 	mi.name.a = LPGEN("Remove Old Data then Update");
 	mi.pszService = MS_WEATHER_REFRESH;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	SET_UID(mi, 0x4232975e, 0xb181, 0x46a5, 0xb7, 0x6e, 0xd2, 0x5f, 0xef, 0xb8, 0xc4, 0x4d);
 	CreateServiceFunction(MS_WEATHER_BRIEF, BriefInfoSvc);
@@ -287,7 +287,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("brief");
 	mi.name.a = LPGEN("Brief Information");
 	mi.pszService = MS_WEATHER_BRIEF;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	SET_UID(mi, 0x3d6ed729, 0xd49a, 0x4ae9, 0x8e, 0x2, 0x9f, 0xe0, 0xf0, 0x2c, 0xcc, 0xb1);
 	CreateServiceFunction(MS_WEATHER_COMPLETE, LoadForecast);
@@ -295,7 +295,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("read");
 	mi.name.a = LPGEN("Read Complete Forecast");
 	mi.pszService = MS_WEATHER_COMPLETE;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	SET_UID(mi, 0xc4b6c5e0, 0x13c3, 0x4e02, 0x8a, 0xeb, 0xeb, 0x8a, 0xe2, 0x66, 0x40, 0xd4);
 	CreateServiceFunction(MS_WEATHER_MAP, WeatherMap);
@@ -303,7 +303,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("map");
 	mi.name.a = LPGEN("Weather Map");
 	mi.pszService = MS_WEATHER_MAP;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	SET_UID(mi, 0xee3ad7f4, 0x3377, 0x4e4c, 0x8f, 0x3c, 0x3b, 0xf5, 0xd4, 0x86, 0x28, 0x25);
 	CreateServiceFunction(MS_WEATHER_LOG, ViewLog);
@@ -311,7 +311,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("log");
 	mi.name.a = LPGEN("View Log");
 	mi.pszService = MS_WEATHER_LOG;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	SET_UID(mi, 0x1b01cd6a, 0xe5ee, 0x42b4, 0xa1, 0x6d, 0x43, 0xb9, 0x4, 0x58, 0x43, 0x2e);
 	CreateServiceFunction(MS_WEATHER_EDIT, EditSettings);
@@ -319,7 +319,7 @@ void AddMenuItems(void)
 	mi.hIcolibItem = GetIconHandle("edit");
 	mi.name.a = LPGEN("Edit Settings");
 	mi.pszService = MS_WEATHER_EDIT;
-	Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+	Menu_AddContactMenuItem(&mi, MODULENAME);
 
 	// adding main menu items
 	mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Weather"), 500099000);
@@ -353,12 +353,12 @@ void AddMenuItems(void)
 	// only run if popup service exists
 	if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
 		SET_UID(mi, 0xdc5411cb, 0xb7c7, 0x443b, 0x88, 0x5a, 0x90, 0x24, 0x43, 0xde, 0x54, 0x3e);
-		CreateServiceFunction(WEATHERPROTONAME "/PopupMenu", MenuitemNotifyCmd);
+		CreateServiceFunction(MODULENAME "/PopupMenu", MenuitemNotifyCmd);
 		mi.name.a = LPGEN("Weather Notification");
 		mi.hIcolibItem = GetIconHandle("popup");
 		mi.position = 0;
 		mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
-		mi.pszService = WEATHERPROTONAME "/PopupMenu";
+		mi.pszService = MODULENAME "/PopupMenu";
 		hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi);
 		UpdatePopupMenu(opt.UsePopup);
 	}
@@ -371,6 +371,6 @@ void AddMenuItems(void)
 		mi.hIcolibItem = nullptr;
 		mi.root = nullptr;
 		mi.name.a = LPGEN("Display in a frame");
-		hMwinMenu = Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
+		hMwinMenu = Menu_AddContactMenuItem(&mi, MODULENAME);
 	}
 }
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index cb743fe631..7bd221a35a 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -45,7 +45,7 @@ int UpdateWeather(MCONTACT hContact)
 
 	// log to netlib log for debug purpose
 	Netlib_LogfW(hNetlibUser, L"************************************************************************");
-	int dbres = db_get_ws(hContact, WEATHERPROTONAME, "Nick", &dbv);
+	int dbres = g_plugin.getWString(hContact, "Nick", &dbv);
 
 	Netlib_LogfW(hNetlibUser, L"<-- Start update for station -->");
 
@@ -80,19 +80,19 @@ int UpdateWeather(MCONTACT hContact)
 
 	// compare the old condition and determine if the weather had changed
 	if (opt.UpdateOnlyConditionChanged) {	// consider condition change
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "LastCondition", &dbv)) {
+		if (!g_plugin.getWString(hContact, "LastCondition", &dbv)) {
 			if (mir_wstrcmpi(winfo.cond, dbv.pwszVal))  Ch = TRUE;		// the weather condition is changed
 			db_free(&dbv);
 		}
 		else Ch = TRUE;
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "LastTemperature", &dbv)) {
+		if (!g_plugin.getWString(hContact, "LastTemperature", &dbv)) {
 			if (mir_wstrcmpi(winfo.temp, dbv.pwszVal))  Ch = TRUE;		// the temperature is changed
 			db_free(&dbv);
 		}
 		else Ch = TRUE;
 	}
 	else {	// consider update time change
-		if (!db_get_ws(hContact, WEATHERPROTONAME, "LastUpdate", &dbv)) {
+		if (!g_plugin.getWString(hContact, "LastUpdate", &dbv)) {
 			if (mir_wstrcmpi(winfo.update, dbv.pwszVal))  Ch = TRUE;		// the update time is changed
 			db_free(&dbv);
 		}
@@ -102,31 +102,31 @@ int UpdateWeather(MCONTACT hContact)
 	// have weather alert issued?
 	dbres = db_get_ws(hContact, WEATHERCONDITION, "Alert", &dbv);
 	if (!dbres && dbv.pwszVal[0] != 0) {
-		if (opt.AlertPopup && !db_get_b(hContact, WEATHERPROTONAME, "DPopUp", 0) && Ch) {
+		if (opt.AlertPopup && !g_plugin.getByte(hContact, "DPopUp") && Ch) {
 			// display alert popup
 			mir_snwprintf(str, L"Alert for %s%c%s", winfo.city, 255, dbv.pwszVal);
 			WPShowMessage(str, SM_WEATHERALERT);
 		}
 		// alert issued, set display to italic
 		if (opt.MakeItalic)
-			db_set_w(hContact, WEATHERPROTONAME, "ApparentMode", ID_STATUS_OFFLINE);
+			g_plugin.setWord(hContact, "ApparentMode", ID_STATUS_OFFLINE);
 		Skin_PlaySound("weatheralert");
 	}
 	// alert dropped, set the display back to normal
-	else db_unset(hContact, WEATHERPROTONAME, "ApparentMode");
+	else g_plugin.delSetting(hContact, "ApparentMode");
 	if (!dbres) db_free(&dbv);
 
 	// backup current condition for checking if the weather is changed or not
-	db_set_ws(hContact, WEATHERPROTONAME, "LastLog", winfo.update);
-	db_set_ws(hContact, WEATHERPROTONAME, "LastCondition", winfo.cond);
-	db_set_ws(hContact, WEATHERPROTONAME, "LastTemperature", winfo.temp);
-	db_set_ws(hContact, WEATHERPROTONAME, "LastUpdate", winfo.update);
+	g_plugin.setWString(hContact, "LastLog", winfo.update);
+	g_plugin.setWString(hContact, "LastCondition", winfo.cond);
+	g_plugin.setWString(hContact, "LastTemperature", winfo.temp);
+	g_plugin.setWString(hContact, "LastUpdate", winfo.update);
 
 	// display condition on contact list
 	if (opt.DisCondIcon && winfo.status != ID_STATUS_OFFLINE)
-		db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_ONLINE);
+		g_plugin.setWord(hContact, "Status", ID_STATUS_ONLINE);
 	else
-		db_set_w(hContact, WEATHERPROTONAME, "Status", winfo.status);
+		g_plugin.setWord(hContact, "Status", winfo.status);
 	AvatarDownloaded(hContact);
 
 	GetDisplay(&winfo, opt.cText, str2);
@@ -138,7 +138,7 @@ int UpdateWeather(MCONTACT hContact)
 	else
 		db_unset(hContact, "CList", "StatusMsg");
 
-	ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)(str2[0] ? str2 : nullptr));
+	ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, nullptr, (LPARAM)(str2[0] ? str2 : nullptr));
 
 	// save descriptions in MyNotes
 	GetDisplay(&winfo, opt.nText, str2);
@@ -147,7 +147,7 @@ int UpdateWeather(MCONTACT hContact)
 	db_set_ws(hContact, WEATHERCONDITION, "WeatherInfo", str2);
 
 	// set the update tag
-	db_set_b(hContact, WEATHERPROTONAME, "IsUpdated", TRUE);
+	g_plugin.setByte(hContact, "IsUpdated", TRUE);
 
 	// save info for default weather condition
 	if (!mir_wstrcmp(winfo.id, opt.Default) && !opt.NoProtoCondition) {
@@ -156,7 +156,7 @@ int UpdateWeather(MCONTACT hContact)
 		status = winfo.status;
 		// a workaround for a default station that currently have an n/a icon assigned
 		if (status == ID_STATUS_OFFLINE)	status = NOSTATUSDATA;
-		ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
+		ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status);
 	}
 
 	// logging
@@ -164,11 +164,11 @@ int UpdateWeather(MCONTACT hContact)
 		// play the sound event
 		Skin_PlaySound("weatherupdated");
 
-		if (db_get_b(hContact, WEATHERPROTONAME, "File", 0)) {
+		if (g_plugin.getByte(hContact, "File")) {
 			// external log
-			if (!db_get_ws(hContact, WEATHERPROTONAME, "Log", &dbv)) {
+			if (!g_plugin.getWString(hContact, "Log", &dbv)) {
 				// for the option for overwriting the file, delete old file first
-				if (db_get_b(hContact, WEATHERPROTONAME, "Overwrite", 0))
+				if (g_plugin.getByte(hContact, "Overwrite"))
 					DeleteFile(dbv.pwszVal);
 
 				// open the file and set point to the end of file
@@ -183,14 +183,14 @@ int UpdateWeather(MCONTACT hContact)
 			}
 		}
 
-		if (db_get_b(hContact, WEATHERPROTONAME, "History", 0)) {
+		if (g_plugin.getByte(hContact, "History")) {
 			// internal log using history
 			GetDisplay(&winfo, opt.hText, str2);
 
 			T2Utf szMessage(str2);
 
 			DBEVENTINFO dbei = {};
-			dbei.szModule = WEATHERPROTONAME;
+			dbei.szModule = MODULENAME;
 			dbei.timestamp = (DWORD)time(0);
 			dbei.flags = DBEF_READ | DBEF_UTF;
 			dbei.eventType = EVENTTYPE_MESSAGE;
@@ -305,8 +305,8 @@ static void UpdateThreadProc(void *)
 void UpdateAll(BOOL AutoUpdate, BOOL RemoveData)
 {
 	// add all weather contact to the update queue list
-	for (auto &hContact : Contacts(WEATHERPROTONAME))
-		if (!db_get_b(hContact, WEATHERPROTONAME, "AutoUpdate", FALSE) || !AutoUpdate) {
+	for (auto &hContact : Contacts(MODULENAME))
+		if (!g_plugin.getByte(hContact, "AutoUpdate") || !AutoUpdate) {
 			if (RemoveData)
 				DBDataManage(hContact, WDBM_REMOVE, 0, 0);
 			UpdateListAdd(hContact);
@@ -575,8 +575,8 @@ int GetWeatherData(MCONTACT hContact)
 	}
 
 	// assign condition icon
-	db_set_w(hContact, WEATHERPROTONAME, "StatusIcon", cond);
-	db_set_ws(hContact, WEATHERPROTONAME, "MirVer", Data->DisplayName);
+	g_plugin.setWord(hContact, "StatusIcon", cond);
+	g_plugin.setWString(hContact, "MirVer", Data->DisplayName);
 	return 0;
 }
 
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index 90d3b8d4ae..023c91589f 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -60,7 +60,7 @@ static void LoadBriefInfoText(HWND hwndDlg, MCONTACT hContact)
 	// load weather information from the contact into the WEATHERINFO struct
 	winfo = LoadWeatherInfo(hContact);
 	// check if data exist.  If not, display error message box
-	if (!(BOOL)db_get_b(hContact, WEATHERPROTONAME, "IsUpdated", FALSE))
+	if (!g_plugin.getByte(hContact, "IsUpdated"))
 		wcsncpy(str, WEATHER_NO_INFO, _countof(str) - 1);
 	else
 		// set the display text and show the message box
@@ -121,7 +121,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
 		WindowList_Add(hDataWindowList, hwndDlg, hContact);
 
 		// restore window position
-		Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, WEATHERPROTONAME, "BriefInfo_");
+		Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, MODULENAME, "BriefInfo_");
 		return TRUE;
 
 	case WM_UPDATEDATA:
@@ -131,7 +131,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
 
 		// set icons
 		Window_FreeIcon_IcoLib(hwndDlg);
-		Window_SetProtoIcon_IcoLib(hwndDlg, WEATHERPROTONAME, db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0));
+		Window_SetProtoIcon_IcoLib(hwndDlg, MODULENAME, db_get_w(hContact, MODULENAME, "StatusIcon", 0));
 
 		RedrawWindow(GetDlgItem(hwndDlg, IDC_HEADERBAR), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
 		break;
@@ -226,7 +226,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
 
 	case WM_DESTROY:
 		Window_FreeIcon_IcoLib(hwndDlg);
-		Utils_SaveWindowPosition(hwndDlg, NULL, WEATHERPROTONAME, "BriefInfo_");
+		Utils_SaveWindowPosition(hwndDlg, NULL, MODULENAME, "BriefInfo_");
 		WindowList_Remove(hDataWindowList, hwndDlg);
 		break;
 	}
@@ -253,11 +253,9 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
 		w = LoadWeatherInfo(lParam);
 		SetDlgItemText(hwndDlg, IDC_INFO1, GetDisplay(&w, TranslateT("Current condition for %n"), str));
 
-		SendDlgItemMessage(hwndDlg, IDC_INFOICON, STM_SETICON,
-			(WPARAM)Skin_LoadProtoIcon(WEATHERPROTONAME,
-				db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0)), 0);
-
-		{	// bold and enlarge the current condition
+		SendDlgItemMessage(hwndDlg, IDC_INFOICON, STM_SETICON, (WPARAM)Skin_LoadProtoIcon(MODULENAME, g_plugin.getWord(hContact, "StatusIcon")), 0);
+		{
+			// bold and enlarge the current condition
 			LOGFONT lf;
 			HFONT hNormalFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_INFO2, WM_GETFONT, 0, 0);
 			GetObject(hNormalFont, sizeof(lf), &lf);
@@ -315,7 +313,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam)
 {
 	OPTIONSDIALOGPAGE odp = {};
 	odp.position = 100000000;
-	odp.szTitle.a = WEATHERPROTONAME;
+	odp.szTitle.a = MODULENAME;
 
 	if (lParam == 0) {
 		odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO);
-- 
cgit v1.2.3