diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins')
380 files changed, 4877 insertions, 4881 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 5d7bb35503..df91050b65 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -565,7 +565,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP DeleteObject(hbrush);
}
- if (data->hContact == NULL && data->proto[0] == 0 && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1))
+ if (data->hContact == NULL && data->proto[0] == 0 && g_plugin.getByte("GlobalUserAvatarNotConsistent", 1))
DrawText(hdc, data->hFont, rc, TranslateT("Protocols have different avatars"));
// Has an animated gif
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 79ccc1ddbe..d698f42b93 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -72,7 +72,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) return nullptr;
char *szProto = GetContactProto(hContact);
- if (szProto == nullptr || !db_get_b(NULL, AVS_MODULE, szProto, 1))
+ if (szProto == nullptr || !g_plugin.getByte(szProto, 1))
return nullptr;
CacheNode *cc;
@@ -222,7 +222,7 @@ void PicLoader(LPVOID) {
Thread_SetName("AVS: PicLoader");
- DWORD dwDelay = db_get_dw(NULL, AVS_MODULE, "picloader_sleeptime", 80);
+ DWORD dwDelay = g_plugin.getDword("picloader_sleeptime", 80);
if (dwDelay < 30)
dwDelay = 30;
diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index d89448e359..9717e5ddb4 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -319,7 +319,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) GetObject(*hBitmap, sizeof(bmp), &bmp);
int width = bmp.bmWidth;
int height = bmp.bmHeight;
- int colorDiff = db_get_w(hContact, "ContactPhoto", "TranspBkgColorDiff", db_get_w(0, AVS_MODULE, "TranspBkgColorDiff", 10));
+ int colorDiff = db_get_w(hContact, "ContactPhoto", "TranspBkgColorDiff", g_plugin.getWord("TranspBkgColorDiff", 10));
// Min 5x5 to easy things in loop
if (width <= 4 || height <= 4)
@@ -414,7 +414,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) if (foundBkg[i])
count++;
- if (count < db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints", db_get_w(0, AVS_MODULE, "TranspBkgNumPoints", 5))) {
+ if (count < db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints", g_plugin.getWord("TranspBkgNumPoints", 5))) {
if (hBmpTmp != *hBitmap)
DeleteObject(hBmpTmp);
free(p);
@@ -440,7 +440,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) }
if (maxCount < db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints",
- db_get_w(0, AVS_MODULE, "TranspBkgNumPoints", 5))) {
+ g_plugin.getWord("TranspBkgNumPoints", 5))) {
// Not enought corners with the same color
if (hBmpTmp != *hBitmap) DeleteObject(hBmpTmp);
free(p);
@@ -480,7 +480,7 @@ BOOL MakeTransparentBkg(MCONTACT hContact, HBITMAP *hBitmap) }
// Set alpha from borders
- bool transpProportional = (db_get_b(NULL, AVS_MODULE, "MakeTransparencyProportionalToColorDiff", 0) != 0);
+ bool transpProportional = (g_plugin.getByte("MakeTransparencyProportionalToColorDiff", 0) != 0);
int *stack = (int *)malloc(width * height * 2 * sizeof(int));
if (stack == nullptr) {
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 0d2827a0cb..057f69339c 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -57,7 +57,7 @@ static PLUGININFOEX pluginInfoEx = };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(AVS_MODULE, pluginInfoEx)
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
{}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 2558fe9626..057098a607 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -114,7 +114,7 @@ static void SetProtoPic(protoPicCacheEntry *pce) wchar_t szNewPath[MAX_PATH]; PathToRelativeW(FileName, szNewPath, g_szDataPath); - db_set_ws(NULL, PPICT_MODULE, pce->szProtoname, szNewPath); + db_set_ws(0, PPICT_MODULE, pce->szProtoname, szNewPath); switch(pce->cacheType) { case PCE_TYPE_GLOBAL: @@ -171,16 +171,16 @@ static INT_PTR CALLBACK DlgProcOptionsAvatars(HWND hwndDlg, UINT msg, WPARAM wPa case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOWWARNINGS, db_get_b(0, AVS_MODULE, "warnings", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MAKE_GRAYSCALE, db_get_b(0, AVS_MODULE, "MakeGrayscale", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MAKE_TRANSPARENT_BKG, db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MAKE_TRANSP_PROPORTIONAL, db_get_b(0, AVS_MODULE, "MakeTransparencyProportionalToColorDiff", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWWARNINGS, g_plugin.getByte("warnings", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MAKE_GRAYSCALE, g_plugin.getByte("MakeGrayscale", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MAKE_TRANSPARENT_BKG, g_plugin.getByte("MakeTransparentBkg", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MAKE_TRANSP_PROPORTIONAL, g_plugin.getByte("MakeTransparencyProportionalToColorDiff", 0) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETRANGE, 0, MAKELONG(8, 2)); - SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(0, AVS_MODULE, "TranspBkgNumPoints", 5)); + SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETPOS, 0, g_plugin.getWord("TranspBkgNumPoints", 5)); SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(0, AVS_MODULE, "TranspBkgColorDiff", 10)); + SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_SETPOS, 0, g_plugin.getWord("TranspBkgColorDiff", 10)); { BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSPARENT_BKG); EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enabled); @@ -195,8 +195,7 @@ static INT_PTR CALLBACK DlgProcOptionsAvatars(HWND hwndDlg, UINT msg, WPARAM wPa return TRUE; case WM_COMMAND: - if ((LOWORD(wParam) == IDC_BKG_NUM_POINTS || LOWORD(wParam) == IDC_BKG_COLOR_DIFFERENCE) - && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) + if ((LOWORD(wParam) == IDC_BKG_NUM_POINTS || LOWORD(wParam) == IDC_BKG_COLOR_DIFFERENCE) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return FALSE; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -218,12 +217,12 @@ static INT_PTR CALLBACK DlgProcOptionsAvatars(HWND hwndDlg, UINT msg, WPARAM wPa case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, AVS_MODULE, "warnings", IsDlgButtonChecked(hwndDlg, IDC_SHOWWARNINGS) ? 1 : 0); - db_set_b(NULL, AVS_MODULE, "MakeGrayscale", IsDlgButtonChecked(hwndDlg, IDC_MAKE_GRAYSCALE) ? 1 : 0); - db_set_b(NULL, AVS_MODULE, "MakeTransparentBkg", IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSPARENT_BKG) ? 1 : 0); - db_set_b(NULL, AVS_MODULE, "MakeTransparencyProportionalToColorDiff", IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSP_PROPORTIONAL) ? 1 : 0); - db_set_w(NULL, AVS_MODULE, "TranspBkgNumPoints", (WORD)SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, AVS_MODULE, "TranspBkgColorDiff", (WORD)SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_GETPOS, 0, 0)); + g_plugin.setByte("warnings", IsDlgButtonChecked(hwndDlg, IDC_SHOWWARNINGS) ? 1 : 0); + g_plugin.setByte("MakeGrayscale", IsDlgButtonChecked(hwndDlg, IDC_MAKE_GRAYSCALE) ? 1 : 0); + g_plugin.setByte("MakeTransparentBkg", IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSPARENT_BKG) ? 1 : 0); + g_plugin.setByte("MakeTransparencyProportionalToColorDiff", IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSP_PROPORTIONAL) ? 1 : 0); + g_plugin.setWord("TranspBkgNumPoints", (WORD)SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_GETPOS, 0, 0)); + g_plugin.setWord("TranspBkgColorDiff", (WORD)SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_GETPOS, 0, 0)); } } break; @@ -239,8 +238,8 @@ static INT_PTR CALLBACK DlgProcOptionsOwn(HWND hwndDlg, UINT msg, WPARAM, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_MAKE_MY_AVATARS_TRANSP, db_get_b(0, AVS_MODULE, "MakeMyAvatarsTransparent", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SET_MAKE_SQUARE, db_get_b(0, AVS_MODULE, "SetAllwaysMakeSquare", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MAKE_MY_AVATARS_TRANSP, g_plugin.getByte("MakeMyAvatarsTransparent", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SET_MAKE_SQUARE, g_plugin.getByte("SetAllwaysMakeSquare", 0) ? BST_CHECKED : BST_UNCHECKED); return TRUE; @@ -253,8 +252,8 @@ static INT_PTR CALLBACK DlgProcOptionsOwn(HWND hwndDlg, UINT msg, WPARAM, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, AVS_MODULE, "MakeMyAvatarsTransparent", IsDlgButtonChecked(hwndDlg, IDC_MAKE_MY_AVATARS_TRANSP) ? 1 : 0); - db_set_b(NULL, AVS_MODULE, "SetAllwaysMakeSquare", IsDlgButtonChecked(hwndDlg, IDC_SET_MAKE_SQUARE) ? 1 : 0); + g_plugin.setByte("MakeMyAvatarsTransparent", IsDlgButtonChecked(hwndDlg, IDC_MAKE_MY_AVATARS_TRANSP) ? 1 : 0); + g_plugin.setByte("SetAllwaysMakeSquare", IsDlgButtonChecked(hwndDlg, IDC_SET_MAKE_SQUARE) ? 1 : 0); } } break; @@ -313,7 +312,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar int newItem = ListView_InsertItem(hwndList, &item); if (newItem >= 0) ListView_SetCheckState(hwndList, newItem, - db_get_b(NULL, AVS_MODULE, p->szProtoname, 1) ? TRUE : FALSE); + g_plugin.getByte(p->szProtoname, 1) ? TRUE : FALSE); } ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE); ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP); @@ -410,7 +409,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar for (int i = 0; i < ListView_GetItemCount(hwndList); i++) { auto *pce = GetProtoFromList(hwndDlg, i); - BOOL oldVal = db_get_b(NULL, AVS_MODULE, pce->szProtoname, 1); + BOOL oldVal = g_plugin.getByte(pce->szProtoname, 1); BOOL newVal = ListView_GetCheckState(hwndList, i); if (oldVal && !newVal) @@ -418,9 +417,9 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar DeleteAvatarFromCache(hContact, TRUE); if (newVal) - db_set_b(NULL, AVS_MODULE, pce->szProtoname, 1); + g_plugin.setByte(pce->szProtoname, 1); else - db_set_b(NULL, AVS_MODULE, pce->szProtoname, 0); + g_plugin.setByte(pce->szProtoname, 0); } } } @@ -433,9 +432,9 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar static void LoadTransparentData(HWND hwndDlg, MCONTACT hContact) { - CheckDlgButton(hwndDlg, IDC_MAKETRANSPBKG, db_get_b(hContact, "ContactPhoto", "MakeTransparentBkg", db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0)) ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints", db_get_w(0, AVS_MODULE, "TranspBkgNumPoints", 5))); - SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgColorDiff", db_get_w(0, AVS_MODULE, "TranspBkgColorDiff", 10))); + CheckDlgButton(hwndDlg, IDC_MAKETRANSPBKG, db_get_b(hContact, "ContactPhoto", "MakeTransparentBkg", g_plugin.getByte("MakeTransparentBkg", 0)) ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints", g_plugin.getWord("TranspBkgNumPoints", 5))); + SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgColorDiff", g_plugin.getWord("TranspBkgColorDiff", 10))); BOOL transp_enabled = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG); EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), transp_enabled); @@ -449,19 +448,19 @@ static void LoadTransparentData(HWND hwndDlg, MCONTACT hContact) static void SaveTransparentData(HWND hwndDlg, MCONTACT hContact) { BOOL transp = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG); - if (db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0) == transp) + if (g_plugin.getByte("MakeTransparentBkg", 0) == transp) db_unset(hContact, "ContactPhoto", "MakeTransparentBkg"); else db_set_b(hContact, "ContactPhoto", "MakeTransparentBkg", transp); WORD tmp = (WORD)SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_GETPOS, 0, 0); - if (db_get_w(0, AVS_MODULE, "TranspBkgNumPoints", 5) == tmp) + if (g_plugin.getWord("TranspBkgNumPoints", 5) == tmp) db_unset(hContact, "ContactPhoto", "TranspBkgNumPoints"); else db_set_w(hContact, "ContactPhoto", "TranspBkgNumPoints", tmp); tmp = (WORD)SendDlgItemMessage(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN, UDM_GETPOS, 0, 0); - if (db_get_w(0, AVS_MODULE, "TranspBkgColorDiff", 10) == tmp) + if (g_plugin.getWord("TranspBkgColorDiff", 10) == tmp) db_unset(hContact, "ContactPhoto", "TranspBkgColorDiff"); else db_set_w(hContact, "ContactPhoto", "TranspBkgColorDiff", tmp); @@ -917,7 +916,7 @@ static void EnableDisableControls(HWND hwndDlg, char *proto) else { EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), TRUE); - if (db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1)) + if (g_plugin.getByte("GlobalUserAvatarNotConsistent", 1)) EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); else { int width, height; @@ -1025,7 +1024,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP); // Check if should show per protocol avatars - CheckDlgButton(hwndDlg, IDC_PER_PROTO, db_get_b(NULL, AVS_MODULE, "PerProtocolUserAvatars", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PER_PROTO, g_plugin.getByte("PerProtocolUserAvatars", 1) ? BST_CHECKED : BST_UNCHECKED); EnableDisableProtocols(hwndDlg, TRUE); } break; @@ -1086,7 +1085,7 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP break; case IDC_PER_PROTO: - db_set_b(NULL, AVS_MODULE, "PerProtocolUserAvatars", IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO) ? 1 : 0); + g_plugin.setByte("PerProtocolUserAvatars", IsDlgButtonChecked(hwndDlg, IDC_PER_PROTO) ? 1 : 0); EnableDisableProtocols(hwndDlg, FALSE); break; } @@ -1109,7 +1108,7 @@ int OnDetailsInit(WPARAM wParam, LPARAM lParam) } else { char *szProto = GetContactProto(hContact); - if (szProto == nullptr || db_get_b(NULL, AVS_MODULE, szProto, 1)) { + if (szProto == nullptr || g_plugin.getByte(szProto, 1)) { // Contact dialog odp.pfnDlgProc = DlgProcAvatarUserInfo; odp.position = -2000000000; diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index c004765f03..90f2e614ce 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -81,7 +81,7 @@ static BOOL PollProtocolCanHaveAvatar(const char *szProto) // Return true if this protocol has to be checked
static BOOL PollCheckProtocol(const char *szProto)
{
- return db_get_b(NULL, AVS_MODULE, szProto, 1);
+ return g_plugin.getByte(szProto, 1);
}
// Return true if this contact can have avatar requested
@@ -156,7 +156,7 @@ void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATION *pa else if (type == GAIR_NOAVATAR) {
db_unset(hContact, "ContactPhoto", "NeedUpdate");
- if (db_get_b(NULL, AVS_MODULE, "RemoveAvatarWhenContactRemoves", 1)) {
+ if (g_plugin.getByte("RemoveAvatarWhenContactRemoves", 1)) {
// Delete settings
db_unset(hContact, "ContactPhoto", "RFile");
if (!db_get_b(hContact, "ContactPhoto", "Locked", 0))
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 7a4b80faf2..b31702457b 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -205,9 +205,9 @@ static int InternalRemoveMyAvatar(char *protocol) if (ret == 0) {
// Has global avatar?
DBVARIANT dbv = { 0 };
- if (!db_get_ws(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv)) {
+ if (!g_plugin.getWString("GlobalUserAvatarFile", &dbv)) {
db_free(&dbv);
- db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1);
+ g_plugin.setByte("GlobalUserAvatarNotConsistent", 1);
DeleteGlobalUserAvatar();
}
}
@@ -229,9 +229,9 @@ static int InternalRemoveMyAvatar(char *protocol) DeleteGlobalUserAvatar();
if (ret)
- db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1);
+ g_plugin.setByte("GlobalUserAvatarNotConsistent", 1);
else
- db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 0);
+ g_plugin.setByte("GlobalUserAvatarNotConsistent", 0);
}
SetIgnoreNotify(protocol, FALSE);
@@ -502,7 +502,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar ret = SetProtoMyAvatar(protocol, hBmp, szFinalName, format, data.square, data.grow);
if (ret == 0) {
DeleteGlobalUserAvatar();
- db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1);
+ g_plugin.setByte("GlobalUserAvatarNotConsistent", 1);
}
}
else {
@@ -521,7 +521,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar DeleteGlobalUserAvatar();
if (ret)
- db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1);
+ g_plugin.setByte("GlobalUserAvatarNotConsistent", 1);
else {
// Copy avatar file to store as global one
wchar_t globalFile[1024];
@@ -558,13 +558,13 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar if (saved) {
wchar_t relFile[1024];
if (PathToRelativeW(globalFile, relFile, g_szDataPath))
- db_set_ws(NULL, AVS_MODULE, "GlobalUserAvatarFile", relFile);
+ g_plugin.setWString("GlobalUserAvatarFile", relFile);
else
- db_set_ws(NULL, AVS_MODULE, "GlobalUserAvatarFile", globalFile);
+ g_plugin.setWString("GlobalUserAvatarFile", globalFile);
- db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 0);
+ g_plugin.setByte("GlobalUserAvatarNotConsistent", 0);
}
- else db_set_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1);
+ else g_plugin.setByte("GlobalUserAvatarNotConsistent", 1);
}
}
@@ -614,7 +614,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) allAcceptSWF = allAcceptSWF && Proto_IsAvatarFormatSupported(it->szModuleName, PA_FORMAT_SWF);
}
- data.square = db_get_b(0, AVS_MODULE, "SetAllwaysMakeSquare", 0);
+ data.square = g_plugin.getByte("SetAllwaysMakeSquare", 0);
}
else {
allAcceptXML = Proto_IsAvatarFormatSupported(protocol, PA_FORMAT_XML);
@@ -622,7 +622,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) data.protocol = protocol;
data.square = (Proto_AvatarImageProportion(protocol) & PIP_SQUARE)
- || db_get_b(0, AVS_MODULE, "SetAllwaysMakeSquare", 0);
+ || g_plugin.getByte("SetAllwaysMakeSquare", 0);
}
if (tszPath == nullptr) {
@@ -710,7 +710,7 @@ INT_PTR DrawAvatarPicture(WPARAM, LPARAM lParam) if (r->szProto == nullptr)
return 0;
- if (r->szProto[0] == '\0' && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1))
+ if (r->szProto[0] == '\0' && g_plugin.getByte("GlobalUserAvatarNotConsistent", 1))
return -1;
ace = (AVATARCACHEENTRY *)GetMyAvatar(0, (LPARAM)r->szProto);
diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index f9911c6f6a..0caf8837ac 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -57,6 +57,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SHVIEW_THUMBNAIL 0x702D
#endif
+#define MODULENAME "AVS_Settings" // db settings module path
+#define PPICT_MODULE "AVS_ProtoPics" // protocol pictures are saved here
+
struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin();
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 2c809a53d0..4e1d9ea226 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -79,7 +79,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz if (szProto == nullptr) {
char *proto = GetContactProto(hContact);
- if (proto == nullptr || !db_get_b(NULL, AVS_MODULE, proto, 1))
+ if (proto == nullptr || !g_plugin.getByte(proto, 1))
return -1;
if (db_get_b(hContact, "ContactPhoto", "Locked", 0) && (tszValue = db_get_wsa(hContact, "ContactPhoto", "Backup")))
@@ -114,7 +114,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz // startup and everytime they are changed.
if (szProto[0] == '\0') {
// Global avatar
- if (tszValue = db_get_wsa(NULL, AVS_MODULE, "GlobalUserAvatarFile"))
+ if (tszValue = g_plugin.getWStringA("GlobalUserAvatarFile"))
MyPathToAbsolute(tszValue, tszFilename);
else
return -10;
@@ -164,7 +164,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz ace->bmHeight = bminfo.bmHeight;
ace->bmWidth = bminfo.bmWidth;
- BOOL noTransparency = db_get_b(0, AVS_MODULE, "RemoveAllTransparency", 0);
+ BOOL noTransparency = g_plugin.getByte("RemoveAllTransparency", 0);
// Calc image hash
if (hContact != 0 && hContact != INVALID_CONTACT_ID) {
@@ -179,7 +179,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz }
// Make transparent?
- if (!noTransparency && !isTransparentImage && db_get_b(hContact, "ContactPhoto", "MakeTransparentBkg", db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0))) {
+ if (!noTransparency && !isTransparentImage && db_get_b(hContact, "ContactPhoto", "MakeTransparentBkg", g_plugin.getByte("MakeTransparentBkg", 0))) {
if (MakeTransparentBkg(hContact, &ace->hbmPic)) {
ace->dwFlags |= AVS_CUSTOMTRANSPBKG | AVS_HASTRANSPARENCY;
GetObject(ace->hbmPic, sizeof(bminfo), &bminfo);
@@ -188,7 +188,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz }
}
else if (hContact == INVALID_CONTACT_ID) { // My avatars
- if (!noTransparency && !isTransparentImage && db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0) && db_get_b(0, AVS_MODULE, "MakeMyAvatarsTransparent", 0)) {
+ if (!noTransparency && !isTransparentImage && g_plugin.getByte("MakeTransparentBkg", 0) && g_plugin.getByte("MakeMyAvatarsTransparent", 0)) {
if (MakeTransparentBkg(0, &ace->hbmPic)) {
ace->dwFlags |= AVS_CUSTOMTRANSPBKG | AVS_HASTRANSPARENCY;
GetObject(ace->hbmPic, sizeof(bminfo), &bminfo);
@@ -197,7 +197,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz }
}
- if (db_get_b(0, AVS_MODULE, "MakeGrayscale", 0))
+ if (g_plugin.getByte("MakeGrayscale", 0))
ace->hbmPic = MakeGrayscale(ace->hbmPic);
if (noTransparency) {
@@ -428,7 +428,7 @@ int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist, int pa_format) void DeleteGlobalUserAvatar()
{
DBVARIANT dbv = { 0 };
- if (db_get_ws(NULL, AVS_MODULE, "GlobalUserAvatarFile", &dbv))
+ if (g_plugin.getWString("GlobalUserAvatarFile", &dbv))
return;
wchar_t szFilename[MAX_PATH];
@@ -436,7 +436,7 @@ void DeleteGlobalUserAvatar() db_free(&dbv);
DeleteFile(szFilename);
- db_unset(NULL, AVS_MODULE, "GlobalUserAvatarFile");
+ g_plugin.delSetting("GlobalUserAvatarFile");
}
void SetIgnoreNotify(char *protocol, BOOL ignore)
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index da5163cea8..fa79e6976a 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -172,7 +172,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) SendDlgItemMessage(hdlg, IDC_GROUP, CB_INSERTSTRING, 0, (LPARAM)TranslateT("None"));
SendDlgItemMessage(hdlg, IDC_GROUP, CB_SETCURSEL, 0, 0);
{
- ptrA szProto(db_get_sa(NULL, MODULENAME, "LastProto"));
+ ptrA szProto(g_plugin.getStringA("LastProto"));
if (szProto)
acs->proto = szProto;
}
@@ -317,7 +317,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) Window_FreeIcon_IcoLib(hdlg);
ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_GETIMAGELIST, 0, 0));
if (acs) {
- db_set_s(NULL, MODULENAME, "LastProto", acs->proto);
+ g_plugin.setString("LastProto", acs->proto);
if (acs->psr) {
mir_free(acs->psr->nick.w);
mir_free(acs->psr->firstName.w);
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 37623ee409..9d068cf908 100755 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -229,7 +229,7 @@ bool UpdateAlarm(SYSTEMTIME &time, Occurrence occ, int selected_days) void LoadAlarms()
{
- int num_alarms = db_get_w(0, MODULENAME, "Count", 0);
+ int num_alarms = g_plugin.getWord("Count", 0);
char buff[256];
DBVARIANT dbv;
ALARM alarm;
@@ -243,69 +243,69 @@ void LoadAlarms() memset(&alarm, 0, sizeof(ALARM));
mir_snprintf(buff, "Title%d", i);
- if (!db_get_ws(0, MODULENAME, buff, &dbv)) {
+ if (!g_plugin.getWString(buff, &dbv)) {
alarm.szTitle = mir_wstrdup(dbv.pwszVal);
db_free(&dbv);
}
mir_snprintf(buff, "Desc%d", i);
- if (!db_get_ws(0, MODULENAME, buff, &dbv)) {
+ if (!g_plugin.getWString(buff, &dbv)) {
alarm.szDesc = mir_wstrdup(dbv.pwszVal);
db_free(&dbv);
}
mir_snprintf(buff, "Occ%d", i);
- alarm.occurrence = (Occurrence)db_get_w(0, MODULENAME, buff, 0);
+ alarm.occurrence = (Occurrence)g_plugin.getWord(buff, 0);
mir_snprintf(buff, "STHour%d", i);
- alarm.time.wHour = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wHour = g_plugin.getWord(buff, 0);
mir_snprintf(buff, "STMinute%d", i);
- alarm.time.wMinute = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wMinute = g_plugin.getWord(buff, 0);
mir_snprintf(buff, "STSecond%d", i);
- alarm.time.wSecond = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wSecond = g_plugin.getWord(buff, 0);
switch (alarm.occurrence) {
case OC_ONCE:
mir_snprintf(buff, "STYear%d", i);
- alarm.time.wYear = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wYear = g_plugin.getWord(buff, 0);
mir_snprintf(buff, "STMonth%d", i);
- alarm.time.wMonth = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wMonth = g_plugin.getWord(buff, 0);
mir_snprintf(buff, "STDay%d", i);
- alarm.time.wDay = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wDay = g_plugin.getWord(buff, 0);
break;
case OC_WEEKLY:
mir_snprintf(buff, "STDayOfWeek%d", i);
- alarm.time.wDayOfWeek = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wDayOfWeek = g_plugin.getWord(buff, 0);
break;
case OC_WEEKDAYS:
break;
case OC_SELECTED_DAYS:
mir_snprintf(buff, "SelectedDays%d", i);
- alarm.day_mask = db_get_dw(0, MODULENAME, buff, alarm.day_mask);
+ alarm.day_mask = g_plugin.getDword(buff, alarm.day_mask);
break;
case OC_DAILY:
break;
case OC_MONTHLY:
mir_snprintf(buff, "STDay%d", i);
- alarm.time.wDay = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wDay = g_plugin.getWord(buff, 0);
break;
case OC_YEARLY:
mir_snprintf(buff, "STMonth%d", i);
- alarm.time.wMonth = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wMonth = g_plugin.getWord(buff, 0);
mir_snprintf(buff, "STDay%d", i);
- alarm.time.wDay = db_get_w(0, MODULENAME, buff, 0);
+ alarm.time.wDay = g_plugin.getWord(buff, 0);
break;
}
if (UpdateAlarm(alarm.time, alarm.occurrence, alarm.day_mask)) {
mir_snprintf(buff, "ActionFlags%d", i);
- alarm.action = (unsigned short)db_get_dw(0, MODULENAME, buff, AAF_POPUP | AAF_SOUND);
+ alarm.action = (unsigned short)g_plugin.getDword(buff, AAF_POPUP | AAF_SOUND);
if (alarm.action & AAF_COMMAND) {
mir_snprintf(buff, "ActionCommand%d", i);
- if (!db_get_ws(0, MODULENAME, buff, &dbv)) {
+ if (!g_plugin.getWString(buff, &dbv)) {
alarm.szCommand = mir_wstrdup(dbv.pwszVal);
db_free(&dbv);
mir_snprintf(buff, "ActionParams%d", i);
- if (!db_get_ws(0, MODULENAME, buff, &dbv)) {
+ if (!g_plugin.getWString(buff, &dbv)) {
alarm.szCommandParams = mir_wstrdup(dbv.pwszVal);
db_free(&dbv);
}
@@ -313,22 +313,22 @@ void LoadAlarms() }
mir_snprintf(buff, "SoundNum%d", i);
- alarm.sound_num = (int)db_get_b(0, MODULENAME, buff, 1);
+ alarm.sound_num = (int)g_plugin.getByte(buff, 1);
mir_snprintf(buff, "Snoozer%d", i);
- alarm.snoozer = db_get_b(0, MODULENAME, buff, 0) == 1;
+ alarm.snoozer = g_plugin.getByte(buff, 0) == 1;
mir_snprintf(buff, "Hidden%d", i);
- alarm.flags |= (db_get_b(0, MODULENAME, buff, 0) == 1 ? ALF_HIDDEN : 0);
+ alarm.flags |= (g_plugin.getByte(buff, 0) == 1 ? ALF_HIDDEN : 0);
mir_snprintf(buff, "Suspended%d", i);
- alarm.flags |= (db_get_b(0, MODULENAME, buff, 0) == 1 ? ALF_SUSPENDED : 0);
+ alarm.flags |= (g_plugin.getByte(buff, 0) == 1 ? ALF_SUSPENDED : 0);
mir_snprintf(buff, "NoStartup%d", i);
- alarm.flags |= (db_get_b(0, MODULENAME, buff, 0) == 1 ? ALF_NOSTARTUP : 0);
+ alarm.flags |= (g_plugin.getByte(buff, 0) == 1 ? ALF_NOSTARTUP : 0);
mir_snprintf(buff, "Flags%d", i);
- alarm.flags = db_get_dw(0, MODULENAME, buff, alarm.flags);
+ alarm.flags = g_plugin.getDword(buff, alarm.flags);
alarm.id = next_alarm_id++;
alarms.push_back(&alarm);
@@ -394,7 +394,7 @@ void SaveAlarms() db_enum_settings(0, &db_enum_settings_sub_cb, MODULENAME, &settings);
for (std::list<char*>::iterator i = settings.begin(), end = settings.end(); i != end; ++i)
{
- db_unset(0, MODULENAME, *i);
+ g_plugin.delSetting(*i);
mir_free(*i);
}
}
@@ -403,18 +403,18 @@ void SaveAlarms() ALARM *i;
for (alarms.reset(); i = alarms.current(); alarms.next(), index++) {
mir_snprintf(buff, "Title%d", index);
- db_set_ws(0, MODULENAME, buff, i->szTitle);
+ g_plugin.setWString(buff, i->szTitle);
mir_snprintf(buff, "Desc%d", index);
- db_set_ws(0, MODULENAME, buff, i->szDesc);
+ g_plugin.setWString(buff, i->szDesc);
mir_snprintf(buff, "Occ%d", index);
- db_set_w(0, MODULENAME, buff, i->occurrence);
+ g_plugin.setWord(buff, i->occurrence);
mir_snprintf(buff, "STHour%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wHour);
+ g_plugin.setWord(buff, i->time.wHour);
mir_snprintf(buff, "STMinute%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wMinute);
+ g_plugin.setWord(buff, i->time.wMinute);
mir_snprintf(buff, "STSecond%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wSecond);
+ g_plugin.setWord(buff, i->time.wSecond);
switch (i->occurrence) {
case OC_DAILY:
@@ -423,47 +423,47 @@ void SaveAlarms() break;
case OC_SELECTED_DAYS:
mir_snprintf(buff, "SelectedDays%d", index);
- db_set_dw(0, MODULENAME, buff, i->day_mask);
+ g_plugin.setDword(buff, i->day_mask);
break;
case OC_WEEKLY:
mir_snprintf(buff, "STDayOfWeek%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wDayOfWeek);
+ g_plugin.setWord(buff, i->time.wDayOfWeek);
break;
case OC_ONCE:
mir_snprintf(buff, "STYear%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wYear);
+ g_plugin.setWord(buff, i->time.wYear);
case OC_YEARLY:
mir_snprintf(buff, "STMonth%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wMonth);
+ g_plugin.setWord(buff, i->time.wMonth);
case OC_MONTHLY:
mir_snprintf(buff, "STDay%d", index);
- db_set_w(0, MODULENAME, buff, i->time.wDay);
+ g_plugin.setWord(buff, i->time.wDay);
break;
}
mir_snprintf(buff, "ActionFlags%d", index);
- db_set_dw(0, MODULENAME, buff, i->action);
+ g_plugin.setDword(buff, i->action);
if (i->action & AAF_COMMAND) {
if (mir_wstrlen(i->szCommand)) {
mir_snprintf(buff, "ActionCommand%d", index);
- db_set_ws(0, MODULENAME, buff, i->szCommand);
+ g_plugin.setWString(buff, i->szCommand);
if (mir_wstrlen(i->szCommandParams)) {
mir_snprintf(buff, "ActionParams%d", index);
- db_set_ws(0, MODULENAME, buff, i->szCommandParams);
+ g_plugin.setWString(buff, i->szCommandParams);
}
}
}
mir_snprintf(buff, "SoundNum%d", index);
- db_set_b(0, MODULENAME, buff, i->sound_num);
+ g_plugin.setByte(buff, i->sound_num);
mir_snprintf(buff, "Snoozer%d", index);
- db_set_b(0, MODULENAME, buff, i->snoozer ? 1 : 0);
+ g_plugin.setByte(buff, i->snoozer ? 1 : 0);
mir_snprintf(buff, "Flags%d", index);
- db_set_dw(0, MODULENAME, buff, i->flags);
+ g_plugin.setDword(buff, i->flags);
}
- db_set_w(0, MODULENAME, "Count", index);
+ g_plugin.setWord("Count", index);
}
void copy_list(AlarmList ©)
@@ -692,7 +692,7 @@ void DoAlarm(ALARM *alarm) void WriteLastCheckTime()
{
// save last-check time
- db_set_blob(NULL, MODULENAME, "LastCheck", &last_check, sizeof(SYSTEMTIME));
+ db_set_blob(0, MODULENAME, "LastCheck", &last_check, sizeof(SYSTEMTIME));
last_saved_check = last_check;
}
@@ -785,7 +785,7 @@ void InitList() DBVARIANT dbv;
dbv.type = DBVT_BLOB;
dbv.cpbVal = sizeof(SYSTEMTIME);
- if (!db_get(NULL, MODULENAME, "LastCheck", &dbv)) {
+ if (!db_get(0, MODULENAME, "LastCheck", &dbv)) {
memcpy(&last_check, dbv.pbVal, sizeof(SYSTEMTIME));
db_free(&dbv);
}
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 921ca4f290..e064c1b27d 100755 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -46,12 +46,12 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP case WM_SHOWWINDOW:
if (wParam) {
- db_set_b(0, MODULENAME, "ReminderFrameVisible", 1);
+ g_plugin.setByte("ReminderFrameVisible", 1);
Utils_RestoreWindowPosition(hwnd, 0, MODULENAME, "reminders_window");
PostMessage(hwnd, WM_SIZE, 0, 0);
}
else {
- db_set_b(0, MODULENAME, "ReminderFrameVisible", 0);
+ g_plugin.setByte("ReminderFrameVisible", 0);
Utils_SaveWindowPosition(hwnd, 0, MODULENAME, "reminders_window");
}
break;
@@ -542,7 +542,7 @@ int CreateFrame() else ShowWindow(hwnd_frame, SW_HIDE);
}
else {
- if (db_get_b(0, MODULENAME, "ReminderFrameVisible", 1) == 1) {
+ if (g_plugin.getByte("ReminderFrameVisible", 1) == 1) {
ShowWindow(hwnd_frame, SW_SHOW);
RefreshReminderFrame();
}
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 5b57bb9c4c..bf75d40ced 100755 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -1223,36 +1223,36 @@ int OptInit(WPARAM wParam, LPARAM) void LoadOptions()
{
- options.use_popup_module = (db_get_b(0, MODULENAME, "UsePopupModule", 0) == 1);
- options.snooze_minutes = (int)db_get_dw(0, MODULENAME, "SnoozeMinutes", 10);
- options.row_height = (int)db_get_dw(0, MODULENAME, "RowHeight", 20);
- options.indent = (int)db_get_dw(0, MODULENAME, "Indent", 5);
- options.aw_trans = (int)db_get_b(0, MODULENAME, "Transparency", 0);
- options.aw_roundcorners = (db_get_b(0, MODULENAME, "RoundCorners", 1) == 1);
- options.aw_dontstealfocus = (db_get_b(0, MODULENAME, "DontStealFocus", 1) == 1);
- options.auto_showhide = (db_get_b(0, MODULENAME, "AutoShowHide", 0) == 1);
- options.hide_with_clist = (db_get_b(0, MODULENAME, "HideWithClist", 0) == 1);
- options.loop_sound = (db_get_b(0, MODULENAME, "LoopSound", 1) == 1);
- options.auto_size_vert = (db_get_b(0, MODULENAME, "AutoSize", 0) == 1);
- options.reminder_period = (int)db_get_dw(0, MODULENAME, "ReminderPeriod", 8);
+ options.use_popup_module = (g_plugin.getByte("UsePopupModule", 0) == 1);
+ options.snooze_minutes = (int)g_plugin.getDword("SnoozeMinutes", 10);
+ options.row_height = (int)g_plugin.getDword("RowHeight", 20);
+ options.indent = (int)g_plugin.getDword("Indent", 5);
+ options.aw_trans = (int)g_plugin.getByte("Transparency", 0);
+ options.aw_roundcorners = (g_plugin.getByte("RoundCorners", 1) == 1);
+ options.aw_dontstealfocus = (g_plugin.getByte("DontStealFocus", 1) == 1);
+ options.auto_showhide = (g_plugin.getByte("AutoShowHide", 0) == 1);
+ options.hide_with_clist = (g_plugin.getByte("HideWithClist", 0) == 1);
+ options.loop_sound = (g_plugin.getByte("LoopSound", 1) == 1);
+ options.auto_size_vert = (g_plugin.getByte("AutoSize", 0) == 1);
+ options.reminder_period = (int)g_plugin.getDword("ReminderPeriod", 8);
HookEvent(ME_SYSTEM_MODULESLOADED, OptionsModulesLoaded);
}
void SaveOptions()
{
- db_set_b(0, MODULENAME, "UsePopupModule", options.use_popup_module ? 1 : 0);
- db_set_dw(0, MODULENAME, "SnoozeMinutes", options.snooze_minutes);
- db_set_dw(0, MODULENAME, "RowHeight", options.row_height);
- db_set_dw(0, MODULENAME, "Indent", options.indent);
- db_set_b(0, MODULENAME, "Transparency", options.aw_trans);
- db_set_b(0, MODULENAME, "RoundCorners", options.aw_roundcorners ? 1 : 0);
- db_set_b(0, MODULENAME, "DontStealFocus", options.aw_dontstealfocus ? 1 : 0);
- db_set_b(0, MODULENAME, "AutoShowHide", options.auto_showhide ? 1 : 0);
- db_set_b(0, MODULENAME, "HideWithClist", options.hide_with_clist ? 1 : 0);
- db_set_b(0, MODULENAME, "LoopSound", options.loop_sound ? 1 : 0);
- db_set_b(0, MODULENAME, "AutoSize", options.auto_size_vert ? 1 : 0);
- db_set_dw(0, MODULENAME, "ReminderPeriod", options.reminder_period);
+ g_plugin.setByte("UsePopupModule", options.use_popup_module ? 1 : 0);
+ g_plugin.setDword("SnoozeMinutes", options.snooze_minutes);
+ g_plugin.setDword("RowHeight", options.row_height);
+ g_plugin.setDword("Indent", options.indent);
+ g_plugin.setByte("Transparency", options.aw_trans);
+ g_plugin.setByte("RoundCorners", options.aw_roundcorners ? 1 : 0);
+ g_plugin.setByte("DontStealFocus", options.aw_dontstealfocus ? 1 : 0);
+ g_plugin.setByte("AutoShowHide", options.auto_showhide ? 1 : 0);
+ g_plugin.setByte("HideWithClist", options.hide_with_clist ? 1 : 0);
+ g_plugin.setByte("LoopSound", options.loop_sound ? 1 : 0);
+ g_plugin.setByte("AutoSize", options.auto_size_vert ? 1 : 0);
+ g_plugin.setDword("ReminderPeriod", options.reminder_period);
}
INT_PTR NewAlarmMenuFunc(WPARAM, LPARAM)
diff --git a/plugins/AsSingleWindow/src/Options.cpp b/plugins/AsSingleWindow/src/Options.cpp index 8e7659e79c..3bbabf2c9c 100644 --- a/plugins/AsSingleWindow/src/Options.cpp +++ b/plugins/AsSingleWindow/src/Options.cpp @@ -98,8 +98,8 @@ void dlgUpdateControls(HWND hWnd) void optionsLoad() { - pluginVars.Options.DrivenWindowPos = db_get_b(0, MODULENAME, "DrivenWindowPosition", ASW_CLWINDOWPOS_RIGHT); - pluginVars.Options.WindowsMerging = db_get_b(0, MODULENAME, "WindowsMerging", ASW_WINDOWS_MERGEONE); + pluginVars.Options.DrivenWindowPos = g_plugin.getByte("DrivenWindowPosition", ASW_CLWINDOWPOS_RIGHT); + pluginVars.Options.WindowsMerging = g_plugin.getByte("WindowsMerging", ASW_WINDOWS_MERGEONE); } void optionsUpdate(HWND hWnd) @@ -117,6 +117,6 @@ void optionsUpdate(HWND hWnd) void optionsSave() { - db_set_b(0, MODULENAME, "DrivenWindowPosition", pluginVars.Options.DrivenWindowPos); - db_set_b(0, MODULENAME, "WindowsMerging", pluginVars.Options.WindowsMerging); + g_plugin.setByte("DrivenWindowPosition", pluginVars.Options.DrivenWindowPos); + g_plugin.setByte("WindowsMerging", pluginVars.Options.WindowsMerging); } diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 17c723c7d7..36de693706 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -32,7 +32,7 @@ static BOOL IsAssocEnabled(const ASSOCDATA *assoc) {
char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, "enabled_%s", assoc->pszClassName);
- return db_get_b(NULL, MODULENAME, szSetting, (BYTE)!(assoc->flags&FTDF_DEFAULTDISABLED)) != 0;
+ return g_plugin.getByte(szSetting, (BYTE)!(assoc->flags&FTDF_DEFAULTDISABLED)) != 0;
}
static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled)
@@ -40,13 +40,13 @@ static void SetAssocEnabled(const ASSOCDATA *assoc, BOOL fEnabled) char szSetting[MAXMODULELABELLENGTH];
wchar_t szDLL[MAX_PATH], szBuf[MAX_PATH];
mir_snprintf(szSetting, "enabled_%s", assoc->pszClassName);
- db_set_b(NULL, MODULENAME, szSetting, (BYTE)fEnabled);
+ g_plugin.setByte(szSetting, (BYTE)fEnabled);
// dll name for uninstall
if (assoc->hInstance != nullptr && assoc->hInstance != g_plugin.getInst() && assoc->hInstance != GetModuleHandle(nullptr))
if (GetModuleFileName(assoc->hInstance, szBuf, _countof(szBuf)))
if (PathToRelativeW(szBuf, szDLL)) {
mir_snprintf(szSetting, "module_%s", assoc->pszClassName);
- db_set_ws(NULL, MODULENAME, szSetting, szDLL);
+ g_plugin.setWString(szSetting, szDLL);
}
}
@@ -54,10 +54,10 @@ static void DeleteAssocEnabledSetting(const ASSOCDATA *assoc) {
char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, "enabled_%s", assoc->pszClassName);
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
// dll name for uninstall
mir_snprintf(szSetting, "module_%s", assoc->pszClassName);
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
}
void CleanupAssocEnabledSettings(void)
@@ -71,15 +71,15 @@ void CleanupAssocEnabledSettings(void) char *pszSuffix = &ppszSettings[i][8];
char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, "module_%s", pszSuffix);
- ptrW wszPath(db_get_wsa(NULL, MODULENAME, szSetting));
+ ptrW wszPath(g_plugin.getWStringA(szSetting));
if (wszPath != nullptr) {
wchar_t szDLL[MAX_PATH];
if (PathToAbsoluteW(wszPath, szDLL)) {
// file still exists?
HANDLE hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
if (hFile == INVALID_HANDLE_VALUE) {
- db_unset(NULL, MODULENAME, ppszSettings[i]);
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(ppszSettings[i]);
+ g_plugin.delSetting(szSetting);
}
else CloseHandle(hFile);
}
@@ -97,9 +97,9 @@ static __inline void RememberMimeTypeAdded(const char *pszMimeType, const char * char szSetting[MAXMODULELABELLENGTH];
mir_snprintf(szSetting, "mime_%s", pszMimeType);
if (fAdded)
- db_set_s(NULL, MODULENAME, szSetting, pszFileExt);
+ g_plugin.setString(szSetting, pszFileExt);
else
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
}
static __inline BOOL WasMimeTypeAdded(const char *pszMimeType)
@@ -108,7 +108,7 @@ static __inline BOOL WasMimeTypeAdded(const char *pszMimeType) DBVARIANT dbv;
BOOL fAdded = FALSE;
mir_snprintf(szSetting, "mime_%s", pszMimeType);
- if (!db_get(NULL, MODULENAME, szSetting, &dbv))
+ if (!db_get(0, MODULENAME, szSetting, &dbv))
fAdded = TRUE;
else
db_free(&dbv);
@@ -133,11 +133,11 @@ void CleanupMimeTypeAddedSettings(void) if (p == nullptr) { // mime type not in current list
DBVARIANT dbv;
- if (!db_get_s(NULL, MODULENAME, ppszSettings[i], &dbv)) {
+ if (!g_plugin.getString(ppszSettings[i], &dbv)) {
RemoveRegMimeType(pszSuffix, dbv.pszVal);
db_free(&dbv);
}
- db_unset(NULL, MODULENAME, ppszSettings[i]);
+ g_plugin.delSetting(ppszSettings[i]);
}
mir_free(ppszSettings[i]);
}
@@ -656,7 +656,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara ListView_SetItemState(hwndList, lvi.iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE_USEHEADER); // size to fit window
// only while running
- CheckDlgButton(hwndDlg, IDC_ONLYWHILERUNNING, (BOOL)db_get_b(NULL, MODULENAME, "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONLYWHILERUNNING, (BOOL)g_plugin.getByte("OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
// autostart
wchar_t *pszRunCmd = MakeRunCommand(TRUE, TRUE);
@@ -797,7 +797,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara BOOL fEnabled, fRegFailed = FALSE;
// only while running
- db_set_b(NULL, MODULENAME, "OnlyWhileRunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONLYWHILERUNNING) != 0));
+ g_plugin.setByte("OnlyWhileRunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONLYWHILERUNNING) != 0));
// save enabled assoc items
HWND hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
@@ -920,7 +920,7 @@ void InitAssocList(void) void UninitAssocList(void)
{
// Assoc List
- BYTE fOnlyWhileRunning = db_get_b(NULL, MODULENAME, "OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT);
+ BYTE fOnlyWhileRunning = g_plugin.getByte("OnlyWhileRunning", SETTING_ONLYWHILERUNNING_DEFAULT);
for (auto &it : arAssocList)
if (fOnlyWhileRunning)
UnregisterAssoc(it); // remove registry keys
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index b6ecad1a0b..6c4a30e847 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -334,7 +334,7 @@ static void WriteDbBackupData(const char *pszSetting, DWORD dwType, BYTE *pData, if (buf) {
*(DWORD*)buf = dwType;
memcpy(buf + sizeof(DWORD), pData, cbData);
- db_set_blob(NULL, MODULENAME, pszSetting, buf, (unsigned)cbLen);
+ db_set_blob(0, MODULENAME, pszSetting, buf, (unsigned)cbLen);
mir_free(buf);
}
}
@@ -483,7 +483,7 @@ static LONG RestoreRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPr if (res)
break;
- db_unset(NULL, MODULENAME, ppszSettings[i]);
+ g_plugin.delSetting(ppszSettings[i]);
if (hSubKey != hKey)
RegCloseKey(hSubKey);
}
@@ -507,7 +507,7 @@ static void DeleteRegTreeBackup(const char *pszSubKey, const char *pszDbPrefix) if (pszPrefixWithSubKey != nullptr) {
if (EnumDbPrefixSettings(MODULENAME, pszPrefixWithSubKey, &ppszSettings, &nSettingsCount)) {
for (i = 0; i < nSettingsCount; ++i) {
- db_unset(NULL, MODULENAME, ppszSettings[i]);
+ g_plugin.delSetting(ppszSettings[i]);
mir_free(ppszSettings[i]);
}
mir_free(ppszSettings);
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index 3c1f18750e..ad77a5223b 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -39,7 +39,7 @@ static COLORREF GetDefaultColor(BYTE id) case FRAMEELEMENT_BAR:
return RGB(250, 0, 0); /* same color as used on header icon */
case FRAMEELEMENT_BKGRND:
- return (COLORREF)db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ return (COLORREF)db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
case FRAMEELEMENT_TEXT:
return GetSysColor(COLOR_WINDOWTEXT);
}
@@ -288,14 +288,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP }
case M_SET_COUNTDOWN:
if (dat->fTimeFlags&SDWTF_ST_TIME) {
- dat->settingLastTime = (time_t)db_get_dw(NULL, MODULENAME, "TimeStamp", SETTING_TIMESTAMP_DEFAULT);
+ dat->settingLastTime = (time_t)g_plugin.getDword("TimeStamp", SETTING_TIMESTAMP_DEFAULT);
dat->countdown = time(0);
if (dat->settingLastTime > dat->countdown) dat->countdown = dat->settingLastTime - dat->countdown;
else dat->countdown = 0;
}
else if (dat->flags&FWPDF_COUNTDOWNINVALID) {
- dat->countdown = (time_t)db_get_dw(NULL, MODULENAME, "Countdown", SETTING_COUNTDOWN_DEFAULT);
- dat->countdown *= (time_t)db_get_dw(NULL, MODULENAME, "CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
+ dat->countdown = (time_t)g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
+ dat->countdown *= (time_t)g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
}
dat->flags &= ~FWPDF_COUNTDOWNINVALID;
/* commctl 4.70+, Win95: 1-100 will work fine (wrap around) */
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp index f46c1d344e..3c79c94384 100644 --- a/plugins/AutoShutdown/src/options.cpp +++ b/plugins/AutoShutdown/src/options.cpp @@ -31,7 +31,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- WORD setting = db_get_w(NULL, MODULENAME, "ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
+ WORD setting = g_plugin.getWord("ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
if (setting < 3)
setting = SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_CONFIRMDLGCOUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(999, 3));
@@ -39,15 +39,15 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_SPIN_CONFIRMDLGCOUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
SetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, setting, FALSE);
}
- CheckDlgButton(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK, db_get_b(NULL, MODULENAME, "SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHECK_REMEMBERONRESTART, db_get_b(NULL, MODULENAME, "RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG, db_get_b(NULL, MODULENAME, "ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK, g_plugin.getByte("SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_REMEMBERONRESTART, g_plugin.getByte("RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG, g_plugin.getByte("ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
{
BOOL enabled = ServiceIsTypeEnabled(SDSDT_SHUTDOWN, 0);
if (enabled) {
if (ServiceExists(MS_WEATHER_UPDATE)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER), TRUE);
- CheckDlgButton(hwndDlg, IDC_CHECK_WEATHER, db_get_b(NULL, MODULENAME, "WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_WEATHER, g_plugin.getByte("WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
}
}
}
@@ -85,12 +85,12 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_NOTIFY:
switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
- db_set_w(NULL, MODULENAME, "ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
- db_set_b(NULL, MODULENAME, "SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
+ g_plugin.setByte("ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
+ g_plugin.setWord("ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE));
+ g_plugin.setByte("RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
+ g_plugin.setByte("SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER)))
- db_set_b(NULL, MODULENAME, "WeatherShutdown", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_WEATHER) != 0));
+ g_plugin.setByte("WeatherShutdown", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_WEATHER) != 0));
return TRUE;
}
break;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 3109286671..bb39c0fc18 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -81,7 +81,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
/* read-in watcher flags */
{
- WORD watcherType = db_get_w(NULL, MODULENAME, "WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
+ WORD watcherType = g_plugin.getWord("WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg, IDC_RADIO_STTIME, IDC_RADIO_STCOUNTDOWN, (watcherType&SDWTF_ST_TIME) ? IDC_RADIO_STTIME : IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg, IDC_CHECK_SPECIFICTIME, (watcherType&SDWTF_SPECIFICTIME) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, (watcherType&SDWTF_MESSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
@@ -93,14 +93,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L /* read-in countdown val */
{
SYSTEMTIME st;
- if (!TimeStampToSystemTime((time_t)db_get_dw(NULL, MODULENAME, "TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
+ if (!TimeStampToSystemTime((time_t)g_plugin.getDword("TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
GetLocalTime(&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), GDT_VALID, &st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DATE_TIMESTAMP), GDT_VALID, &st);
SendMessage(hwndDlg, M_CHECK_DATETIME, 0, 0);
}
{
- DWORD setting = db_get_dw(NULL, MODULENAME, "Countdown", SETTING_COUNTDOWN_DEFAULT);
+ DWORD setting = g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
if (setting < 1) setting = SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(UD_MAXVAL, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_COUNTDOWN, EM_SETLIMITTEXT, (WPARAM)10, 0);
@@ -109,7 +109,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_COUNTDOWNUNIT);
- DWORD lastUnit = db_get_dw(NULL, MODULENAME, "CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
+ DWORD lastUnit = g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_INITSTORAGE, _countof(unitNames), _countof(unitNames) * 16); /* approx. */
for (int i = 0; i < _countof(unitNames); ++i) {
@@ -122,14 +122,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
{
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "Message", &dbv)) {
+ if (!g_plugin.getWString("Message", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_MESSAGE, dbv.pwszVal);
mir_free(dbv.pwszVal);
}
}
/* cpuusage threshold */
{
- BYTE setting = DBGetContactSettingRangedByte(NULL, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
+ BYTE setting = DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETRANGE, 0, MAKELPARAM(100, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_CPUUSAGE, EM_SETLIMITTEXT, (WPARAM)3, 0);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
@@ -138,7 +138,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L /* shutdown types */
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_SHUTDOWNTYPE);
- BYTE lastShutdownType = db_get_b(NULL, MODULENAME, "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
+ BYTE lastShutdownType = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
SendMessage(hwndCombo, CB_INITSTORAGE, SDSDT_MAX, SDSDT_MAX * 32);
@@ -340,7 +340,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L wchar_t *pszText = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
if (pszText != nullptr && GetWindowText(hwndEdit, pszText, len + 1)) {
TrimString(pszText);
- db_set_ws(NULL, MODULENAME, "Message", pszText);
+ g_plugin.setWString("Message", pszText);
}
mir_free(pszText); /* does NULL check */
}
@@ -351,18 +351,18 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
if (!SystemTimeToTimeStamp(&st, ×tamp))
timestamp = time(0);
- db_set_dw(NULL, MODULENAME, "TimeStamp", (DWORD)timestamp);
+ g_plugin.setDword("TimeStamp", (DWORD)timestamp);
}
/* shutdown type */
{
int index = SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- db_set_b(NULL, MODULENAME, "ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setByte("ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- db_set_dw(NULL, MODULENAME, "CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
- db_set_dw(NULL, MODULENAME, "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
+ g_plugin.setDword("CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setDword("Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
+ g_plugin.setByte("CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
}
/* watcher type */
{
@@ -373,7 +373,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_IDLE)) watcherType |= SDWTF_IDLE;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_STATUS)) watcherType |= SDWTF_STATUS;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_CPUUSAGE)) watcherType |= SDWTF_CPUUSAGE;
- db_set_w(NULL, MODULENAME, "WatcherFlags", watcherType);
+ g_plugin.setWord("WatcherFlags", watcherType);
ServiceStartWatcher(0, watcherType);
}
DestroyWindow(hwndDlg);
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index b6f4ac85e0..d8f6df0dac 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -321,7 +321,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, (LONG_PTR)hBoldFont);
}
{
- countdown = db_get_w(NULL, MODULENAME, "ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
+ countdown = g_plugin.getWord("ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
if (countdown < 3)
countdown = SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, countdown);
@@ -416,7 +416,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam)
{
/* passing 0 as wParam is only to be used internally, undocumented */
- if (!wParam) wParam = db_get_b(NULL, MODULENAME, "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
+ if (!wParam) wParam = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
if (!IsShutdownTypeEnabled((BYTE)wParam)) return 1; /* does shutdownType range check */
if ((BOOL)lParam && hwndShutdownDlg != nullptr) return 2;
@@ -428,7 +428,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam) /* tell others */
NotifyEventHooks(hEventShutdown, wParam, lParam);
/* show dialog */
- if (lParam && db_get_b(NULL, MODULENAME, "ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT))
+ if (lParam && g_plugin.getByte("ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT))
if (CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SHUTDOWNNOW), nullptr, ShutdownDlgProc, (BYTE)wParam) != nullptr)
return 0;
/* show error */
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 529954f758..3973b251f9 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -99,7 +99,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent) if (!db_event_get(hDbEvent, &dbe))
if (dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) {
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "Message", &dbv)) {
+ if (!g_plugin.getWString("Message", &dbv)) {
TrimString(dbv.pwszVal);
wchar_t *pszMsg = GetMessageText(&dbe.pBlob, &dbe.cbBlob);
if (pszMsg != nullptr && wcsstr(pszMsg, dbv.pwszVal) != nullptr)
@@ -175,7 +175,7 @@ static int IdleChanged(WPARAM, LPARAM lParam) static BOOL CheckAllContactsOffline(void)
{
BOOL fSmartCheck, fAllOffline = TRUE; /* tentatively */
- fSmartCheck = db_get_b(NULL, MODULENAME, "SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT);
+ fSmartCheck = g_plugin.getByte("SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT);
for (auto &hContact : Contacts()) {
char *pszProto = GetContactProto(hContact);
if (pszProto != nullptr && Proto_GetStatus(pszProto) != ID_STATUS_OFFLINE) {
@@ -236,7 +236,7 @@ static int WeatherUpdated(WPARAM wParam, LPARAM lParam) {
char *pszProto = GetContactProto(wParam);
if ((BOOL)lParam && pszProto != nullptr && Proto_GetStatus(pszProto) == THUNDER)
- if (db_get_b(NULL, MODULENAME, "WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT))
+ if (g_plugin.getByte("WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT))
ServiceShutdown(SDSDT_SHUTDOWN, TRUE);
return 0;
}
@@ -247,7 +247,7 @@ INT_PTR ServiceStartWatcher(WPARAM, LPARAM lParam) {
/* passing watcherType as lParam is only to be used internally, undocumented */
if (lParam == 0)
- lParam = (LPARAM)db_get_w(NULL, MODULENAME, "WatcherFlags", 0);
+ lParam = (LPARAM)g_plugin.getWord("WatcherFlags", 0);
/* invalid flags or empty? */
if (!(lParam&SDWTF_MASK))
@@ -276,7 +276,7 @@ INT_PTR ServiceStartWatcher(WPARAM, LPARAM lParam) ShowCountdownFrame(currentWatcherType); /* after modules loaded */
/* Cpu Shutdown */
if (currentWatcherType&SDWTF_CPUUSAGE)
- idCpuUsageThread = PollCpuUsage(CpuUsageWatcherProc, (LPARAM)DBGetContactSettingRangedByte(NULL, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100), 1500);
+ idCpuUsageThread = PollCpuUsage(CpuUsageWatcherProc, (LPARAM)DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100), 1500);
/* Transfer Shutdown */
if (currentWatcherType&SDWTF_FILETRANSFER && !nTransfersCount)
ShutdownAndStopWatcher();
@@ -317,8 +317,8 @@ void WatcherModulesLoaded(void) hHookWeatherUpdated = HookEvent(ME_WEATHER_UPDATED, WeatherUpdated);
/* restore watcher if it was running on last exit */
- if (db_get_b(NULL, MODULENAME, "RememberOnRestart", 0) == SDROR_RUNNING) {
- db_set_b(NULL, MODULENAME, "RememberOnRestart", 1);
+ if (g_plugin.getByte("RememberOnRestart", 0) == SDROR_RUNNING) {
+ g_plugin.setByte("RememberOnRestart", 1);
ServiceStartWatcher(0, 0); /* after modules loaded */
}
}
@@ -350,8 +350,8 @@ void UninitWatcher(void) {
/* remember watcher if running */
if (!ServiceStopWatcher(0, 0))
- if (db_get_b(NULL, MODULENAME, "RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT))
- db_set_b(NULL, MODULENAME, "RememberOnRestart", SDROR_RUNNING);
+ if (g_plugin.getByte("RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT))
+ g_plugin.setByte("RememberOnRestart", SDROR_RUNNING);
/* Message Shutdown */
UnhookEvent(hHookEventAdded);
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 3cd569c8ce..664f1892b8 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -116,7 +116,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA AvatarDialogData *data = (struct AvatarDialogData*) lParam;
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)createDefaultOverlayedIcon(TRUE));
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)createDefaultOverlayedIcon(FALSE));
- if (db_get_b(NULL, MODULENAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
+ if (g_plugin.getByte("LogToHistory", AVH_DEF_LOGTOHISTORY))
FillAvatarListFromDB(hwndList, data->hContact);
else if (opts.log_store_as_hash)
FillAvatarListFromFolder(hwndList, data->hContact);
@@ -310,7 +310,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA wchar_t avfolder[MAX_PATH];
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
GetContactFolder(avfolder, hContact);
- ShellExecute(nullptr, db_get_b(NULL, MODULENAME, "OpenFolderMethod", 0) ? L"explore" : L"open", avfolder, nullptr, nullptr, SW_SHOWNORMAL);
+ ShellExecute(nullptr, g_plugin.getByte("OpenFolderMethod", 0) ? L"explore" : L"open", avfolder, nullptr, nullptr, SW_SHOWNORMAL);
return TRUE;
}
break;
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index d15b8062bb..7ed09f7e59 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -283,7 +283,7 @@ int CMPlugin::Load() CoInitialize(nullptr);
// Is first run?
- if (db_get_b(NULL, MODULENAME, "FirstRun", 1)) {
+ if (g_plugin.getByte("FirstRun", 1)) {
// Show dialog
int ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FIRST_RUN), nullptr, FirstRunDlgProc, 0);
if (ret == 0)
@@ -291,29 +291,29 @@ int CMPlugin::Load() // Write settings
- db_set_b(NULL, MODULENAME, "LogToDisk", 1);
+ g_plugin.setByte("LogToDisk", 1);
if (ret == IDC_MIR_SAME)
- db_set_b(NULL, MODULENAME, "LogKeepSameFolder", 1);
+ g_plugin.setByte("LogKeepSameFolder", 1);
else
- db_set_b(NULL, MODULENAME, "LogKeepSameFolder", 0);
+ g_plugin.setByte("LogKeepSameFolder", 0);
if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP)
- db_set_b(NULL, MODULENAME, "LogPerContactFolders", 1);
+ g_plugin.setByte("LogPerContactFolders", 1);
else
- db_set_b(NULL, MODULENAME, "LogPerContactFolders", 0);
+ g_plugin.setByte("LogPerContactFolders", 0);
if (ret == IDC_DUP)
- db_set_b(NULL, MODULENAME, "StoreAsHash", 0);
+ g_plugin.setByte("StoreAsHash", 0);
else
- db_set_b(NULL, MODULENAME, "StoreAsHash", 1);
+ g_plugin.setByte("StoreAsHash", 1);
if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT)
- db_set_b(NULL, MODULENAME, "LogToHistory", 1);
+ g_plugin.setByte("LogToHistory", 1);
else
- db_set_b(NULL, MODULENAME, "LogToHistory", 0);
+ g_plugin.setByte("LogToHistory", 0);
- db_set_b(NULL, MODULENAME, "FirstRun", 0);
+ g_plugin.setByte("FirstRun", 0);
}
LoadOptions();
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index 3ea17f3fff..900bdf1c7a 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -170,7 +170,7 @@ void LoadOptions() LoadOpts(optionsControls, _countof(optionsControls), MODULENAME);
LoadOpts(popupsControls, _countof(popupsControls), MODULENAME);
- opts.log_per_contact_folders = db_get_b(NULL, MODULENAME, "LogPerContactFolders", 0);
- opts.log_keep_same_folder = db_get_b(NULL, MODULENAME, "LogKeepSameFolder", 0);
- opts.log_store_as_hash = db_get_b(NULL, MODULENAME, "StoreAsHash", 1);
+ opts.log_per_contact_folders = g_plugin.getByte("LogPerContactFolders", 0);
+ opts.log_keep_same_folder = g_plugin.getByte("LogKeepSameFolder", 0);
+ opts.log_store_as_hash = g_plugin.getByte("StoreAsHash", 1);
}
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index ead52b114d..fad9b3c33a 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -74,7 +74,7 @@ void ShowPopup(MCONTACT hContact, const wchar_t *title, const wchar_t *descripti void ShowDebugPopup(MCONTACT hContact, const wchar_t *title, const wchar_t *description)
{
- if (db_get_b(NULL, MODULENAME, "Debug", 0)) {
+ if (g_plugin.getByte("Debug", 0)) {
ShowPopup(hContact, title, description);
}
}
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 9b70f7f762..a3af7ab9bd 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -38,7 +38,7 @@ bool ContactEnabled(MCONTACT hContact, char *setting, int def) if (!ProtocolEnabled(proto))
return false;
- BYTE globpref = db_get_b(NULL, MODULENAME, setting, def);
+ BYTE globpref = g_plugin.getByte(setting, def);
BYTE userpref = db_get_b(hContact, MODULENAME, setting, BST_INDETERMINATE);
return (globpref && userpref == BST_INDETERMINATE) || userpref == BST_CHECKED;
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 71b3c8ad6f..2abe66e2bf 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -92,7 +92,7 @@ static int OnPlaySnd(WPARAM wParam, LPARAM lParam) case ID_STATUS_ONLINE: currstat <<= 1;
}
- if (!db_get_b(NULL, "Skin", "UseSound", 0))
+ if (!db_get_b(0, "Skin", "UseSound", 0))
doPlay = FALSE;
if (QuietTime)
@@ -192,7 +192,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_SETCURSEL, 0, 0);
BASS_DEVICEINFO info;
- ptrW tszDeviceName(db_get_wsa(NULL, MODULENAME, OPT_OUTDEVICE));
+ ptrW tszDeviceName(g_plugin.getWStringA(OPT_OUTDEVICE));
for (int i = 1; BASS_GetDeviceInfo(i + newBass, &info); i++) {
SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_ADDSTRING, 0, _A2T(info.name));
if (!mir_wstrcmp(tszDeviceName, _A2T(info.name)))
@@ -221,29 +221,29 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara SYSTEMTIME systime = { 0 };
GetDlgItemText(hwndDlg, IDC_OUTDEVICE, tmp, _countof(tmp));
- db_set_ws(NULL, MODULENAME, OPT_OUTDEVICE, tmp);
+ g_plugin.setWString(OPT_OUTDEVICE, tmp);
Volume = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
- db_set_b(NULL, MODULENAME, OPT_VOLUME, Volume);
+ g_plugin.setByte(OPT_VOLUME, Volume);
sndLimSnd = SendDlgItemMessage(hwndDlg, IDC_MAXCHANNEL, CB_GETCURSEL, 0, 0) + 1;
if (sndLimSnd > MAXCHAN)
sndLimSnd = MAXCHAN;
- db_set_b(NULL, MODULENAME, OPT_MAXCHAN, sndLimSnd);
+ g_plugin.setByte(OPT_MAXCHAN, sndLimSnd);
QuietTime = IsDlgButtonChecked(hwndDlg, IDC_QUIETTIME) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, OPT_QUIETTIME, QuietTime);
+ g_plugin.setByte(OPT_QUIETTIME, QuietTime);
SendDlgItemMessage(hwndDlg, IDC_TIME1, DTM_GETSYSTEMTIME, 0, (LPARAM)&systime);
TimeWrd1 = MAKEWORD(systime.wMinute, systime.wHour);
- db_set_w(NULL, MODULENAME, OPT_TIME1, TimeWrd1);
+ g_plugin.setWord(OPT_TIME1, TimeWrd1);
SendDlgItemMessage(hwndDlg, IDC_TIME2, DTM_GETSYSTEMTIME, 0, (LPARAM)&systime);
TimeWrd2 = MAKEWORD(systime.wMinute, systime.wHour);
- db_set_w(NULL, MODULENAME, OPT_TIME2, TimeWrd2);
+ g_plugin.setWord(OPT_TIME2, TimeWrd2);
EnPreview = IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, OPT_PREVIEW, EnPreview);
+ g_plugin.setByte(OPT_PREVIEW, EnPreview);
StatMask = 0;
for (int i = IDC_CHECKBOX10; i > IDC_CHECKBOX1 - 1; i--) {
@@ -252,7 +252,7 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara StatMask |= 1;
}
- db_set_w(NULL, MODULENAME, OPT_STATUS, StatMask);
+ g_plugin.setWord(OPT_STATUS, StatMask);
device = SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_GETCURSEL, 0, 0);
if (device == 0)
@@ -358,7 +358,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR SendMessage(hwndMute, BUTTONSETASFLATBTN, 1, 0);
SendMessage(hwndMute, BUTTONSETCUSTOMPAINT, 0, (LPARAM)&fnPainter);
- EnableFrameIcon(db_get_b(NULL, "Skin", "UseSound", 0) != 0);
+ EnableFrameIcon(db_get_b(0, "Skin", "UseSound", 0) != 0);
hwndSlider = CreateWindow(TRACKBAR_CLASS, L"", WS_CHILD | WS_VISIBLE | TBS_NOTICKS | TBS_TOOLTIPS, 21, 1, 100, 20,
hwnd, (HMENU)nullptr, (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), nullptr);
@@ -369,8 +369,8 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_COMMAND:
if ((HWND)lParam == hwndMute) {
- bool useSound = !db_get_b(NULL, "Skin", "UseSound", 0);
- db_set_b(NULL, "Skin", "UseSound", useSound);
+ bool useSound = !db_get_b(0, "Skin", "UseSound", 0);
+ db_set_b(0, "Skin", "UseSound", useSound);
EnableFrameIcon(useSound);
}
break;
@@ -379,7 +379,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (hBass != nullptr)
if (LOWORD(wParam) == SB_ENDSCROLL || LOWORD(wParam) == SB_THUMBTRACK) {
Volume = (DWORD)SendMessage(hwndSlider, TBM_GETPOS, 0, 0);
- db_set_b(NULL, MODULENAME, OPT_VOLUME, Volume);
+ g_plugin.setByte(OPT_VOLUME, Volume);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100);
SendMessage(hwndOptSlider, TBM_SETPOS, TRUE, Volume);
Preview = TRUE;
@@ -486,26 +486,26 @@ void LoadBassLibrary(const wchar_t *ptszPath) DBVARIANT dbv = { 0 };
BASS_DEVICEINFO info;
- if (!db_get_ws(NULL, MODULENAME, OPT_OUTDEVICE, &dbv))
+ if (!g_plugin.getWString(OPT_OUTDEVICE, &dbv))
for (size_t i = 1; BASS_GetDeviceInfo((DWORD)i, &info); i++)
if (!mir_wstrcmp(dbv.pwszVal, _A2T(info.name)))
device = (int)i;
db_free(&dbv);
- sndLimSnd = db_get_b(NULL, MODULENAME, OPT_MAXCHAN, MAXCHAN);
+ sndLimSnd = g_plugin.getByte(OPT_MAXCHAN, MAXCHAN);
if (sndLimSnd > MAXCHAN)
sndLimSnd = MAXCHAN;
- TimeWrd1 = db_get_w(NULL, MODULENAME, OPT_TIME1, 0);
- TimeWrd2 = db_get_w(NULL, MODULENAME, OPT_TIME2, 0);
- QuietTime = db_get_b(NULL, MODULENAME, OPT_QUIETTIME, 0);
- EnPreview = db_get_b(NULL, MODULENAME, OPT_PREVIEW, 0);
- StatMask = db_get_w(NULL, MODULENAME, OPT_STATUS, 0x3ff);
+ TimeWrd1 = g_plugin.getWord(OPT_TIME1, 0);
+ TimeWrd2 = g_plugin.getWord(OPT_TIME2, 0);
+ QuietTime = g_plugin.getByte(OPT_QUIETTIME, 0);
+ EnPreview = g_plugin.getByte(OPT_PREVIEW, 0);
+ StatMask = g_plugin.getWord(OPT_STATUS, 0x3ff);
BASS_Init(device, 44100, 0, g_clistApi.hwndContactList, nullptr);
- Volume = db_get_b(NULL, MODULENAME, OPT_VOLUME, 33);
+ Volume = g_plugin.getByte(OPT_VOLUME, 33);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100);
hPlaySound = HookEvent(ME_SKIN_PLAYINGSOUND, OnPlaySnd);
CreateFrame();
@@ -537,9 +537,9 @@ int OnModulesLoaded(WPARAM, LPARAM) }
else {
DBVARIANT dbv;
- if (db_get_ws(NULL, MODULENAME, OPT_BASSPATH, &dbv)) {
+ if (g_plugin.getWString(OPT_BASSPATH, &dbv)) {
mir_wstrncpy(CurrBassPath, VARSW(L"Plugins\\BASS\\bass.dll"), _countof(CurrBassPath));
- db_set_ws(NULL, MODULENAME, OPT_BASSPATH, CurrBassPath);
+ g_plugin.setWString(OPT_BASSPATH, CurrBassPath);
}
else {
mir_wstrcpy(CurrBassPath, dbv.pwszVal);
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 293708c2b6..f1434cf30e 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -272,58 +272,58 @@ void Options::Load(void) g_plugin.addHotkey(&hid);
}
- showContacts = db_get_b(0, MODULENAME, "showContacts", 0) ? true : false;
- showContactGroups = db_get_b(0, MODULENAME, "showContactGroups", 1) ? true : false;
- noFindBorder = db_get_b(0, MODULENAME, "noFindBorder", 0) ? true : false;
- groupNewOnTop = db_get_b(0, MODULENAME, "groupNewOnTop", 1) ? true : false;
- groupShowEvents = db_get_b(0, MODULENAME, "groupShowEvents", 1) ? true : false;
- groupShowTime = db_get_b(0, MODULENAME, "groupShowTime", 1) ? true : false;
- groupShowName = db_get_b(0, MODULENAME, "groupShowName", 0) ? true : false;
- groupShowMessage = db_get_b(0, MODULENAME, "groupShowMessage", 1) ? true : false;
- groupMessageLen = db_get_dw(0, MODULENAME, "groupMessageLen", 43);
+ showContacts = g_plugin.getByte("showContacts", 0) ? true : false;
+ showContactGroups = g_plugin.getByte("showContactGroups", 1) ? true : false;
+ noFindBorder = g_plugin.getByte("noFindBorder", 0) ? true : false;
+ groupNewOnTop = g_plugin.getByte("groupNewOnTop", 1) ? true : false;
+ groupShowEvents = g_plugin.getByte("groupShowEvents", 1) ? true : false;
+ groupShowTime = g_plugin.getByte("groupShowTime", 1) ? true : false;
+ groupShowName = g_plugin.getByte("groupShowName", 0) ? true : false;
+ groupShowMessage = g_plugin.getByte("groupShowMessage", 1) ? true : false;
+ groupMessageLen = g_plugin.getDword("groupMessageLen", 43);
if (groupMessageLen < 5) groupMessageLen = 5;
- groupTime = db_get_dw(0, MODULENAME, "groupTime", 5);
+ groupTime = g_plugin.getDword("groupTime", 5);
if (groupTime < 1) groupTime = 1;
- groupMessagesNumber = db_get_dw(0, MODULENAME, "groupMessagesNumber", 100);
+ groupMessagesNumber = g_plugin.getDword("groupMessagesNumber", 100);
if (groupMessagesNumber < 1) groupMessagesNumber = 1;
- messagesNewOnTop = db_get_b(0, MODULENAME, "messagesNewOnTop", 0) ? true : false;
- messagesShowDate = db_get_b(0, MODULENAME, "messagesShowDate", 0) ? true : false;
- messagesShowSec = db_get_b(0, MODULENAME, "messagesShowSec", 0) ? true : false;
- messagesShowName = db_get_b(0, MODULENAME, "messagesShowName", 1) ? true : false;
- messagesShowEvents = db_get_b(0, MODULENAME, "messagesShowEvents", 0) ? true : false;
- messagesUseSmileys = db_get_b(0, MODULENAME, "messagesUseSmileys", 1) ? true : false;
- searchForInList = db_get_b(0, MODULENAME, "searchForInList", 1) ? true : false;
- searchForInMess = db_get_b(0, MODULENAME, "searchForInMess", 1) ? true : false;
- searchMatchCase = db_get_b(0, MODULENAME, "searchMatchCase", 0) ? true : false;
- searchMatchWhole = db_get_b(0, MODULENAME, "searchMatchWhole", 0) ? true : false;
- searchOnlyIn = db_get_b(0, MODULENAME, "searchOnlyIn", 0) ? true : false;
- searchOnlyOut = db_get_b(0, MODULENAME, "searchOnlyOut", 0) ? true : false;
- searchOnlyGroup = db_get_b(0, MODULENAME, "searchOnlyGroup", 0) ? true : false;
- searchAllContacts = db_get_b(0, MODULENAME, "searchAllContacts", 0) ? true : false;
- schedulerAlerts = db_get_b(0, MODULENAME, "schedulerAlerts", 1) ? true : false;
- schedulerHistoryAlerts = db_get_b(0, MODULENAME, "schedulerHistoryAlerts", 1) ? true : false;
-
- defFilter = db_get_b(0, MODULENAME, "defFilter", defFilter);
- int filtersCount = db_get_dw(0, MODULENAME, "customFiltersCount", 0);
+ messagesNewOnTop = g_plugin.getByte("messagesNewOnTop", 0) ? true : false;
+ messagesShowDate = g_plugin.getByte("messagesShowDate", 0) ? true : false;
+ messagesShowSec = g_plugin.getByte("messagesShowSec", 0) ? true : false;
+ messagesShowName = g_plugin.getByte("messagesShowName", 1) ? true : false;
+ messagesShowEvents = g_plugin.getByte("messagesShowEvents", 0) ? true : false;
+ messagesUseSmileys = g_plugin.getByte("messagesUseSmileys", 1) ? true : false;
+ searchForInList = g_plugin.getByte("searchForInList", 1) ? true : false;
+ searchForInMess = g_plugin.getByte("searchForInMess", 1) ? true : false;
+ searchMatchCase = g_plugin.getByte("searchMatchCase", 0) ? true : false;
+ searchMatchWhole = g_plugin.getByte("searchMatchWhole", 0) ? true : false;
+ searchOnlyIn = g_plugin.getByte("searchOnlyIn", 0) ? true : false;
+ searchOnlyOut = g_plugin.getByte("searchOnlyOut", 0) ? true : false;
+ searchOnlyGroup = g_plugin.getByte("searchOnlyGroup", 0) ? true : false;
+ searchAllContacts = g_plugin.getByte("searchAllContacts", 0) ? true : false;
+ schedulerAlerts = g_plugin.getByte("schedulerAlerts", 1) ? true : false;
+ schedulerHistoryAlerts = g_plugin.getByte("schedulerHistoryAlerts", 1) ? true : false;
+
+ defFilter = g_plugin.getByte("defFilter", defFilter);
+ int filtersCount = g_plugin.getDword("customFiltersCount", 0);
for (int i = 0; i < filtersCount; ++i) {
char buf[256];
FilterOptions fo;
mir_snprintf(buf, "filterName_%d", i);
DBVARIANT nameV;
- if (!db_get_ws(0, MODULENAME, buf, &nameV)) {
+ if (!g_plugin.getWString(buf, &nameV)) {
fo.name = nameV.pwszVal;
db_free(&nameV);
}
else break;
mir_snprintf(buf, "filterInOut_%d", i);
- int inOut = db_get_b(0, MODULENAME, buf, 0);
+ int inOut = g_plugin.getByte(buf, 0);
if (inOut == 1)
fo.onlyIncomming = true;
else if (inOut == 2)
fo.onlyOutgoing = true;
mir_snprintf(buf, "filterEvents_%d", i);
DBVARIANT eventsV;
- if (!db_get_s(0, MODULENAME, buf, &eventsV)) {
+ if (!g_plugin.getString(buf, &eventsV)) {
int k = 0;
char* id = eventsV.pszVal;
while (eventsV.pszVal[k]) {
@@ -346,7 +346,7 @@ void Options::Load(void) defFilter = 0;
DBVARIANT defFilterStrV;
- if (!db_get_ws(0, MODULENAME, "defFilterStr", &defFilterStrV)) {
+ if (!g_plugin.getWString("defFilterStr", &defFilterStrV)) {
std::wstring filterName = defFilterStrV.pwszVal;
for (int i = 0; i < (int)customFilters.size(); ++i) {
if (filterName == customFilters[i].name) {
@@ -358,43 +358,43 @@ void Options::Load(void) }
}
- codepageTxt = db_get_dw(0, MODULENAME, "codepageTxt", CP_UTF8);
- codepageHtml1 = db_get_dw(0, MODULENAME, "codepageHtml1", CP_UTF8);
- codepageHtml2 = db_get_dw(0, MODULENAME, "codepageHtml2", CP_UTF8);
+ codepageTxt = g_plugin.getDword("codepageTxt", CP_UTF8);
+ codepageHtml1 = g_plugin.getDword("codepageHtml1", CP_UTF8);
+ codepageHtml2 = g_plugin.getDword("codepageHtml2", CP_UTF8);
DBVARIANT encodingV;
- if (!db_get_ws(0, MODULENAME, "encodingTxt", &encodingV)) {
+ if (!g_plugin.getWString("encodingTxt", &encodingV)) {
encodingTxt = encodingV.pwszVal;
db_free(&encodingV);
}
else encodingTxt = L"UTF-8";
- if (!db_get_ws(0, MODULENAME, "encodingHtml1", &encodingV)) {
+ if (!g_plugin.getWString("encodingHtml1", &encodingV)) {
encodingHtml1 = encodingV.pwszVal;
db_free(&encodingV);
}
else encodingHtml1 = L"UTF-8";
- if (!db_get_ws(0, MODULENAME, "encodingHtml2", &encodingV)) {
+ if (!g_plugin.getWString("encodingHtml2", &encodingV)) {
encodingHtml2 = encodingV.pwszVal;
db_free(&encodingV);
}
else encodingHtml2 = L"UTF-8";
- exportHtml1ShowDate = db_get_b(0, MODULENAME, "exportHtml1ShowDate", 1) ? true : false;
- exportHtml2ShowDate = db_get_b(0, MODULENAME, "exportHtml2ShowDate", 0) ? true : false;
- exportHtml2UseSmileys = db_get_b(0, MODULENAME, "exportHtml2UseSmileys", 1) ? true : false;
- if (!db_get_ws(0, MODULENAME, "extCssHtml2", &encodingV)) {
+ exportHtml1ShowDate = g_plugin.getByte("exportHtml1ShowDate", 1) ? true : false;
+ exportHtml2ShowDate = g_plugin.getByte("exportHtml2ShowDate", 0) ? true : false;
+ exportHtml2UseSmileys = g_plugin.getByte("exportHtml2UseSmileys", 1) ? true : false;
+ if (!g_plugin.getWString("extCssHtml2", &encodingV)) {
extCssHtml2 = encodingV.pwszVal;
db_free(&encodingV);
}
else extCssHtml2 = L"";
- if (!db_get_ws(0, MODULENAME, "ftpLogPath", &encodingV)) {
+ if (!g_plugin.getWString("ftpLogPath", &encodingV)) {
ftpLogPath = encodingV.pwszVal;
db_free(&encodingV);
}
- if (!db_get_ws(0, MODULENAME, "ftpExePath", &encodingV)) {
+ if (!g_plugin.getWString("ftpExePath", &encodingV)) {
ftpExePath = encodingV.pwszVal;
db_free(&encodingV);
}
@@ -415,51 +415,51 @@ COLORREF Options::GetColor(Colors colorId) void Options::Save()
{
- db_set_b(0, MODULENAME, "showContacts", showContacts ? 1 : 0);
- db_set_b(0, MODULENAME, "showContactGroups", showContactGroups ? 1 : 0);
- db_set_b(0, MODULENAME, "noFindBorder", noFindBorder ? 1 : 0);
- db_set_b(0, MODULENAME, "groupNewOnTop", groupNewOnTop ? 1 : 0);
- db_set_b(0, MODULENAME, "groupShowEvents", groupShowEvents ? 1 : 0);
- db_set_b(0, MODULENAME, "groupShowTime", groupShowTime ? 1 : 0);
- db_set_b(0, MODULENAME, "groupShowName", groupShowName ? 1 : 0);
- db_set_b(0, MODULENAME, "groupShowMessage", groupShowMessage ? 1 : 0);
+ g_plugin.setByte("showContacts", showContacts ? 1 : 0);
+ g_plugin.setByte("showContactGroups", showContactGroups ? 1 : 0);
+ g_plugin.setByte("noFindBorder", noFindBorder ? 1 : 0);
+ g_plugin.setByte("groupNewOnTop", groupNewOnTop ? 1 : 0);
+ g_plugin.setByte("groupShowEvents", groupShowEvents ? 1 : 0);
+ g_plugin.setByte("groupShowTime", groupShowTime ? 1 : 0);
+ g_plugin.setByte("groupShowName", groupShowName ? 1 : 0);
+ g_plugin.setByte("groupShowMessage", groupShowMessage ? 1 : 0);
if (groupMessageLen < 5)
groupMessageLen = 5;
- db_set_dw(0, MODULENAME, "groupMessageLen", groupMessageLen);
+ g_plugin.setDword("groupMessageLen", groupMessageLen);
if (groupTime < 1)
groupTime = 1;
- db_set_dw(0, MODULENAME, "groupTime", groupTime);
+ g_plugin.setDword("groupTime", groupTime);
if (groupMessagesNumber < 1)
groupMessagesNumber = 1;
- db_set_dw(0, MODULENAME, "groupMessagesNumber", groupMessagesNumber);
- db_set_b(0, MODULENAME, "messagesNewOnTop", messagesNewOnTop ? 1 : 0);
- db_set_b(0, MODULENAME, "messagesShowDate", messagesShowDate ? 1 : 0);
- db_set_b(0, MODULENAME, "messagesShowSec", messagesShowSec ? 1 : 0);
- db_set_b(0, MODULENAME, "messagesShowName", messagesShowName ? 1 : 0);
- db_set_b(0, MODULENAME, "messagesShowEvents", messagesShowEvents ? 1 : 0);
- db_set_b(0, MODULENAME, "messagesUseSmileys", messagesUseSmileys ? 1 : 0);
- db_set_b(0, MODULENAME, "searchForInList", searchForInList ? 1 : 0);
- db_set_b(0, MODULENAME, "searchForInMess", searchForInMess ? 1 : 0);
- db_set_b(0, MODULENAME, "searchMatchCase", searchMatchCase ? 1 : 0);
- db_set_b(0, MODULENAME, "searchMatchWhole", searchMatchWhole ? 1 : 0);
- db_set_b(0, MODULENAME, "searchOnlyIn", searchOnlyIn ? 1 : 0);
- db_set_b(0, MODULENAME, "searchOnlyOut", searchOnlyOut ? 1 : 0);
- db_set_b(0, MODULENAME, "searchOnlyGroup", searchOnlyGroup ? 1 : 0);
- db_set_b(0, MODULENAME, "searchAllContacts", searchAllContacts ? 1 : 0);
- db_set_b(0, MODULENAME, "schedulerAlerts", schedulerAlerts ? 1 : 0);
- db_set_b(0, MODULENAME, "schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
+ g_plugin.setDword("groupMessagesNumber", groupMessagesNumber);
+ g_plugin.setByte("messagesNewOnTop", messagesNewOnTop ? 1 : 0);
+ g_plugin.setByte("messagesShowDate", messagesShowDate ? 1 : 0);
+ g_plugin.setByte("messagesShowSec", messagesShowSec ? 1 : 0);
+ g_plugin.setByte("messagesShowName", messagesShowName ? 1 : 0);
+ g_plugin.setByte("messagesShowEvents", messagesShowEvents ? 1 : 0);
+ g_plugin.setByte("messagesUseSmileys", messagesUseSmileys ? 1 : 0);
+ g_plugin.setByte("searchForInList", searchForInList ? 1 : 0);
+ g_plugin.setByte("searchForInMess", searchForInMess ? 1 : 0);
+ g_plugin.setByte("searchMatchCase", searchMatchCase ? 1 : 0);
+ g_plugin.setByte("searchMatchWhole", searchMatchWhole ? 1 : 0);
+ g_plugin.setByte("searchOnlyIn", searchOnlyIn ? 1 : 0);
+ g_plugin.setByte("searchOnlyOut", searchOnlyOut ? 1 : 0);
+ g_plugin.setByte("searchOnlyGroup", searchOnlyGroup ? 1 : 0);
+ g_plugin.setByte("searchAllContacts", searchAllContacts ? 1 : 0);
+ g_plugin.setByte("schedulerAlerts", schedulerAlerts ? 1 : 0);
+ g_plugin.setByte("schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
if (defFilter < 0 || defFilter - 2 >= (int)customFilters.size())
defFilter = 0;
- db_set_b(0, MODULENAME, "defFilter", defFilter < 2 ? defFilter : 2);
+ g_plugin.setByte("defFilter", defFilter < 2 ? defFilter : 2);
if (defFilter >= 2)
- db_set_ws(0, MODULENAME, "defFilterStr", customFilters[defFilter - 2].name.c_str());
- db_set_dw(0, MODULENAME, "customFiltersCount", (DWORD)customFilters.size());
+ g_plugin.setWString("defFilterStr", customFilters[defFilter - 2].name.c_str());
+ g_plugin.setDword("customFiltersCount", (DWORD)customFilters.size());
for (int i = 0; i < (int)customFilters.size(); ++i) {
char buf[256];
mir_snprintf(buf, "filterName_%d", i);
- db_set_ws(0, MODULENAME, buf, customFilters[i].name.c_str());
+ g_plugin.setWString(buf, customFilters[i].name.c_str());
mir_snprintf(buf, "filterInOut_%d", i);
- db_set_b(0, MODULENAME, buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
+ g_plugin.setByte(buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
std::string events;
for (std::vector<int>::iterator it = customFilters[i].events.begin(); it != customFilters[i].events.end(); ++it) {
_itoa_s(*it, buf, 16);
@@ -468,24 +468,24 @@ void Options::Save() }
mir_snprintf(buf, "filterEvents_%d", i);
- db_set_s(0, MODULENAME, buf, events.c_str());
+ g_plugin.setString(buf, events.c_str());
}
- db_set_dw(0, MODULENAME, "codepageTxt", codepageTxt);
- db_set_dw(0, MODULENAME, "codepageHtml1", codepageHtml1);
- db_set_dw(0, MODULENAME, "codepageHtml2", codepageHtml2);
- db_set_ws(0, MODULENAME, "encodingTxt", encodingTxt.c_str());
- db_set_ws(0, MODULENAME, "encodingHtml1", encodingHtml1.c_str());
- db_set_ws(0, MODULENAME, "encodingHtml2", encodingHtml2.c_str());
- db_set_b(0, MODULENAME, "exportHtml1ShowDate", exportHtml1ShowDate ? 1 : 0);
- db_set_b(0, MODULENAME, "exportHtml2ShowDate", exportHtml2ShowDate ? 1 : 0);
- db_set_b(0, MODULENAME, "exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
- db_set_ws(0, MODULENAME, "extCssHtml2", extCssHtml2.c_str());
- db_set_ws(0, MODULENAME, "ftpLogPath", ftpLogPath.c_str());
+ g_plugin.setDword("codepageTxt", codepageTxt);
+ g_plugin.setDword("codepageHtml1", codepageHtml1);
+ g_plugin.setDword("codepageHtml2", codepageHtml2);
+ g_plugin.setWString("encodingTxt", encodingTxt.c_str());
+ g_plugin.setWString("encodingHtml1", encodingHtml1.c_str());
+ g_plugin.setWString("encodingHtml2", encodingHtml2.c_str());
+ g_plugin.setByte("exportHtml1ShowDate", exportHtml1ShowDate ? 1 : 0);
+ g_plugin.setByte("exportHtml2ShowDate", exportHtml2ShowDate ? 1 : 0);
+ g_plugin.setByte("exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
+ g_plugin.setWString("extCssHtml2", extCssHtml2.c_str());
+ g_plugin.setWString("ftpLogPath", ftpLogPath.c_str());
if (ftpExePath != ftpExePathDef)
- db_set_ws(0, MODULENAME, "ftpExePath", ftpExePath.c_str());
+ g_plugin.setWString("ftpExePath", ftpExePath.c_str());
else
- db_unset(0, MODULENAME, "ftpExePath");
+ g_plugin.delSetting("ftpExePath");
}
void Options::SaveTasks(std::list<TaskOptions>* tasks)
@@ -497,51 +497,51 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks) char buf[256];
for (std::list<TaskOptions>::iterator it = tasks->begin(); it != tasks->end(); ++it) {
mir_snprintf(buf, "Task_compress_%d", i);
- db_set_b(0, MODULENAME, buf, it->compress);
+ g_plugin.setByte(buf, it->compress);
mir_snprintf(buf, "Task_useFtp_%d", i);
- db_set_b(0, MODULENAME, buf, it->useFtp);
+ g_plugin.setByte(buf, it->useFtp);
mir_snprintf(buf, "Task_isSystem_%d", i);
- db_set_b(0, MODULENAME, buf, it->isSystem);
+ g_plugin.setByte(buf, it->isSystem);
mir_snprintf(buf, "Task_active_%d", i);
- db_set_b(0, MODULENAME, buf, it->active);
+ g_plugin.setByte(buf, it->active);
mir_snprintf(buf, "Task_exportImported_%d", i);
- db_set_b(0, MODULENAME, buf, it->exportImported);
+ g_plugin.setByte(buf, it->exportImported);
mir_snprintf(buf, "Task_type_%d", i);
- db_set_b(0, MODULENAME, buf, it->type);
+ g_plugin.setByte(buf, it->type);
mir_snprintf(buf, "Task_eventUnit_%d", i);
- db_set_b(0, MODULENAME, buf, it->eventUnit);
+ g_plugin.setByte(buf, it->eventUnit);
mir_snprintf(buf, "Task_trigerType_%d", i);
- db_set_b(0, MODULENAME, buf, it->trigerType);
+ g_plugin.setByte(buf, it->trigerType);
mir_snprintf(buf, "Task_exportType_%d", i);
- db_set_b(0, MODULENAME, buf, it->exportType);
+ g_plugin.setByte(buf, it->exportType);
mir_snprintf(buf, "Task_importType_%d", i);
- db_set_b(0, MODULENAME, buf, it->importType);
+ g_plugin.setByte(buf, it->importType);
mir_snprintf(buf, "Task_eventDeltaTime_%d", i);
- db_set_dw(0, MODULENAME, buf, it->eventDeltaTime);
+ g_plugin.setDword(buf, it->eventDeltaTime);
mir_snprintf(buf, "Task_filterId_%d", i);
- db_set_dw(0, MODULENAME, buf, it->filterId);
+ g_plugin.setDword(buf, it->filterId);
mir_snprintf(buf, "Task_dayTime_%d", i);
- db_set_dw(0, MODULENAME, buf, it->dayTime);
+ g_plugin.setDword(buf, it->dayTime);
mir_snprintf(buf, "Task_dayOfWeek_%d", i);
- db_set_dw(0, MODULENAME, buf, it->dayOfWeek);
+ g_plugin.setDword(buf, it->dayOfWeek);
mir_snprintf(buf, "Task_dayOfMonth_%d", i);
- db_set_dw(0, MODULENAME, buf, it->dayOfMonth);
+ g_plugin.setDword(buf, it->dayOfMonth);
mir_snprintf(buf, "Task_deltaTime_%d", i);
- db_set_dw(0, MODULENAME, buf, it->deltaTime);
+ g_plugin.setDword(buf, it->deltaTime);
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- db_set_dw(0, MODULENAME, buf, (int)it->lastExport);
+ g_plugin.setDword(buf, (int)it->lastExport);
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- db_set_dw(0, MODULENAME, buf, ((unsigned long long int)it->lastExport) >> 32);
+ g_plugin.setDword(buf, ((unsigned long long int)it->lastExport) >> 32);
mir_snprintf(buf, "Task_ftpName_%d", i);
- db_set_ws(0, MODULENAME, buf, it->ftpName.c_str());
+ g_plugin.setWString(buf, it->ftpName.c_str());
mir_snprintf(buf, "Task_filterName_%d", i);
- db_set_ws(0, MODULENAME, buf, it->filterName.c_str());
+ g_plugin.setWString(buf, it->filterName.c_str());
mir_snprintf(buf, "Task_filePath_%d", i);
- db_set_ws(0, MODULENAME, buf, it->filePath.c_str());
+ g_plugin.setWString(buf, it->filePath.c_str());
mir_snprintf(buf, "Task_taskName_%d", i);
- db_set_ws(0, MODULENAME, buf, it->taskName.c_str());
+ g_plugin.setWString(buf, it->taskName.c_str());
mir_snprintf(buf, "Task_zipPassword_%d", i);
- db_set_s(0, MODULENAME, buf, it->zipPassword.c_str());
+ g_plugin.setString(buf, it->zipPassword.c_str());
mir_snprintf(buf, "IsInTask_%d", i);
for (auto &hContact : Contacts())
@@ -554,49 +554,49 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks) taskOptions.push_back(*it);
}
- db_set_dw(0, MODULENAME, "Task_count", i);
+ g_plugin.setDword("Task_count", i);
for (i = (int)tasks->size(); i < oldTaskNr; ++i) {
mir_snprintf(buf, "Task_compress_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_useFtp_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_isSystem_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_active_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_type_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_eventUnit_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_trigerType_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_exportType_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_eventDeltaTime_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_filterId_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_dayTime_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_dayOfWeek_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_dayOfMonth_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_deltaTime_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_ftpName_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_filterName_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_filePath_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "Task_taskName_%d", i);
- db_unset(NULL, MODULENAME, buf);
+ g_plugin.delSetting(buf);
mir_snprintf(buf, "IsInTask_%d", i);
for (auto &hContact : Contacts())
@@ -609,77 +609,77 @@ void Options::SaveTaskTime(TaskOptions& to) int i = to.orderNr;
char buf[256];
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- db_set_dw(0, MODULENAME, buf, (int)to.lastExport);
+ g_plugin.setDword(buf, (int)to.lastExport);
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- db_set_dw(0, MODULENAME, buf, ((unsigned long long int)to.lastExport) >> 32);
+ g_plugin.setDword(buf, ((unsigned long long int)to.lastExport) >> 32);
}
void Options::LoadTasks()
{
- int taskCount = db_get_dw(0, MODULENAME, "Task_count", 0);
+ int taskCount = g_plugin.getDword("Task_count", 0);
char buf[256];
for (int i = 0; i < taskCount; ++i) {
TaskOptions to;
mir_snprintf(buf, "Task_compress_%d", i);
- to.compress = db_get_b(0, MODULENAME, buf, to.compress) != 0;
+ to.compress = g_plugin.getByte(buf, to.compress) != 0;
mir_snprintf(buf, "Task_useFtp_%d", i);
- to.useFtp = db_get_b(0, MODULENAME, buf, to.useFtp) != 0;
+ to.useFtp = g_plugin.getByte(buf, to.useFtp) != 0;
mir_snprintf(buf, "Task_isSystem_%d", i);
- to.isSystem = db_get_b(0, MODULENAME, buf, to.isSystem) != 0;
+ to.isSystem = g_plugin.getByte(buf, to.isSystem) != 0;
mir_snprintf(buf, "Task_active_%d", i);
- to.active = db_get_b(0, MODULENAME, buf, to.active) != 0;
+ to.active = g_plugin.getByte(buf, to.active) != 0;
mir_snprintf(buf, "Task_exportImported_%d", i);
- to.exportImported = db_get_b(0, MODULENAME, buf, to.exportImported) != 0;
+ to.exportImported = g_plugin.getByte(buf, to.exportImported) != 0;
mir_snprintf(buf, "Task_type_%d", i);
- to.type = (TaskOptions::TaskType)db_get_b(0, MODULENAME, buf, to.type);
+ to.type = (TaskOptions::TaskType)g_plugin.getByte(buf, to.type);
mir_snprintf(buf, "Task_eventUnit_%d", i);
- to.eventUnit = (TaskOptions::EventUnit)db_get_b(0, MODULENAME, buf, to.eventUnit);
+ to.eventUnit = (TaskOptions::EventUnit)g_plugin.getByte(buf, to.eventUnit);
mir_snprintf(buf, "Task_trigerType_%d", i);
- to.trigerType = (TaskOptions::TrigerType)db_get_b(0, MODULENAME, buf, to.trigerType);
+ to.trigerType = (TaskOptions::TrigerType)g_plugin.getByte(buf, to.trigerType);
mir_snprintf(buf, "Task_exportType_%d", i);
- to.exportType = (IExport::ExportType)db_get_b(0, MODULENAME, buf, to.exportType);
+ to.exportType = (IExport::ExportType)g_plugin.getByte(buf, to.exportType);
mir_snprintf(buf, "Task_importType_%d", i);
- to.importType = (IImport::ImportType)db_get_b(0, MODULENAME, buf, to.importType);
+ to.importType = (IImport::ImportType)g_plugin.getByte(buf, to.importType);
mir_snprintf(buf, "Task_eventDeltaTime_%d", i);
- to.eventDeltaTime = db_get_dw(0, MODULENAME, buf, to.eventDeltaTime);
+ to.eventDeltaTime = g_plugin.getDword(buf, to.eventDeltaTime);
mir_snprintf(buf, "Task_filterId_%d", i);
- to.filterId = db_get_dw(0, MODULENAME, buf, to.filterId);
+ to.filterId = g_plugin.getDword(buf, to.filterId);
mir_snprintf(buf, "Task_dayTime_%d", i);
- to.dayTime = db_get_dw(0, MODULENAME, buf, to.dayTime);
+ to.dayTime = g_plugin.getDword(buf, to.dayTime);
mir_snprintf(buf, "Task_dayOfWeek_%d", i);
- to.dayOfWeek = db_get_dw(0, MODULENAME, buf, to.dayOfWeek);
+ to.dayOfWeek = g_plugin.getDword(buf, to.dayOfWeek);
mir_snprintf(buf, "Task_dayOfMonth_%d", i);
- to.dayOfMonth = db_get_dw(0, MODULENAME, buf, to.dayOfMonth);
+ to.dayOfMonth = g_plugin.getDword(buf, to.dayOfMonth);
mir_snprintf(buf, "Task_deltaTime_%d", i);
- to.deltaTime = db_get_dw(0, MODULENAME, buf, to.deltaTime);
+ to.deltaTime = g_plugin.getDword(buf, to.deltaTime);
unsigned long long int le = to.lastExport;
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- to.lastExport = db_get_dw(0, MODULENAME, buf, (int)le) & 0xffffffff;
+ to.lastExport = g_plugin.getDword(buf, (int)le) & 0xffffffff;
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- to.lastExport |= ((unsigned long long int)db_get_dw(0, MODULENAME, buf, le >> 32)) << 32;
+ to.lastExport |= ((unsigned long long int)g_plugin.getDword(buf, le >> 32)) << 32;
mir_snprintf(buf, "Task_ftpName_%d", i);
DBVARIANT var;
- if (!db_get_ws(0, MODULENAME, buf, &var)) {
+ if (!g_plugin.getWString(buf, &var)) {
to.ftpName = var.pwszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_filterName_%d", i);
- if (!db_get_ws(0, MODULENAME, buf, &var)) {
+ if (!g_plugin.getWString(buf, &var)) {
to.filterName = var.pwszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_filePath_%d", i);
- if (!db_get_ws(0, MODULENAME, buf, &var)) {
+ if (!g_plugin.getWString(buf, &var)) {
to.filePath = var.pwszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_taskName_%d", i);
- if (!db_get_ws(0, MODULENAME, buf, &var)) {
+ if (!g_plugin.getWString(buf, &var)) {
to.taskName = var.pwszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_zipPassword_%d", i);
- if (!db_get_s(0, MODULENAME, buf, &var)) {
+ if (!g_plugin.getString(buf, &var)) {
to.zipPassword = var.pszVal;
db_free(&var);
}
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index d75952e392..1fd7834008 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -77,7 +77,7 @@ static bool NotifyTyping(MCONTACT hContact) {
int res = db_get_b(hContact, "SRMsg", "SupportTyping", 2);
if (res == 2)
- res = db_get_b(NULL, "SRMsg", "DefaultTyping", 1);
+ res = db_get_b(0, "SRMsg", "DefaultTyping", 1);
return res != 0;
}
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index 314ff43ce1..700a8b5014 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -61,22 +61,22 @@ inline const wchar_t* SetString(char* key, const wchar_t* value) size_t len = mir_wstrlen(value) + 1;
wchar_t* val = new wchar_t[len];
wcscpy_s(val, len, value);
- db_set_ws(NULL, BOLTUN_KEY, key, val);
+ db_set_ws(0, BOLTUN_KEY, key, val);
return val;
}
#define BUILDETTERS(x, str, def) \
const bool BoltunConfig::Get##x() { \
- return db_get_dw(NULL, BOLTUN_KEY, str, def) != 0; } \
+ return db_get_dw(0, BOLTUN_KEY, str, def) != 0; } \
const bool BoltunConfig::Set##x(const bool value) { \
- db_set_dw(NULL, BOLTUN_KEY, str, value); \
+ db_set_dw(0, BOLTUN_KEY, str, value); \
return value; }
#define BUILDINTETTERS(x, str, def) \
const int BoltunConfig::Get##x() { \
- return db_get_dw(NULL, BOLTUN_KEY, str, def); } \
+ return db_get_dw(0, BOLTUN_KEY, str, def); } \
const int BoltunConfig::Set##x(const int value) { \
- db_set_dw(NULL, BOLTUN_KEY, str, value); \
+ db_set_dw(0, BOLTUN_KEY, str, value); \
return value; }
#define BUILDSTRETTERS(x, str, def) \
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index b3a6b10ded..b08d600000 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -263,14 +263,14 @@ static void RestoreOldSettings(void) CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
if (g_bOldSetting & OLD_SOUND)
- db_set_b(NULL, "Skin", "UseSound", 1);
+ db_set_b(0, "Skin", "UseSound", 1);
if (g_bOldSetting & OLD_FLTCONT) // show Floating contacts if needed
{
if (ServiceExists("FloatingContacts/MainHideAllThumbs"))
CallService("FloatingContacts/MainHideAllThumbs", 0, 0);
else
- db_set_b(NULL, "FloatingContacts", "HideAll", 0);
+ db_set_b(0, "FloatingContacts", "HideAll", 0);
}
g_bOldSetting = 0;
}
@@ -303,7 +303,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara if (g_wMask & OPT_CHANGESTATUS) // is this even needed?
{
- BYTE bReqMode = db_get_b(NULL, MOD_NAME, "stattype", 2);
+ BYTE bReqMode = db_get_b(0, MOD_NAME, "stattype", 2);
unsigned uMode = (STATUS_ARR_TO_ID[bReqMode]);
DBVARIANT dbVar;
if (g_wMask & OPT_USEDEFMSG || db_get_ws(NULL, MOD_NAME, "statmsg", &dbVar)) {
@@ -336,16 +336,16 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara }
// disable sounds
- if ((g_wMask & OPT_DISABLESNDS) && db_get_b(NULL, "Skin", "UseSound", 1)) {
+ if ((g_wMask & OPT_DISABLESNDS) && db_get_b(0, "Skin", "UseSound", 1)) {
// save current
g_bOldSetting |= OLD_SOUND;
- db_set_b(NULL, "Skin", "UseSound", 0);
+ db_set_b(0, "Skin", "UseSound", 0);
}
g_bWindowHidden = true;
g_bOldSetting |= OLD_WASHIDDEN;
- db_set_b(NULL, MOD_NAME, "OldSetting", g_bOldSetting);
+ db_set_b(0, MOD_NAME, "OldSetting", g_bOldSetting);
}
return 0;
@@ -356,7 +356,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara if (g_wMask & OPT_REQPASS) { //password request
DBVARIANT dbVar;
- if (!db_get_s(NULL, MOD_NAME, "password", &dbVar)) {
+ if (!db_get_s(0, MOD_NAME, "password", &dbVar)) {
g_fPassRequested = true;
strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
@@ -405,7 +405,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara PostMessage(hWnd, WM_MOUSEMOVE, 0, (LPARAM)MAKELONG(2, 2)); // reset core's IDLE
g_bWindowHidden = false;
- db_set_b(NULL, MOD_NAME, "OldSetting", 0);
+ db_set_b(0, MOD_NAME, "OldSetting", 0);
}
return 0;
}
@@ -473,7 +473,7 @@ static wchar_t *HokeyVkToName(WORD vkKey) static wchar_t *GetBossKeyText(void)
{
- WORD wHotKey = db_get_w(NULL, "SkinHotKeys", "Hide/Show Miranda", HOTKEYCODE(HOTKEYF_CONTROL, VK_F12));
+ WORD wHotKey = db_get_w(0, "SkinHotKeys", "Hide/Show Miranda", HOTKEYCODE(HOTKEYF_CONTROL, VK_F12));
BYTE key = LOBYTE(wHotKey);
BYTE shift = HIBYTE(wHotKey);
@@ -599,7 +599,7 @@ static int EnumProtos(WPARAM, LPARAM) static int MirandaLoaded(WPARAM, LPARAM)
{
- g_wMask = db_get_w(NULL, MOD_NAME, "optsmask", DEFAULTSETTING);
+ g_wMask = db_get_w(0, MOD_NAME, "optsmask", DEFAULTSETTING);
RegisterCoreHotKeys();
@@ -660,18 +660,18 @@ static int MirandaLoaded(WPARAM, LPARAM) int CMPlugin::Load()
{
- g_wMaskAdv = db_get_w(NULL, MOD_NAME, "optsmaskadv", 0);
- g_bOldSetting = db_get_b(NULL, MOD_NAME, "OldSetting", 0);
+ g_wMaskAdv = db_get_w(0, MOD_NAME, "optsmaskadv", 0);
+ g_bOldSetting = db_get_b(0, MOD_NAME, "OldSetting", 0);
if ((g_bOldSetting & OLD_POPUP) && !(g_wMaskAdv & OPT_RESTORE)) // Restore popup settings if Miranda was crushed or killed in hidden mode and "Restore hiding on startup after failure" option is disabled
{
- if (db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) == 0)
- db_set_b(NULL, "Popup", "ModuleIsEnabled", 1);
+ if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 0)
+ db_set_b(0, "Popup", "ModuleIsEnabled", 1);
}
- if (g_wMaskAdv & OPT_HIDEONSTART && db_get_b(NULL, "Popup", "ModuleIsEnabled", 0)) // hack for disabling popup on startup if "Hide Miranda on startup" is enabled
+ if (g_wMaskAdv & OPT_HIDEONSTART && db_get_b(0, "Popup", "ModuleIsEnabled", 0)) // hack for disabling popup on startup if "Hide Miranda on startup" is enabled
{
g_bOldSetting |= OLD_POPUP;
- db_set_b(NULL, "Popup", "ModuleIsEnabled", 0);
+ db_set_b(0, "Popup", "ModuleIsEnabled", 0);
}
g_plugin.registerIcon("BossKey", iconList);
diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index c3d8762199..ba70b6cbdc 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -54,7 +54,7 @@ VOID CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD) void InitIdleTimer()
{
- minutes = db_get_b(NULL, MOD_NAME, "time", 10);
+ minutes = db_get_b(0, MOD_NAME, "time", 10);
hTimer = SetTimer(nullptr, 0, 2000, IdleTimer);
}
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index 46ebb3832a..39f335cfe3 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam DBVARIANT dbVar;
- if (!db_get_s(NULL, MOD_NAME, "password", &dbVar)) {
+ if (!db_get_s(0, MOD_NAME, "password", &dbVar)) {
SetDlgItemTextA(hwndDlg, IDC_MAINOPT_PASS, dbVar.pszVal);
db_free(&dbVar);
}
@@ -57,7 +57,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_INSERTSTRING, -1, (LPARAM)Clist_GetStatusModeDescription(i, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, db_get_b(NULL, MOD_NAME, "stattype", 2), 0);
+ SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_SETCURSEL, db_get_b(0, MOD_NAME, "stattype", 2), 0);
SendMessage(hwndDlg, WM_USER + 60, 0, 0);
SendMessage(hwndDlg, WM_USER + 50, 0, 0);
@@ -75,14 +75,14 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam // write down status type
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_CHANGESTATUSBOX) == BST_CHECKED) {
- db_set_b(NULL, MOD_NAME, "stattype", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0));
+ db_set_b(0, MOD_NAME, "stattype", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MAINOPT_CHGSTS, CB_GETCURSEL, 0, 0));
// status msg, if needed
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_MAINOPT_STATMSG))) { // meaning we should save it
wchar_t tszMsg[1025];
GetDlgItemText(hwndDlg, IDC_MAINOPT_STATMSG, tszMsg, _countof(tszMsg));
if (tszMsg[0] != 0)
- db_set_ws(NULL, MOD_NAME, "statmsg", tszMsg);
+ db_set_ws(0, MOD_NAME, "statmsg", tszMsg);
else // delete current setting
db_unset(NULL, MOD_NAME, "statmsg");
}
@@ -94,7 +94,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam char szPass[MAXPASSLEN + 1];
GetDlgItemTextA(hwndDlg, IDC_MAINOPT_PASS, szPass, _countof(szPass));
if (szPass[0] != 0){
- db_set_s(NULL, MOD_NAME, "password", szPass);
+ db_set_s(0, MOD_NAME, "password", szPass);
wMask |= OPT_REQPASS;
}
}
@@ -104,7 +104,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_USEDEFMSG) == BST_CHECKED) wMask |= OPT_USEDEFMSG;
if (IsDlgButtonChecked(hwndDlg, IDC_MAINOPT_TRAYICON) == BST_CHECKED) wMask |= OPT_TRAYICON;
- db_set_w(NULL, MOD_NAME, "optsmask", wMask);
+ db_set_w(0, MOD_NAME, "optsmask", wMask);
g_wMask = wMask;
return true;
}
@@ -216,7 +216,7 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
g_fOptionsOpen = true;
- minutes = db_get_b(NULL, MOD_NAME, "time", 10);
+ minutes = db_get_b(0, MOD_NAME, "time", 10);
wchar_t szMinutes[4] = { 0 };
_itow(minutes, szMinutes, 10);
SendDlgItemMessage(hwndDlg, IDC_MAINOPT_TIME, EM_LIMITTEXT, 2, 0);
@@ -257,8 +257,8 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetDlgItemText(hwndDlg, IDC_MAINOPT_TIME, szMinutes, _countof(szMinutes));
minutes = _wtoi(szMinutes);
if (minutes < 1) minutes = 1;
- db_set_b(NULL, MOD_NAME, "time", minutes);
- db_set_w(NULL, MOD_NAME, "optsmaskadv", wMaskAdv);
+ db_set_b(0, MOD_NAME, "time", minutes);
+ db_set_w(0, MOD_NAME, "optsmaskadv", wMaskAdv);
g_wMaskAdv = wMaskAdv;
return true;
}
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 01b36144dc..aeac064fb6 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -32,57 +32,57 @@ Options options; void LoadOptions()
{
- options.iAbsencePeriod = db_get_dw(NULL, MODULENAME, "iAbsencePeriod", 14);
- options.iAbsencePeriod2 = db_get_dw(NULL, MODULENAME, "iAbsencePeriod2", 30 * 3);
- options.iSilencePeriod = db_get_dw(NULL, MODULENAME, "iSilencePeriod", 30);
-
- options.iShowPopup = db_get_b(NULL, MODULENAME, "iShowPopUp", 1);
- options.iShowEvent = db_get_b(NULL, MODULENAME, "iShowEvent", 0);
- options.iShowUDetails = db_get_b(NULL, MODULENAME, "iShowUDetails", 0);
- options.iShowMessageWindow = db_get_b(NULL, MODULENAME, "iShowMessageWindow", 1);
-
- options.iPopupColorBack = db_get_dw(NULL, MODULENAME, "iPopUpColorBack", DEF_COLOR_BACK);
- options.iPopupColorFore = db_get_dw(NULL, MODULENAME, "iPopUpColorFore", DEF_COLOR_FORE);
-
- options.iUsePopupColors = db_get_b(NULL, MODULENAME, "iUsePopupColors", 0);
- options.iUseWinColors = db_get_b(NULL, MODULENAME, "iUseWinColors", 0);
- options.iPopupDelay = db_get_b(NULL, MODULENAME, "iPopUpDelay", 0);
-
- options.iShowPopup2 = db_get_b(NULL, MODULENAME, "iShowPopUp2", 1);
- options.iShowEvent2 = db_get_b(NULL, MODULENAME, "iShowEvent2", 0);
- options.action2 = (GoneContactAction)db_get_b(NULL, MODULENAME, "Action2", (BYTE)GCA_NOACTION);
- options.notifyFirstOnline = db_get_b(NULL, MODULENAME, "bShowFirstSight", 0) ? true : false;
- options.hideInactive = db_get_b(NULL, MODULENAME, "bHideInactive", 0) ? true : false;
- options.enableMissYou = db_get_b(NULL, MODULENAME, "bMissYouEnabled", 1) ? true : false;
+ options.iAbsencePeriod = g_plugin.getDword("iAbsencePeriod", 14);
+ options.iAbsencePeriod2 = g_plugin.getDword("iAbsencePeriod2", 30 * 3);
+ options.iSilencePeriod = g_plugin.getDword("iSilencePeriod", 30);
+
+ options.iShowPopup = g_plugin.getByte("iShowPopUp", 1);
+ options.iShowEvent = g_plugin.getByte("iShowEvent", 0);
+ options.iShowUDetails = g_plugin.getByte("iShowUDetails", 0);
+ options.iShowMessageWindow = g_plugin.getByte("iShowMessageWindow", 1);
+
+ options.iPopupColorBack = g_plugin.getDword("iPopUpColorBack", DEF_COLOR_BACK);
+ options.iPopupColorFore = g_plugin.getDword("iPopUpColorFore", DEF_COLOR_FORE);
+
+ options.iUsePopupColors = g_plugin.getByte("iUsePopupColors", 0);
+ options.iUseWinColors = g_plugin.getByte("iUseWinColors", 0);
+ options.iPopupDelay = g_plugin.getByte("iPopUpDelay", 0);
+
+ options.iShowPopup2 = g_plugin.getByte("iShowPopUp2", 1);
+ options.iShowEvent2 = g_plugin.getByte("iShowEvent2", 0);
+ options.action2 = (GoneContactAction)g_plugin.getByte("Action2", (BYTE)GCA_NOACTION);
+ options.notifyFirstOnline = g_plugin.getByte("bShowFirstSight", 0) ? true : false;
+ options.hideInactive = g_plugin.getByte("bHideInactive", 0) ? true : false;
+ options.enableMissYou = g_plugin.getByte("bMissYouEnabled", 1) ? true : false;
}
void SaveOptions()
{
- db_set_dw(NULL, MODULENAME, "iAbsencePeriod", options.iAbsencePeriod);
- db_set_dw(NULL, MODULENAME, "iAbsencePeriod2", options.iAbsencePeriod2);
- db_set_dw(NULL, MODULENAME, "iSilencePeriod", options.iSilencePeriod);
-
- db_set_b(NULL, MODULENAME, "iShowPopUp", options.iShowPopup);
- db_set_b(NULL, MODULENAME, "iShowEvent", options.iShowEvent);
- db_set_b(NULL, MODULENAME, "iShowUDetails", options.iShowUDetails);
- db_set_b(NULL, MODULENAME, "iShowMessageWindow", options.iShowMessageWindow);
-
- db_set_b(NULL, MODULENAME, "iShowPopUp2", options.iShowPopup2);
- db_set_b(NULL, MODULENAME, "iShowEvent2", options.iShowEvent2);
- db_set_b(NULL, MODULENAME, "Action2", (BYTE)options.action2);
- db_set_b(NULL, MODULENAME, "bShowFirstSight", options.notifyFirstOnline ? 1 : 0);
- db_set_b(NULL, MODULENAME, "bHideInactive", options.hideInactive ? 1 : 0);
- db_set_b(NULL, MODULENAME, "bMissYouEnabled", options.enableMissYou ? 1 : 0);
+ g_plugin.setDword("iAbsencePeriod", options.iAbsencePeriod);
+ g_plugin.setDword("iAbsencePeriod2", options.iAbsencePeriod2);
+ g_plugin.setDword("iSilencePeriod", options.iSilencePeriod);
+
+ g_plugin.setByte("iShowPopUp", options.iShowPopup);
+ g_plugin.setByte("iShowEvent", options.iShowEvent);
+ g_plugin.setByte("iShowUDetails", options.iShowUDetails);
+ g_plugin.setByte("iShowMessageWindow", options.iShowMessageWindow);
+
+ g_plugin.setByte("iShowPopUp2", options.iShowPopup2);
+ g_plugin.setByte("iShowEvent2", options.iShowEvent2);
+ g_plugin.setByte("Action2", (BYTE)options.action2);
+ g_plugin.setByte("bShowFirstSight", options.notifyFirstOnline ? 1 : 0);
+ g_plugin.setByte("bHideInactive", options.hideInactive ? 1 : 0);
+ g_plugin.setByte("bMissYouEnabled", options.enableMissYou ? 1 : 0);
}
void SavePopupOptions()
{
- db_set_dw(NULL, MODULENAME, "iPopUpColorBack", options.iPopupColorBack);
- db_set_dw(NULL, MODULENAME, "iPopUpColorFore", options.iPopupColorFore);
+ g_plugin.setDword("iPopUpColorBack", options.iPopupColorBack);
+ g_plugin.setDword("iPopUpColorFore", options.iPopupColorFore);
- db_set_b(NULL, MODULENAME, "iUsePopupColors", options.iUsePopupColors);
- db_set_b(NULL, MODULENAME, "iUseWinColors", options.iUseWinColors);
- db_set_b(NULL, MODULENAME, "iPopUpDelay", options.iPopupDelay);
+ g_plugin.setByte("iUsePopupColors", options.iUsePopupColors);
+ g_plugin.setByte("iUseWinColors", options.iUseWinColors);
+ g_plugin.setByte("iPopUpDelay", options.iPopupDelay);
}
/**
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 430f6359c5..3761a141b0 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -69,7 +69,7 @@ void getDefaultMessage(HWND hwnd, UINT control, MCONTACT hContact) SetDlgItemText(hwnd, control, dbv.pwszVal);
db_free(&dbv);
}
- else if (!db_get_ws(NULL, MODULENAME, "PounceMsg", &dbv)) {
+ else if (!g_plugin.getWString("PounceMsg", &dbv)) {
SetDlgItemText(hwnd, control, dbv.pwszVal);
db_free(&dbv);
}
@@ -318,12 +318,12 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
- db_set_w(wi->hContact, MODULENAME, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, MODULENAME, "SendIfMyStatusIsFLAG", 0));
- db_set_w(wi->hContact, MODULENAME, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, MODULENAME, "SendIfTheirStatusIsFLAG", 0));
- db_set_b(wi->hContact, MODULENAME, "Reuse", (BYTE)db_get_b(NULL, MODULENAME, "Reuse", 0));
- db_set_b(wi->hContact, MODULENAME, "GiveUpDays", (BYTE)db_get_b(NULL, MODULENAME, "GiveUpDays", 0));
- db_set_dw(wi->hContact, MODULENAME, "GiveUpDate", (DWORD)db_get_dw(NULL, MODULENAME, "GiveUpDate", 0));
- db_set_w(wi->hContact, MODULENAME, "ConfirmTimeout", (WORD)db_get_w(NULL, MODULENAME, "ConfirmTimeout", 0));
+ db_set_w(wi->hContact, MODULENAME, "SendIfMyStatusIsFLAG", (WORD)g_plugin.getWord("SendIfMyStatusIsFLAG", 0));
+ db_set_w(wi->hContact, MODULENAME, "SendIfTheirStatusIsFLAG", (WORD)g_plugin.getWord("SendIfTheirStatusIsFLAG", 0));
+ db_set_b(wi->hContact, MODULENAME, "Reuse", (BYTE)g_plugin.getByte("Reuse", 0));
+ db_set_b(wi->hContact, MODULENAME, "GiveUpDays", (BYTE)g_plugin.getByte("GiveUpDays", 0));
+ db_set_dw(wi->hContact, MODULENAME, "GiveUpDate", (DWORD)g_plugin.getDword("GiveUpDate", 0));
+ db_set_w(wi->hContact, MODULENAME, "ConfirmTimeout", (WORD)g_plugin.getWord("ConfirmTimeout", 0));
break;
case IDC_SETTINGS:
@@ -394,8 +394,8 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
SendDlgItemMessage(hwnd, IDC_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)1024, (short)0));
- CheckDlgButton(hwnd, IDC_USEADVANCED, db_get_b(NULL, MODULENAME, "UseAdvanced", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_SHOWDELIVERYMSGS, db_get_b(NULL, MODULENAME, "ShowDeliveryMessages", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_USEADVANCED, g_plugin.getByte("UseAdvanced", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_SHOWDELIVERYMSGS, g_plugin.getByte("ShowDeliveryMessages", 1) ? BST_CHECKED : BST_UNCHECKED);
db_set_b(wi->hContact, MODULENAME, "LastSetting", 0);
}
return FALSE;
@@ -419,8 +419,8 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, mir_free(text);
}
else db_unset(hContact, MODULENAME, "PounceMsg");
- db_set_b(NULL, MODULENAME, "UseAdvanced", (BYTE)IsDlgButtonChecked(hwnd, IDC_USEADVANCED));
- db_set_b(NULL, MODULENAME, "ShowDeliveryMessages", (BYTE)IsDlgButtonChecked(hwnd, IDC_SHOWDELIVERYMSGS));
+ g_plugin.setByte("UseAdvanced", (BYTE)IsDlgButtonChecked(hwnd, IDC_USEADVANCED));
+ g_plugin.setByte("ShowDeliveryMessages", (BYTE)IsDlgButtonChecked(hwnd, IDC_SHOWDELIVERYMSGS));
if (wi->SendIfMy) DestroyWindow(wi->SendIfMy);
if (wi->SendWhenThey) DestroyWindow(wi->SendWhenThey);
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 90b28e8e42..03c5bb3fe0 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -32,7 +32,7 @@ int MsgAck(WPARAM, LPARAM lParam) if (ack && ack->type == ACKTYPE_MESSAGE) {
if (ack->hProcess == (HANDLE)WindowList_Find(hWindowList, ack->hContact)) {
- if (db_get_b(NULL, MODULENAME, "ShowDeliveryMessages", 1))
+ if (g_plugin.getByte("ShowDeliveryMessages", 1))
CreateMessageAcknowlegedWindow(ack->hContact, ack->result == ACKRESULT_SUCCESS);
if (ack->result == ACKRESULT_SUCCESS) {
// wrtie it to the DB
@@ -164,7 +164,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM)
{
- if (db_get_b(NULL, MODULENAME, "UseAdvanced", 0) || db_get_b(hContact, MODULENAME, "UseAdvanced", 0))
+ if (g_plugin.getByte("UseAdvanced", 0) || db_get_b(hContact, MODULENAME, "UseAdvanced", 0))
CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, hContact);
else
CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, hContact);
@@ -176,10 +176,10 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) MCONTACT hContact = wParam;
wchar_t* message = (wchar_t*)lParam;
db_set_ws(hContact, MODULENAME, "PounceMsg", message);
- db_set_w(hContact, MODULENAME, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, MODULENAME, "SendIfMyStatusIsFLAG", 1));
- db_set_w(hContact, MODULENAME, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, MODULENAME, "SendIfTheirStatusIsFLAG", 1));
- db_set_b(hContact, MODULENAME, "Reuse", (BYTE)db_get_b(NULL, MODULENAME, "Reuse", 0));
- db_set_b(hContact, MODULENAME, "GiveUpDays", (BYTE)db_get_b(NULL, MODULENAME, "GiveUpDays", 0));
+ db_set_w(hContact, MODULENAME, "SendIfMyStatusIsFLAG", (WORD)g_plugin.getWord("SendIfMyStatusIsFLAG", 1));
+ db_set_w(hContact, MODULENAME, "SendIfTheirStatusIsFLAG", (WORD)g_plugin.getWord("SendIfTheirStatusIsFLAG", 1));
+ db_set_b(hContact, MODULENAME, "Reuse", (BYTE)g_plugin.getByte("Reuse", 0));
+ db_set_b(hContact, MODULENAME, "GiveUpDays", (BYTE)g_plugin.getByte("GiveUpDays", 0));
db_set_dw(hContact, MODULENAME, "GiveUpDate", (DWORD)(db_get_b(hContact, MODULENAME, "GiveUpDays", 0)*SECONDSINADAY));
return 0;
}
diff --git a/plugins/CSList/src/stdafx.h b/plugins/CSList/src/stdafx.h index e651bc45b0..cf29d76da1 100644 --- a/plugins/CSList/src/stdafx.h +++ b/plugins/CSList/src/stdafx.h @@ -91,14 +91,14 @@ struct CMPlugin : public PLUGIN<CMPlugin> #define ListView_SetSelectionMark( x, y ) 0
#endif
-#define getByte(setting, error) db_get_b(NULL, MODNAME, setting, error)
-#define setByte(setting, value) db_set_b(NULL, MODNAME, setting, value)
-#define getWord(setting, error) db_get_w(NULL, MODNAME, setting, error)
-#define setWord(setting, value) db_set_w(NULL, MODNAME, setting, value)
-#define getDword(setting, error) db_get_dw(NULL, MODNAME, setting, error)
-#define setDword(setting, value) db_set_dw(NULL, MODNAME, setting, value)
+#define getByte(setting, error) db_get_b(0, MODNAME, setting, error)
+#define setByte(setting, value) db_set_b(0, MODNAME, setting, value)
+#define getWord(setting, error) db_get_w(0, MODNAME, setting, error)
+#define setWord(setting, value) db_set_w(0, MODNAME, setting, value)
+#define getDword(setting, error) db_get_dw(0, MODNAME, setting, error)
+#define setDword(setting, value) db_set_dw(0, MODNAME, setting, value)
#define getWString(setting, dest) db_get_ws(NULL, MODNAME, setting, dest)
-#define setWString(setting, value) db_set_ws(NULL, MODNAME, setting, value)
+#define setWString(setting, value) db_set_ws(0, MODNAME, setting, value)
#define deleteSetting(setting) db_unset(NULL, MODNAME, setting)
// --
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index 79cad93fdc..15c18f7e28 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -22,54 +22,54 @@ INT_PTR APIChangeTextLayout(WPARAM wParam, LPARAM lParam) void ReadMainOptions()
{
- moOptions.dwHotkey_Layout = db_get_dw(NULL, MODULENAME, "HotkeyLayout", 119);
- moOptions.dwHotkey_Layout2 = db_get_dw(NULL, MODULENAME, "HotkeyLayout2", 120);
- moOptions.dwHotkey_Case = db_get_dw(NULL, MODULENAME, "HotkeyCase", 121);
- moOptions.CurrentWordLayout = db_get_b(NULL, MODULENAME, "CurrentWordLayout", 0);
- moOptions.CurrentWordLayout2 = db_get_b(NULL, MODULENAME, "CurrentWordLayout2", 1);
- moOptions.CurrentWordCase = db_get_b(NULL, MODULENAME, "CurrentWordCase", 0);
- moOptions.TwoWay = db_get_b(NULL, MODULENAME, "TwoWay", 1);
- moOptions.ChangeSystemLayout = db_get_b(NULL, MODULENAME, "ChangeSystemLayout", 1);
- moOptions.CopyToClipboard = db_get_b(NULL, MODULENAME, "CopyToClipboard", 0);
- moOptions.ShowPopup = db_get_b(NULL, MODULENAME, "ShowPopup", 1);
- moOptions.bCaseOperations = db_get_b(NULL, MODULENAME, "CaseOperations", 0);
+ moOptions.dwHotkey_Layout = g_plugin.getDword("HotkeyLayout", 119);
+ moOptions.dwHotkey_Layout2 = g_plugin.getDword("HotkeyLayout2", 120);
+ moOptions.dwHotkey_Case = g_plugin.getDword("HotkeyCase", 121);
+ moOptions.CurrentWordLayout = g_plugin.getByte("CurrentWordLayout", 0);
+ moOptions.CurrentWordLayout2 = g_plugin.getByte("CurrentWordLayout2", 1);
+ moOptions.CurrentWordCase = g_plugin.getByte("CurrentWordCase", 0);
+ moOptions.TwoWay = g_plugin.getByte("TwoWay", 1);
+ moOptions.ChangeSystemLayout = g_plugin.getByte("ChangeSystemLayout", 1);
+ moOptions.CopyToClipboard = g_plugin.getByte("CopyToClipboard", 0);
+ moOptions.ShowPopup = g_plugin.getByte("ShowPopup", 1);
+ moOptions.bCaseOperations = g_plugin.getByte("CaseOperations", 0);
}
void WriteMainOptions()
{
- db_set_dw(NULL, MODULENAME, "HotkeyLayout", moOptions.dwHotkey_Layout);
- db_set_dw(NULL, MODULENAME, "HotkeyLayout2", moOptions.dwHotkey_Layout2);
- db_set_dw(NULL, MODULENAME, "HotkeyCase", moOptions.dwHotkey_Case);
- db_set_b(NULL, MODULENAME, "CurrentWordLayout", moOptions.CurrentWordLayout);
- db_set_b(NULL, MODULENAME, "CurrentWordLayout2", moOptions.CurrentWordLayout2);
- db_set_b(NULL, MODULENAME, "CurrentWordCase", moOptions.CurrentWordCase);
- db_set_b(NULL, MODULENAME, "TwoWay", moOptions.TwoWay);
- db_set_b(NULL, MODULENAME, "ChangeSystemLayout", moOptions.ChangeSystemLayout);
- db_set_b(NULL, MODULENAME, "CopyToClipboard", moOptions.CopyToClipboard);
- db_set_b(NULL, MODULENAME, "ShowPopup", moOptions.ShowPopup);
- db_set_b(NULL, MODULENAME, "CaseOperations", moOptions.bCaseOperations);
+ g_plugin.setDword("HotkeyLayout", moOptions.dwHotkey_Layout);
+ g_plugin.setDword("HotkeyLayout2", moOptions.dwHotkey_Layout2);
+ g_plugin.setDword("HotkeyCase", moOptions.dwHotkey_Case);
+ g_plugin.setByte("CurrentWordLayout", moOptions.CurrentWordLayout);
+ g_plugin.setByte("CurrentWordLayout2", moOptions.CurrentWordLayout2);
+ g_plugin.setByte("CurrentWordCase", moOptions.CurrentWordCase);
+ g_plugin.setByte("TwoWay", moOptions.TwoWay);
+ g_plugin.setByte("ChangeSystemLayout", moOptions.ChangeSystemLayout);
+ g_plugin.setByte("CopyToClipboard", moOptions.CopyToClipboard);
+ g_plugin.setByte("ShowPopup", moOptions.ShowPopup);
+ g_plugin.setByte("CaseOperations", moOptions.bCaseOperations);
}
void ReadPopupOptions()
{
- poOptions.bColourType = db_get_b(NULL, MODULENAME, "ColourType", 0);
- poOptions.crBackColour = (COLORREF)db_get_dw(NULL, MODULENAME, "BackColor", 0xD2CABF);
- poOptions.crTextColour = (COLORREF)db_get_dw(NULL, MODULENAME, "TextColor", 0x000000);
- poOptions.bTimeoutType = db_get_b(NULL, MODULENAME, "TimeoutType", 0);
- poOptions.bTimeout = db_get_b(NULL, MODULENAME, "Timeout", 10);
- poOptions.bLeftClick = db_get_b(NULL, MODULENAME, "LeftClick", 0);
- poOptions.bRightClick = db_get_b(NULL, MODULENAME, "RightClick", 1);
+ poOptions.bColourType = g_plugin.getByte("ColourType", 0);
+ poOptions.crBackColour = (COLORREF)g_plugin.getDword("BackColor", 0xD2CABF);
+ poOptions.crTextColour = (COLORREF)g_plugin.getDword("TextColor", 0x000000);
+ poOptions.bTimeoutType = g_plugin.getByte("TimeoutType", 0);
+ poOptions.bTimeout = g_plugin.getByte("Timeout", 10);
+ poOptions.bLeftClick = g_plugin.getByte("LeftClick", 0);
+ poOptions.bRightClick = g_plugin.getByte("RightClick", 1);
}
void WritePopupOptions()
{
- db_set_b(NULL, MODULENAME, "ColourType", poOptions.bColourType);
- db_set_dw(NULL, MODULENAME, "BackColor", poOptions.crBackColour);
- db_set_dw(NULL, MODULENAME, "TextColor", poOptions.crTextColour);
- db_set_b(NULL, MODULENAME, "TimeoutType", poOptions.bTimeoutType);
- db_set_b(NULL, MODULENAME, "Timeout", poOptions.bTimeout);
- db_set_b(NULL, MODULENAME, "LeftClick", poOptions.bLeftClick);
- db_set_b(NULL, MODULENAME, "RightClick", poOptions.bRightClick);
+ g_plugin.setByte("ColourType", poOptions.bColourType);
+ g_plugin.setDword("BackColor", poOptions.crBackColour);
+ g_plugin.setDword("TextColor", poOptions.crTextColour);
+ g_plugin.setByte("TimeoutType", poOptions.bTimeoutType);
+ g_plugin.setByte("Timeout", poOptions.bTimeout);
+ g_plugin.setByte("LeftClick", poOptions.bLeftClick);
+ g_plugin.setByte("RightClick", poOptions.bRightClick);
}
void RegPopupActions()
@@ -101,7 +101,7 @@ int ModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < bLayNum; i++) {
LPTSTR ptszCurrLayout = GenerateLayoutString(hklLayouts[i]);
LPSTR ptszTemp = GetNameOfLayout(hklLayouts[i]);
- ptrW tszValue(db_get_wsa(NULL, MODULENAME, ptszTemp));
+ ptrW tszValue(g_plugin.getWStringA(ptszTemp));
if (tszValue == 0)
ptszLayStrings[i] = ptszCurrLayout;
else if (!mir_wstrcmp(tszValue, ptszEmptySting))
@@ -109,7 +109,7 @@ int ModulesLoaded(WPARAM, LPARAM) else {
ptszLayStrings[i] = tszValue.detach();
if (!mir_wstrcmp(ptszCurrLayout, ptszLayStrings[i]))
- db_unset(NULL, MODULENAME, ptszTemp);
+ g_plugin.delSetting(ptszTemp);
mir_free(ptszCurrLayout);
}
mir_free(ptszTemp);
@@ -134,7 +134,7 @@ int ModulesLoaded(WPARAM, LPARAM) RegPopupActions();
- db_set_dw(NULL, MODULENAME, "CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM));
+ g_plugin.setDword("CurrentVer", PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM));
return 0;
}
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index d70b37048e..a27d12566f 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -211,9 +211,9 @@ INT_PTR CALLBACK DlgMainProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, LP pszNameLay = GetNameOfLayout(hklLayouts[i]);
if (mir_wstrcmp(ptszMemLay, ptszGenLay) != 0)
- db_set_ws(NULL, MODULENAME, pszNameLay, ptszMemLay);
+ g_plugin.setWString(pszNameLay, ptszMemLay);
else
- db_unset(NULL, MODULENAME, pszNameLay);
+ g_plugin.delSetting(pszNameLay);
mir_free(pszNameLay);
mir_free(ptszGenLay);
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index c8fbf90916..086c447f38 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -291,7 +291,7 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM) case WM_DESTROY:
if (IsDlgButtonChecked(hwndDlg, IDC_DONTREMIND))
- db_set_b(NULL, MODULENAME, DB_NO_FINGERPRINT_ERROR, 1);
+ g_plugin.setByte(DB_NO_FINGERPRINT_ERROR, 1);
break;
}
return 0;
@@ -334,7 +334,7 @@ static int MirandaLoaded(WPARAM, LPARAM) }
// seems that Fingerprint is not installed
- if (!bFingerprintExists && !db_get_b(NULL, MODULENAME, DB_NO_FINGERPRINT_ERROR, 0))
+ if (!bFingerprintExists && !g_plugin.getByte(DB_NO_FINGERPRINT_ERROR, 0))
CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CCN_ERROR), nullptr, CCNErrorDlgProc);
return 0;
@@ -350,13 +350,12 @@ int CMPlugin::Load() InitOptions();
- if (db_get_b(NULL, MODULENAME, DB_SETTINGSVER, 0) < 1) {
- TCString Str;
- Str = db_get_s(NULL, MODULENAME, DB_IGNORESUBSTRINGS, L"");
+ if (g_plugin.getByte(DB_SETTINGSVER, 0) < 1) {
+ TCString Str = db_get_s(0, MODULENAME, DB_IGNORESUBSTRINGS, L"");
if (Str.GetLen()) // fix incorrect regexp from v0.1.1.0
- db_set_ws(NULL, MODULENAME, DB_IGNORESUBSTRINGS, Str.Replace(L"/Miranda[0-9A-F]{8}/", L"/[0-9A-F]{8}(\\W|$)/"));
+ g_plugin.setWString(DB_IGNORESUBSTRINGS, Str.Replace(L"/Miranda[0-9A-F]{8}/", L"/[0-9A-F]{8}(\\W|$)/"));
- db_set_b(NULL, MODULENAME, DB_SETTINGSVER, 1);
+ g_plugin.setByte(DB_SETTINGSVER, 1);
}
return 0;
}
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index c806b5f56f..5c6dfc3e99 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -128,7 +128,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara DBCONTACTWRITESETTING cws = {};
cws.szModule = "ICQ";
cws.szSetting = DB_MIRVER;
- db_set_s(NULL, MODULENAME, DB_OLDMIRVER, "ICQ Lite v5");
+ g_plugin.setString(DB_OLDMIRVER, "ICQ Lite v5");
ContactSettingChanged(NULL, (LPARAM)&cws); // simulate a version change
delete g_PreviewOptPage;
g_PreviewOptPage = nullptr;
diff --git a/plugins/ClientChangeNotify/src/Options.cpp b/plugins/ClientChangeNotify/src/Options.cpp index cc30202f41..e5fcc70ca7 100644 --- a/plugins/ClientChangeNotify/src/Options.cpp +++ b/plugins/ClientChangeNotify/src/Options.cpp @@ -143,7 +143,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix {
if (sDBSetting != nullptr) {
_ASSERT(GetDefValue());
- return db_get_s(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
+ return db_get_s(0, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
}
return *(TCString*)GetDefValue();
}
@@ -151,7 +151,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix)
{
if (sDBSetting != nullptr && !m_bReadOnly) {
- db_set_ws(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
+ db_set_ws(0, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
}
}
@@ -271,11 +271,11 @@ int TreeReadEnum(const char *szSetting, void *lParam) int Len = pData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
if (!strncmp(szSetting, pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- short ParentID = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, pData->sModule,
+ short ParentID = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(0, pData->sModule,
pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
- short Order = db_get_w(NULL, pData->sModule,
+ short Order = db_get_w(0, pData->sModule,
pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
- char Flags = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, pData->sModule,
+ char Flags = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(0, pData->sModule,
pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
if (ParentID >= 0 && Order >= 0) {
CString tmp(pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + CString(szSetting + Len));
@@ -285,8 +285,8 @@ int TreeReadEnum(const char *szSetting, void *lParam) pItem.ParentID = ParentID;
pItem.Flags = Flags;
pItem.hItem = nullptr;
- pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
- pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr : db_get_s(NULL, pData->sModule, tmp, (wchar_t*)nullptr);
+ pItem.Title = db_get_s(0, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
+ pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr : db_get_s(0, pData->sModule, tmp, (wchar_t*)nullptr);
}
}
return 0;
@@ -326,16 +326,16 @@ void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi CString StrID;
_itoa(m_value[i].ID, StrID.GetBuffer(64), 10);
StrID.ReleaseBuffer();
- db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_TITLE + StrID, m_value[i].Title);
+ db_set_ws(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_TITLE + StrID, m_value[i].Title);
if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL))
- db_set_w(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_PARENT + StrID, m_value[i].ParentID);
+ db_set_w(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_PARENT + StrID, m_value[i].ParentID);
- db_set_w(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_ORDER + StrID, i);
+ db_set_w(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_ORDER + StrID, i);
if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)
- db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags);
+ db_set_b(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags);
if (User_Str1_DBName != nullptr && m_value[i].User_Str1 != nullptr)
- db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1);
+ db_set_ws(0, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
@@ -650,7 +650,7 @@ int ListReadEnum(const char *szSetting, void *lParam) int Len = pData->sDBSettingPrefix.GetLen() + pData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
if (!strncmp(szSetting, pData->sDBSettingPrefix + pData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- pData->ListCtrl->m_value.SetAtGrow(ID).Text = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
+ pData->ListCtrl->m_value.SetAtGrow(ID).Text = db_get_s(0, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
}
return 0;
}
@@ -689,7 +689,7 @@ void COptItem_ListCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi CString StrID;
_itoa(i, StrID.GetBuffer(64), 10);
StrID.ReleaseBuffer();
- db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + LISTITEM_DBSTR_TEXT + StrID, m_value[i].Text);
+ db_set_ws(0, sModule, *sDBSettingPrefix + sDBSetting + LISTITEM_DBSTR_TEXT + StrID, m_value[i].Text);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 8122c07614..5534c6f948 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -124,7 +124,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE,
GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
- DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", Clist_GetDefaultExStyle());
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
for (auto &it : checkBoxToStyleEx)
CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not) ? BST_CHECKED : BST_UNCHECKED);
}
@@ -133,24 +133,24 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)& accel);
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0,
- MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
+ MAKELONG(db_get_w(0, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
}
- CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(0, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0));
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0,
- MAKELONG(db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0));
+ MAKELONG(db_get_b(0, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN), 0));
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0));
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0,
- MAKELONG(db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0));
+ MAKELONG(db_get_b(0, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT), 0));
CheckDlgButton(hwndDlg, IDC_GREYOUT,
- db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_SMOOTHTIME), IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
EnableWindow(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, _countof(greyoutValues),
- db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
+ db_get_dw(0, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, _countof(offlineValues),
- db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
- CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
+ CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(0, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(hwndDlg, IDC_T_CONTACT, MyDBGetContactSettingTString(NULL, "CLC", "TemplateContact", tmp, 1024, TranslateT("%name% [%status% %protocol%] %status_message%")));
SendDlgItemMessage(hwndDlg, IDC_T_CONTACT, EM_LIMITTEXT, 256, 0);
@@ -206,33 +206,33 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if ((IsDlgButtonChecked(hwndDlg, checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].not)
exStyle |= checkBoxToStyleEx[i].flag;
- db_set_dw(NULL, "CLC", "ExStyle", exStyle);
+ db_set_dw(0, "CLC", "ExStyle", exStyle);
{
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
- db_set_dw(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
+ db_set_dw(0, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT))
- db_set_dw(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags);
+ db_set_dw(0, "CLC", "GreyoutFlags", fullGreyoutFlags);
else
- db_set_dw(NULL, "CLC", "GreyoutFlags", 0);
+ db_set_dw(0, "CLC", "GreyoutFlags", 0);
}
- db_set_b(NULL, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
- db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
- db_set_b(NULL, "CLC", "LeftMargin",
+ db_set_b(0, "CLC", "ShowIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0));
+ db_set_dw(0, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
+ db_set_b(0, "CLC", "LeftMargin",
(BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
- db_set_w(NULL, "CLC", "ScrollTime",
+ db_set_w(0, "CLC", "ScrollTime",
(WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "GroupIndent",
+ db_set_b(0, "CLC", "GroupIndent",
(BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
+ db_set_b(0, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, _countof(tmp));
- db_set_ws(NULL, "CLC", "TemplateContact", tmp);
+ db_set_ws(0, "CLC", "TemplateContact", tmp);
GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, _countof(tmp));
- db_set_ws(NULL, "CLC", "TemplateGroup", tmp);
+ db_set_ws(0, "CLC", "TemplateGroup", tmp);
GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, _countof(tmp));
- db_set_ws(NULL, "CLC", "TemplateDivider", tmp);
+ db_set_ws(0, "CLC", "TemplateDivider", tmp);
GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, _countof(tmp));
- db_set_ws(NULL, "CLC", "TemplateInfo", tmp);
+ db_set_ws(0, "CLC", "TemplateInfo", tmp);
Clist_ClcOptionsChanged();
return TRUE;
diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index f0eb05dd78..2ad09982b0 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -43,28 +43,28 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
- CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) && !db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !db_get_b(0, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) && !db_get_b(0, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, db_get_b(0, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, db_get_b(0, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ONECLK,
- db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS,
- db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI,
- !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ !db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DONTCYCLE,
- db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CYCLE,
- db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MULTITRAY,
- db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEBLINK,
- db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
@@ -83,7 +83,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE);
}
SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
- SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
{
ptrA szPrimaryStatus(db_get_sa(NULL, "CList", "PrimaryStatus"));
@@ -104,7 +104,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", 550), 0));
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "IconFlashTime", 550), 0));
return TRUE;
case WM_COMMAND:
@@ -135,31 +135,31 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
- db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
- db_set_b(NULL, "CList", "UseGroups", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
- db_set_b(NULL, "CList", "SortByStatus", (BYTE) (g_bSortByStatus = IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS)));
- db_set_b(NULL, "CList", "SortByProto", (BYTE) (g_bSortByProto = IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO)));
- db_set_b(NULL, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
- db_set_b(NULL, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
- db_set_b(NULL, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
- db_set_b(NULL, "CList", "AlwaysMulti", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
- db_set_b(NULL, "CList", "TrayIcon",
+ db_set_b(0, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
+ db_set_b(0, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
+ db_set_b(0, "CList", "UseGroups", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
+ db_set_b(0, "CList", "SortByStatus", (BYTE) (g_bSortByStatus = IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS)));
+ db_set_b(0, "CList", "SortByProto", (BYTE) (g_bSortByProto = IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO)));
+ db_set_b(0, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
+ db_set_b(0, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
+ db_set_b(0, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
+ db_set_b(0, "CList", "AlwaysMulti", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
+ db_set_b(0, "CList", "TrayIcon",
(BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE
: (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE :
SETTING_TRAYICON_MULTI)));
- db_set_w(NULL, "CList", "CycleTime",
+ db_set_w(0, "CList", "CycleTime",
(WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
- db_set_w(NULL, "CList", "IconFlashTime",
+ db_set_w(0, "CList", "IconFlashTime",
(WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
+ db_set_b(0, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
{
int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0);
if (pa == nullptr)
db_unset(NULL, "CList", "PrimaryStatus");
else
- db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName);
+ db_set_s(0, "CList", "PrimaryStatus", pa->szModuleName);
}
Clist_TrayIconIconsChanged();
diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index 56043c5bf5..8ef8108178 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -30,35 +30,35 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT,
- db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_TOOLWND,
- db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MIN2TRAY,
- db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
CheckDlgButton(hwndDlg, IDC_SHOWCAPTION,
- db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU,
- db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLIENTDRAG,
- db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE);
}
- CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(0, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(0, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(0, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(0, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", 75));
- CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MaxSizeHeight", 75));
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(0, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
- SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
+ SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
@@ -78,7 +78,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
}
- CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE);
@@ -90,9 +90,9 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE,
- db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
+ db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0);
return TRUE;
@@ -148,28 +148,28 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- db_set_b(NULL, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
- db_set_b(NULL, "CList", "ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
- db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
- db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
- db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
- db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
- db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
- db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
- db_set_b(NULL, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
- db_set_b(NULL, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
- db_set_b(NULL, "CLUI", "ShowCaption", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION));
- db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
- db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
- db_set_b(NULL, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
+ db_set_b(0, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_b(0, "CList", "ToolWindow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TOOLWND));
+ db_set_b(0, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
+ db_set_b(0, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
+ db_set_b(0, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
+ db_set_b(0, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
+ db_set_b(0, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
+ db_set_b(0, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_w(0, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
+ db_set_b(0, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(0, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(0, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
+ db_set_b(0, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
+ db_set_b(0, "CLUI", "ShowCaption", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION));
+ db_set_b(0, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
+ db_set_b(0, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
+ db_set_b(0, "CList", "Min2Tray", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY));
{
wchar_t title[256];
GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
- db_set_ws(NULL, "CList", "TitleText", title);
+ db_set_ws(0, "CList", "TitleText", title);
SetWindowText(g_clistApi.hwndContactList, title);
}
g_clistApi.pfnLoadCluiGlobalOpts();
@@ -213,7 +213,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ShowWindow(g_clistApi.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW);
if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) {
SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
- SetLayeredWindowAttributes(g_clistApi.hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ SetLayeredWindowAttributes(g_clistApi.hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
}
else SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
@@ -230,18 +230,18 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(0, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED);
{
- BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
+ BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED);
}
- CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(0, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(0, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(0, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(0, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), FALSE);
@@ -268,23 +268,23 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- db_set_b(NULL, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- db_set_b(NULL, "CLUI", "SBarShow",
+ db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
+ db_set_b(0, "CLUI", "SBarShow",
(BYTE)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) |
(IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0)));
- db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
- db_set_b(NULL, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
- db_set_b(NULL, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
+ db_set_b(0, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
+ db_set_b(0, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
+ db_set_b(0, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
g_clistApi.pfnLoadCluiGlobalOpts();
- if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
+ if (db_get_b(0, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
HWND parent = GetParent(g_clistApi.hwndStatus);
int flags = WS_CHILD | CCS_BOTTOM;
- db_set_b(NULL, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
+ db_set_b(0, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
DestroyWindow(g_clistApi.hwndStatus);
- flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
- flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
+ flags |= db_get_b(0, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
+ flags |= db_get_b(0, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
g_clistApi.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index f5417c93b3..e369207db3 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -117,8 +117,8 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) int CMPlugin::Load()
{
- g_bSortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
- g_bSortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
+ g_bSortByStatus = db_get_b(0, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
+ g_bSortByProto = db_get_b(0, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
Clist_GetInterface();
coreCli = g_clistApi;
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 4fcc9f8c71..3643f85e35 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -65,9 +65,9 @@ static void InitDefaultButtons() }
g_index = -1;
- ClcSetButtonState(IDC_TBHIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
- ClcSetButtonState(IDC_TBHIDEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
- ClcSetButtonState(IDC_TBSOUND, db_get_b(NULL, "Skin", "UseSound", 1) ? BST_UNCHECKED : BST_CHECKED);
+ ClcSetButtonState(IDC_TBHIDEOFFLINE, db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
+ ClcSetButtonState(IDC_TBHIDEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
+ ClcSetButtonState(IDC_TBSOUND, db_get_b(0, "Skin", "UseSound", 1) ? BST_UNCHECKED : BST_CHECKED);
}
void ClcSetButtonState(int ctrlid, int status)
diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index c7d9606433..69281f2a1f 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -97,21 +97,21 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) MSG *msg = (MSG *)wParam;
if (msg->message == WM_DESTROY)
- db_set_b(NULL, "CList", "Docked", (BYTE)docked);
+ db_set_b(0, "CList", "Docked", (BYTE)docked);
if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING && msg->message != WM_CREATEDOCKED && msg->message != WM_MOVE)
return 0;
switch (msg->message) {
case WM_CREATE:
//if (GetSystemMetrics(SM_CMONITORS)>1) return 0;
- if (db_get_b(NULL, "CList", "Docked", 0))
+ if (db_get_b(0, "CList", "Docked", 0))
PostMessage(msg->hwnd, WM_CREATEDOCKED, 0, 0);
draggingTitle = 0;
return 0;
case WM_CREATEDOCKED:
//we need to post a message just after creation to let main message function do some work
- docked = (int)(char)db_get_b(NULL, "CList", "Docked", 0);
+ docked = (int)(char)db_get_b(0, "CList", "Docked", 0);
if (IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) {
RECT rc, rcMonitor;
memset(&abd, 0, sizeof(abd));
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 9ed16ff995..5ba3d92a7f 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -133,7 +133,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) if (!__strcmp(cws->szSetting, "Status")) {
if (!db_get_b(hContact, "CList", "Hidden", 0))
if (cws->value.wVal == ID_STATUS_OFFLINE)
- if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
+ if (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
return 0;
SendMessage(g_clistApi.hwndContactTree, INTM_STATUSCHANGED, hContact, lParam);
@@ -156,12 +156,12 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) }
}
else if (!__strcmp(cws->szModule, "Skin") && !__strcmp(cws->szSetting, "UseSound")) {
- cfg::dat.soundsOff = db_get_b(NULL, cws->szModule, cws->szSetting, 0) ? 0 : 1;
+ cfg::dat.soundsOff = db_get_b(0, cws->szModule, cws->szSetting, 0) ? 0 : 1;
ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED);
SetButtonStates();
}
else if (!__strcmp(cws->szModule, "CList") && !__strcmp(cws->szSetting, "UseGroups")) {
- ClcSetButtonState(IDC_TBHIDEGROUPS, db_get_b(NULL, cws->szModule, cws->szSetting, SETTING_USEGROUPS_DEFAULT));
+ ClcSetButtonState(IDC_TBHIDEGROUPS, db_get_b(0, cws->szModule, cws->szSetting, SETTING_USEGROUPS_DEFAULT));
SetButtonStates();
}
else if (!__strcmp(cws->szModule, "TopToolBar") && !__strcmp(cws->szSetting, "UseFlatButton")) {
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index e877201fea..cc3f88ed5c 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -142,7 +142,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) RowHeight::Clear(dat);
RowHeight::getMaxRowHeight(dat, hwnd);
- dat->SelectMode = db_get_b(NULL, "CLC", "SelectMode", 0);
+ dat->SelectMode = db_get_b(0, "CLC", "SelectMode", 0);
coreCli.pfnRebuildEntireList(hwnd, dat);
}
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index cfb7a37879..54f4b0a99f 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -117,7 +117,7 @@ static void cfgSetFlag(HWND hwndDlg, int ctrlId, DWORD dwMask) cfg::dat.dwFlags |= dwMask;
else
cfg::dat.dwFlags &= ~dwMask;
- db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
}
void GetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour)
@@ -155,26 +155,26 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always right"));
SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Automatic (RTL)"));
- DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", Clist_GetDefaultExStyle());
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
for (auto &it : checkBoxToGroupStyleEx)
CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not_t) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOGROUPICON, (cfg::dat.dwFlags & CLUI_FRAME_NOGROUPICON) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CENTERGROUPNAMES, db_get_b(NULL, "CLCExt", "EXBK_CenterGroupnames", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CENTERGROUPNAMES, db_get_b(0, "CLCExt", "EXBK_CenterGroupnames", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_SETCURSEL, cfg::dat.bGroupAlign, 0);
SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0));
- SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN));
+ SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN));
SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETRANGE, 0, MAKELONG(64, 0));
- SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN));
+ SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b(0, "CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN));
SendDlgItemMessage(hwndDlg, IDC_ROWGAPSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
SendDlgItemMessage(hwndDlg, IDC_ROWGAPSPIN, UDM_SETPOS, 0, cfg::dat.bRowSpacing);
SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT));
+ SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_SETPOS, 0, db_get_b(0, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT));
SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 8));
- SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT));
+ SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_SETPOS, 0, db_get_b(0, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT));
SendDlgItemMessage(hwndDlg, IDC_GROUPROWHEIGHTSPIN, UDM_SETRANGE, 0, MAKELONG(255, 8));
- SendDlgItemMessage(hwndDlg, IDC_GROUPROWHEIGHTSPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT));
+ SendDlgItemMessage(hwndDlg, IDC_GROUPROWHEIGHTSPIN, UDM_SETPOS, 0, db_get_b(0, "CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT));
SendDlgItemMessage(hwndDlg, IDC_AVATARPADDINGSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
SendDlgItemMessage(hwndDlg, IDC_AVATARPADDINGSPIN, UDM_SETPOS, 0, cfg::dat.avatarPadding);
}
@@ -193,7 +193,7 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam, switch (((LPNMHDR)lParam)->idFrom) {
case 0:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", Clist_GetDefaultExStyle());
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
for (auto &it : checkBoxToGroupStyleEx) {
if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.not_t)
@@ -201,30 +201,30 @@ static INT_PTR CALLBACK DlgProcDspGroups(HWND hwndDlg, UINT msg, WPARAM wParam, else
exStyle &= ~(it.flag);
}
- db_set_dw(NULL, "CLC", "ExStyle", exStyle);
+ db_set_dw(0, "CLC", "ExStyle", exStyle);
cfgSetFlag(hwndDlg, IDC_NOGROUPICON, CLUI_FRAME_NOGROUPICON);
- db_set_b(NULL, "CLCExt", "EXBK_CenterGroupnames", IsDlgButtonChecked(hwndDlg, IDC_CENTERGROUPNAMES) ? 1 : 0);
+ db_set_b(0, "CLCExt", "EXBK_CenterGroupnames", IsDlgButtonChecked(hwndDlg, IDC_CENTERGROUPNAMES) ? 1 : 0);
LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_GROUPALIGN, CB_GETCURSEL, 0, 0);
if (curSel != CB_ERR) {
cfg::dat.bGroupAlign = (BYTE)curSel;
- db_set_b(NULL, "CLC", "GroupAlign", cfg::dat.bGroupAlign);
+ db_set_b(0, "CLC", "GroupAlign", cfg::dat.bGroupAlign);
}
cfg::dat.bRowSpacing = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ROWGAPSPIN, UDM_GETPOS, 0, 0);
- db_set_b(NULL, "CLC", "RowGap", cfg::dat.bRowSpacing);
+ db_set_b(0, "CLC", "RowGap", cfg::dat.bRowSpacing);
BOOL translated;
cfg::dat.avatarPadding = (BYTE)GetDlgItemInt(hwndDlg, IDC_AVATARPADDING, &translated, FALSE);
- db_set_b(NULL, "CList", "AvatarPadding", cfg::dat.avatarPadding);
+ db_set_b(0, "CList", "AvatarPadding", cfg::dat.avatarPadding);
- db_set_b(NULL, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "RightMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "RowHeight", (BYTE)SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "GRowHeight", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPROWHEIGHTSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "LeftMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_LEFTMARGINSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "RightMargin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_RIGHTMARGINSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "GroupIndent", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "RowHeight", (BYTE)SendDlgItemMessage(hwndDlg, IDC_ROWHEIGHTSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "GRowHeight", (BYTE)SendDlgItemMessage(hwndDlg, IDC_GROUPROWHEIGHTSPIN, UDM_GETPOS, 0, 0));
return TRUE;
}
break;
@@ -255,7 +255,7 @@ static INT_PTR CALLBACK DlgProcDspItems(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_CLISTALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("For RTL only"));
SendDlgItemMessage(hwndDlg, IDC_CLISTALIGN, CB_INSERTSTRING, -1, (LPARAM)TranslateT("RTL TEXT only"));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, sizeof(offlineValues) / sizeof(offlineValues[0]), db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS), offlineValues, sizeof(offlineValues) / sizeof(offlineValues[0]), db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES));
CheckDlgButton(hwndDlg, IDC_EVENTSONTOP, (cfg::dat.dwFlags & CLUI_STICKYEVENTS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DONTSEPARATE, cfg::dat.bDontSeparateOffline ? BST_CHECKED : BST_UNCHECKED);
for (int i = 0; sortCtrlIDs[i] != 0; i++)
@@ -302,17 +302,17 @@ static INT_PTR CALLBACK DlgProcDspItems(HWND hwndDlg, UINT msg, WPARAM wParam, L else
cfg::dat.sortOrder[i] = (BYTE)curSel;
}
- db_set_dw(NULL, "CList", "SortOrder", MAKELONG(MAKEWORD(cfg::dat.sortOrder[0], cfg::dat.sortOrder[1]), MAKEWORD(cfg::dat.sortOrder[2], 0)));
+ db_set_dw(0, "CList", "SortOrder", MAKELONG(MAKEWORD(cfg::dat.sortOrder[0], cfg::dat.sortOrder[1]), MAKEWORD(cfg::dat.sortOrder[2], 0)));
cfg::dat.bDontSeparateOffline = IsDlgButtonChecked(hwndDlg, IDC_DONTSEPARATE) ? 1 : 0;
- db_set_b(NULL, "CList", "DontSeparateOffline", (BYTE)cfg::dat.bDontSeparateOffline);
+ db_set_b(0, "CList", "DontSeparateOffline", (BYTE)cfg::dat.bDontSeparateOffline);
- db_set_dw(NULL, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
+ db_set_dw(0, "CLC", "OfflineModes", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_HIDEOFFLINEOPTS)));
cfgSetFlag(hwndDlg, IDC_EVENTSONTOP, CLUI_STICKYEVENTS);
cfg::dat.bUseDCMirroring = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLISTALIGN, CB_GETCURSEL, 0, 0);
- db_set_b(NULL, "CLC", "MirrorDC", cfg::dat.bUseDCMirroring);
+ db_set_b(0, "CLC", "MirrorDC", cfg::dat.bUseDCMirroring);
return TRUE;
}
break;
@@ -437,23 +437,23 @@ static INT_PTR CALLBACK DlgProcDspAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam cfgSetFlag(hwndDlg, IDC_SHOWSTATUSMSG, CLUI_FRAME_SHOWSTATUSMSG);
cfg::dat.avatarBorder = SendDlgItemMessage(hwndDlg, IDC_AVATARBORDERCLR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, "CLC", "avatarborder", cfg::dat.avatarBorder);
+ db_set_dw(0, "CLC", "avatarborder", cfg::dat.avatarBorder);
BOOL translated;
cfg::dat.avatarRadius = GetDlgItemInt(hwndDlg, IDC_RADIUS, &translated, FALSE);
- db_set_dw(NULL, "CLC", "avatarradius", cfg::dat.avatarRadius);
+ db_set_dw(0, "CLC", "avatarradius", cfg::dat.avatarRadius);
cfg::dat.avatarSize = GetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, &translated, FALSE);
- db_set_w(NULL, "CList", "AvatarSize", (WORD)cfg::dat.avatarSize);
+ db_set_w(0, "CList", "AvatarSize", (WORD)cfg::dat.avatarSize);
cfg::dat.bNoOfflineAvatars = IsDlgButtonChecked(hwndDlg, IDC_NOAVATARSOFFLINE) ? TRUE : FALSE;
- db_set_b(NULL, "CList", "NoOfflineAV", (BYTE)cfg::dat.bNoOfflineAvatars);
+ db_set_b(0, "CList", "NoOfflineAV", (BYTE)cfg::dat.bNoOfflineAvatars);
cfg::dat.bShowLocalTime = IsDlgButtonChecked(hwndDlg, IDC_SHOWLOCALTIME) ? 1 : 0;
- db_set_b(NULL, "CLC", "ShowLocalTime", (BYTE)cfg::dat.bShowLocalTime);
+ db_set_b(0, "CLC", "ShowLocalTime", (BYTE)cfg::dat.bShowLocalTime);
cfg::dat.bShowLocalTimeSelective = IsDlgButtonChecked(hwndDlg, IDC_SHOWLOCALTIMEONLYWHENDIFFERENT) ? 1 : 0;
- db_set_b(NULL, "CLC", "SelectiveLocalTime", (BYTE)cfg::dat.bShowLocalTimeSelective);
+ db_set_b(0, "CLC", "SelectiveLocalTime", (BYTE)cfg::dat.bShowLocalTimeSelective);
KillTimer(g_clistApi.hwndContactTree, TIMERID_REFRESH);
if (cfg::dat.bShowLocalTime)
@@ -462,7 +462,7 @@ static INT_PTR CALLBACK DlgProcDspAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam cfg::dat.dualRowMode = (BYTE)SendDlgItemMessage(hwndDlg, IDC_DUALROWMODE, CB_GETCURSEL, 0, 0);
if (cfg::dat.dualRowMode == CB_ERR)
cfg::dat.dualRowMode = 0;
- db_set_b(NULL, "CLC", "DualRowMode", cfg::dat.dualRowMode);
+ db_set_b(0, "CLC", "DualRowMode", cfg::dat.dualRowMode);
return TRUE;
}
break;
@@ -484,7 +484,7 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPar CheckDlgButton(hwndDlg, IDC_SELECTIVEICONS, (cfg::dat.dwFlags & CLUI_FRAME_SELECTIVEICONS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STATUSICONSCENTERED, cfg::dat.bCenterStatusIcons ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IDLE, db_get_b(0, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
case WM_COMMAND:
@@ -500,10 +500,10 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPar cfgSetFlag(hwndDlg, IDC_XSTATUSASSTATUS, CLUI_FRAME_USEXSTATUSASSTATUS);
cfgSetFlag(hwndDlg, IDC_SELECTIVEICONS, CLUI_FRAME_SELECTIVEICONS);
- db_set_b(NULL, "CLC", "ShowIdle", IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0);
+ db_set_b(0, "CLC", "ShowIdle", IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0);
cfg::dat.bCenterStatusIcons = IsDlgButtonChecked(hwndDlg, IDC_STATUSICONSCENTERED) ? 1 : 0;
- db_set_b(NULL, "CLC", "si_centered", (BYTE)cfg::dat.bCenterStatusIcons);
+ db_set_b(0, "CLC", "si_centered", (BYTE)cfg::dat.bCenterStatusIcons);
return TRUE;
}
break;
@@ -594,11 +594,11 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam opt_clc_main_changed = 0;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
{
- DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", Clist_GetDefaultExStyle());
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", Clist_GetDefaultExStyle());
UDACCEL accel[2] = { { 0, 10 }, { 2, 50 } };
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETACCEL, _countof(accel), (LPARAM)&accel);
- SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
+ SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME), 0));
for (auto &it : checkBoxToStyleEx)
CheckDlgButton(hwndDlg, it.id, (exStyle & it.flag) ^ (it.flag * it.not_t) ? BST_CHECKED : BST_UNCHECKED);
@@ -606,11 +606,11 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam CheckDlgButton(hwndDlg, IDC_FULLROWSELECT, (cfg::dat.dwFlags & CLUI_FULLROWSELECT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DBLCLKAVATARS, cfg::dat.bDblClkAvatars ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_GREYOUT, db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_GREYOUT, db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS) ? BST_CHECKED : BST_UNCHECKED);
Utils::enableDlgControl(hwndDlg, IDC_SMOOTHTIME, IsDlgButtonChecked(hwndDlg, IDC_NOTNOSMOOTHSCROLLING));
Utils::enableDlgControl(hwndDlg, IDC_GREYOUTOPTS, IsDlgButtonChecked(hwndDlg, IDC_GREYOUT));
- FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, sizeof(greyoutValues) / sizeof(greyoutValues[0]), db_get_dw(NULL, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
- CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(NULL, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
+ FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS), greyoutValues, sizeof(greyoutValues) / sizeof(greyoutValues[0]), db_get_dw(0, "CLC", "FullGreyoutFlags", CLCDEFAULT_FULLGREYOUTFLAGS));
+ CheckDlgButton(hwndDlg, IDC_NOSCROLLBAR, db_get_b(0, "CLC", "NoVScrollBar", 0) ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
case WM_VSCROLL:
@@ -656,7 +656,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (!opt_clc_main_changed)
return TRUE;
- DWORD exStyle = db_get_dw(NULL, "CLC", "ExStyle", CLCDEFAULT_EXSTYLE);
+ DWORD exStyle = db_get_dw(0, "CLC", "ExStyle", CLCDEFAULT_EXSTYLE);
for (auto &it : checkBoxToStyleEx)
exStyle &= ~(it.flag);
@@ -665,21 +665,21 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam if ((IsDlgButtonChecked(hwndDlg, it.id) == 0) == it.not_t)
exStyle |= it.flag;
- db_set_dw(NULL, "CLC", "ExStyle", exStyle);
+ db_set_dw(0, "CLC", "ExStyle", exStyle);
DWORD fullGreyoutFlags = MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_GREYOUTOPTS));
- db_set_dw(NULL, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
+ db_set_dw(0, "CLC", "FullGreyoutFlags", fullGreyoutFlags);
if (IsDlgButtonChecked(hwndDlg, IDC_GREYOUT))
- db_set_dw(NULL, "CLC", "GreyoutFlags", fullGreyoutFlags);
+ db_set_dw(0, "CLC", "GreyoutFlags", fullGreyoutFlags);
else
- db_set_dw(NULL, "CLC", "GreyoutFlags", 0);
+ db_set_dw(0, "CLC", "GreyoutFlags", 0);
cfgSetFlag(hwndDlg, IDC_FULLROWSELECT, CLUI_FULLROWSELECT);
- db_set_w(NULL, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
+ db_set_w(0, "CLC", "ScrollTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_SMOOTHTIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLC", "NoVScrollBar", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
cfg::dat.bDblClkAvatars = IsDlgButtonChecked(hwndDlg, IDC_DBLCLKAVATARS) ? TRUE : FALSE;
- db_set_b(NULL, "CLC", "dblclkav", (BYTE)cfg::dat.bDblClkAvatars);
+ db_set_b(0, "CLC", "dblclkav", (BYTE)cfg::dat.bDblClkAvatars);
Clist_ClcOptionsChanged();
CoolSB_SetupScrollBar();
@@ -701,9 +701,9 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG:
opt_clc_bkg_changed = 0;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_BITMAP, db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BITMAP, db_get_b(0, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, WM_USER + 10, 0, 0);
- CheckDlgButton(hwndDlg, IDC_WINCOLOUR, db_get_b(NULL, "CLC", "UseWinColours", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_WINCOLOUR, db_get_b(0, "CLC", "UseWinColours", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SKINMODE, cfg::dat.bWallpaperMode ? BST_CHECKED : BST_UNCHECKED);
{
DBVARIANT dbv;
@@ -715,7 +715,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_free(&dbv);
}
- WORD bmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+ WORD bmpUse = db_get_w(0, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
CheckDlgButton(hwndDlg, IDC_STRETCHH, bmpUse & CLB_STRETCHH ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STRETCHV, bmpUse & CLB_STRETCHV ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_TILEH, bmpUse & CLBF_TILEH ? BST_CHECKED : BST_UNCHECKED);
@@ -780,15 +780,15 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (!opt_clc_bkg_changed)
return TRUE;
- db_set_b(NULL, "CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
- db_set_b(NULL, "CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR));
+ db_set_b(0, "CLC", "UseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
+ db_set_b(0, "CLC", "UseWinColours", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLOUR));
char str[MAX_PATH], strrel[MAX_PATH];
GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, _countof(str));
if (PathToRelative(str, strrel))
- db_set_s(NULL, "CLC", "BkBitmap", strrel);
+ db_set_s(0, "CLC", "BkBitmap", strrel);
else
- db_set_s(NULL, "CLC", "BkBitmap", str);
+ db_set_s(0, "CLC", "BkBitmap", str);
WORD flags = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
@@ -803,9 +803,9 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, flags |= CLBF_SCROLL;
if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
flags |= CLBF_PROPORTIONAL;
- db_set_w(NULL, "CLC", "BkBmpUse", flags);
+ db_set_w(0, "CLC", "BkBmpUse", flags);
cfg::dat.bWallpaperMode = IsDlgButtonChecked(hwndDlg, IDC_SKINMODE) ? 1 : 0;
- db_set_b(NULL, "CLUI", "UseBkSkin", (BYTE)cfg::dat.bWallpaperMode);
+ db_set_b(0, "CLUI", "UseBkSkin", (BYTE)cfg::dat.bWallpaperMode);
Clist_ClcOptionsChanged();
PostMessage(g_clistApi.hwndContactList, CLUIINTM_REDRAW, 0, 0);
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 7b45f17c25..2ee0231852 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -749,7 +749,7 @@ set_bg_l: rc.top = y + sselected->MARGIN_TOP;
rc.right = clRect->right - sselected->MARGIN_RIGHT - bg_indent_r;
rc.bottom = y + rowHeight - sselected->MARGIN_BOTTOM;
- if (db_get_b(NULL, "CLCExt", "EXBK_EqualSelection", 0) == 1 && savedCORNER != -1)
+ if (db_get_b(0, "CLCExt", "EXBK_EqualSelection", 0) == 1 && savedCORNER != -1)
DrawAlpha(hdcMem, &rc, sselected->COLOR, sselected->ALPHA, sselected->COLOR2, sselected->COLOR2_TRANSPARENT, sselected->GRADIENT, savedCORNER, sselected->BORDERSTYLE, sselected->imageItem);
else
DrawAlpha(hdcMem, &rc, sselected->COLOR, sselected->ALPHA, sselected->COLOR2, sselected->COLOR2_TRANSPARENT, sselected->GRADIENT, sselected->CORNER, sselected->BORDERSTYLE, sselected->imageItem);
@@ -1202,7 +1202,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) BOOL bFirstNGdrawn = FALSE;
int line_num = -1;
COLORREF tmpbkcolour = style & CLS_CONTACTLIST ? (dat->bUseWindowsColours ? GetSysColor(COLOR_3DFACE) : dat->bkColour) : dat->bkColour;
- selBlend = db_get_b(NULL, "CLCExt", "EXBK_SelBlend", 1);
+ selBlend = db_get_b(0, "CLCExt", "EXBK_SelBlend", 1);
g_inCLCpaint = TRUE;
g_focusWnd = GetFocus();
my_status = Clist_GetGeneralizedStatus();
@@ -1233,8 +1233,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) mirror_always = (cfg::dat.bUseDCMirroring == 1);
mirror_rtltext = (cfg::dat.bUseDCMirroring == 3);
- g_center = db_get_b(NULL, "CLCExt", "EXBK_CenterGroupnames", 0) && !dat->bisEmbedded;
- g_ignoreselforgroups = db_get_b(NULL, "CLC", "IgnoreSelforGroups", 0);
+ g_center = db_get_b(0, "CLCExt", "EXBK_CenterGroupnames", 0) && !dat->bisEmbedded;
+ g_ignoreselforgroups = db_get_b(0, "CLC", "IgnoreSelforGroups", 0);
if (dat->greyoutFlags & Clist_ClcStatusToPf2(my_status) || style & WS_DISABLED)
grey = 1;
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 6ad33b5da5..09d5d66d29 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -584,12 +584,12 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) }
ReleaseDC(hwnd, hdc);
- dat->min_row_heigh = (int)db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
- dat->group_row_height = (int)db_get_b(NULL, "CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT);
+ dat->min_row_heigh = (int)db_get_b(0, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
+ dat->group_row_height = (int)db_get_b(0, "CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT);
dat->row_border = 0;
- dat->rightMargin = db_get_b(NULL, "CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN);
- dat->bkColour = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ?
- GetSysColor(COLOR_3DFACE) : db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ dat->rightMargin = db_get_b(0, "CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN);
+ dat->bkColour = db_get_b(0, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ?
+ GetSysColor(COLOR_3DFACE) : db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
coreCli.pfnLoadClcOptions(hwnd, dat, bFirst);
@@ -616,7 +616,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) }
}
- if (db_get_b(NULL, "CLCExt", "EXBK_FillWallpaper", 0)) {
+ if (db_get_b(0, "CLCExt", "EXBK_FillWallpaper", 0)) {
char wpbuf[MAX_PATH];
if (dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index c3adad09c8..56572798f9 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -176,7 +176,7 @@ int ShowHide() switch (iVisibleState) {
case GWVS_PARTIALLY_COVERED:
//If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it.
- if (!db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
+ if (!db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
break;
case GWVS_COVERED: //Fall through (and we're already falling)
case GWVS_HIDDEN:
@@ -194,12 +194,12 @@ int ShowHide() RECT rcWindow;
SetWindowPos(g_clistApi.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOCOPYBITS);
- if (!db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
+ if (!db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
SetWindowPos(g_clistApi.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOCOPYBITS);
SetForegroundWindow(g_clistApi.hwndContactList);
//SetActiveWindow(g_clistApi.hwndContactList);
ShowWindow(g_clistApi.hwndContactList, SW_SHOW);
- db_set_b(NULL, "CList", "State", SETTING_STATE_NORMAL);
+ db_set_b(0, "CList", "State", SETTING_STATE_NORMAL);
GetWindowRect(g_clistApi.hwndContactList, &rcWindow);
if (Utils_AssertInsideScreen(&rcWindow) == 1) {
@@ -209,8 +209,8 @@ int ShowHide() }
else { //It needs to be hidden
ShowWindow(g_clistApi.hwndContactList, SW_HIDE);
- db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN);
- if (db_get_b(NULL, "CList", "DisableWorkingSet", 1))
+ db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
+ if (db_get_b(0, "CList", "DisableWorkingSet", 1))
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
}
return 0;
diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index c745fbcfb5..639c2d3fc9 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -51,22 +51,22 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP opt_gen_opts_changed = 0;
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1));
- CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWBOTTOMBUTTONS, cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLISTSUNKEN, cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_EVENTAREAAUTOHIDE, cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_EVENTAREASUNKEN, (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DONTCYCLE, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CYCLE, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(NULL, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(0, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DONTCYCLE, db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CYCLE, db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(0, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(0, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) {
Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE);
Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE);
@@ -82,7 +82,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE);
}
SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
- SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
{
ptrA szPrimaryStatus(db_get_sa(NULL, "CList", "PrimaryStatus"));
@@ -103,9 +103,9 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", 550), 0));
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "IconFlashTime", 550), 0));
CheckDlgButton(hwndDlg, IDC_NOTRAYINFOTIPS, cfg::dat.bNoTrayTips ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_APPLYLASTVIEWMODE, db_get_b(NULL, "CList", "AutoApplyLastViewMode", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_APPLYLASTVIEWMODE, db_get_b(0, "CList", "AutoApplyLastViewMode", 0) ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
case WM_COMMAND:
@@ -135,19 +135,19 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!opt_gen_opts_changed)
return TRUE;
- db_set_b(NULL, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
- db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
- db_set_b(NULL, "CList", "UseGroups", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
- db_set_b(NULL, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
- db_set_b(NULL, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
- db_set_b(NULL, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
- db_set_b(NULL, "CList", "AlwaysMulti", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
- db_set_b(NULL, "CList", "TrayIcon", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
- db_set_w(NULL, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
- db_set_w(NULL, "CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
- db_set_b(NULL, "CList", "NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK));
- db_set_b(NULL, "CList", "AutoApplyLastViewMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPLYLASTVIEWMODE));
+ db_set_b(0, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
+ db_set_b(0, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
+ db_set_b(0, "CList", "UseGroups", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
+ db_set_b(0, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE));
+ db_set_b(0, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
+ db_set_b(0, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
+ db_set_b(0, "CList", "AlwaysMulti", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
+ db_set_b(0, "CList", "TrayIcon", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
+ db_set_w(0, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_w(0, "CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
+ db_set_b(0, "CList", "NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK));
+ db_set_b(0, "CList", "AutoApplyLastViewMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPLYLASTVIEWMODE));
__setFlag(CLUI_FRAME_EVENTAREASUNKEN, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREASUNKEN));
__setFlag(CLUI_FRAME_AUTOHIDENOTIFY, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREAAUTOHIDE));
@@ -156,17 +156,17 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP __setFlag(CLUI_FRAME_CLISTSUNKEN, IsDlgButtonChecked(hwndDlg, IDC_CLISTSUNKEN));
cfg::dat.bNoTrayTips = IsDlgButtonChecked(hwndDlg, IDC_NOTRAYINFOTIPS) ? 1 : 0;
- db_set_b(NULL, "CList", "NoTrayTips", (BYTE)cfg::dat.bNoTrayTips);
+ db_set_b(0, "CList", "NoTrayTips", (BYTE)cfg::dat.bNoTrayTips);
{
int cursel = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0);
if (!pa)
db_unset(NULL, "CList", "PrimaryStatus");
else
- db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName);
+ db_set_s(0, "CList", "PrimaryStatus", pa->szModuleName);
}
Clist_TrayIconIconsChanged();
- db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
ConfigureFrame();
ConfigureCLUIGeometry(1);
ConfigureEventArea();
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index affee6a037..9db6420c46 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -144,7 +144,7 @@ static void LayoutButtons(HWND hwnd, RECT *rc) static int FS_FontsChanged(WPARAM, LPARAM) { - COLORREF clr_cluiframes = db_get_dw(NULL, "CLUI", "clr_frameborder", RGB(40, 40, 40)); + COLORREF clr_cluiframes = db_get_dw(0, "CLUI", "clr_frameborder", RGB(40, 40, 40)); if (g_hPenCLUIFrames) DeleteObject(g_hPenCLUIFrames); @@ -161,9 +161,9 @@ static HWND PreCreateCLC(HWND parent) { g_clistApi.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"", WS_CHILD | CLS_CONTACTLIST - | (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0) - | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0) - | (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0) + | (db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0) + | (db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CLS_HIDEOFFLINE : 0) + | (db_get_b(0, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? CLS_HIDEEMPTYGROUPS : 0) | CLS_MULTICOLUMN, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), (LPVOID)0xff00ff00); @@ -342,7 +342,7 @@ void IcoLibReloadIcons() void ConfigureCLUIGeometry(int mode) { RECT rcStatus; - DWORD clmargins = db_get_dw(NULL, "CLUI", "clmargins", 0); + DWORD clmargins = db_get_dw(0, "CLUI", "clmargins", 0); cfg::dat.bCLeft = LOBYTE(LOWORD(clmargins)); cfg::dat.bCRight = HIBYTE(LOWORD(clmargins)); @@ -450,10 +450,10 @@ void SetButtonStates() SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED, 0); break; case IDC_STBHIDEOFFLINE: - SendMessage(buttonItem->hWnd, BM_SETCHECK, db_get_b(NULL, "CList", "HideOffline", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + SendMessage(buttonItem->hWnd, BM_SETCHECK, db_get_b(0, "CList", "HideOffline", 0) ? BST_CHECKED : BST_UNCHECKED, 0); break; case IDC_STBHIDEGROUPS: - SendMessage(buttonItem->hWnd, BM_SETCHECK, db_get_b(NULL, "CList", "UseGroups", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + SendMessage(buttonItem->hWnd, BM_SETCHECK, db_get_b(0, "CList", "UseGroups", 0) ? BST_CHECKED : BST_UNCHECKED, 0); break; } } @@ -547,23 +547,23 @@ void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) void ReloadThemedOptions() { - cfg::dat.bSkinnedStatusBar = db_get_b(NULL, "CLUI", "sb_skinned", 0); - cfg::dat.bUsePerProto = db_get_b(NULL, "CLCExt", "useperproto", 0); - cfg::dat.bOverridePerStatusColors = db_get_b(NULL, "CLCExt", "override_status", 0); - cfg::dat.bRowSpacing = db_get_b(NULL, "CLC", "RowGap", 0); - cfg::dat.bApplyIndentToBg = db_get_b(NULL, "CLCExt", "applyindentbg", 0); - cfg::dat.bWallpaperMode = db_get_b(NULL, "CLUI", "UseBkSkin", 1); - cfg::dat.bClipBorder = db_get_b(NULL, "CLUI", "clipborder", 0); - cfg::dat.cornerRadius = db_get_b(NULL, "CLCExt", "CornerRad", 6); - cfg::dat.gapBetweenFrames = (BYTE)db_get_dw(NULL, "CLUIFrames", "GapBetweenFrames", 1); - cfg::dat.bUseDCMirroring = db_get_b(NULL, "CLC", "MirrorDC", 0); - cfg::dat.bGroupAlign = db_get_b(NULL, "CLC", "GroupAlign", 0); + cfg::dat.bSkinnedStatusBar = db_get_b(0, "CLUI", "sb_skinned", 0); + cfg::dat.bUsePerProto = db_get_b(0, "CLCExt", "useperproto", 0); + cfg::dat.bOverridePerStatusColors = db_get_b(0, "CLCExt", "override_status", 0); + cfg::dat.bRowSpacing = db_get_b(0, "CLC", "RowGap", 0); + cfg::dat.bApplyIndentToBg = db_get_b(0, "CLCExt", "applyindentbg", 0); + cfg::dat.bWallpaperMode = db_get_b(0, "CLUI", "UseBkSkin", 1); + cfg::dat.bClipBorder = db_get_b(0, "CLUI", "clipborder", 0); + cfg::dat.cornerRadius = db_get_b(0, "CLCExt", "CornerRad", 6); + cfg::dat.gapBetweenFrames = (BYTE)db_get_dw(0, "CLUIFrames", "GapBetweenFrames", 1); + cfg::dat.bUseDCMirroring = db_get_b(0, "CLC", "MirrorDC", 0); + cfg::dat.bGroupAlign = db_get_b(0, "CLC", "GroupAlign", 0); if (cfg::dat.hBrushColorKey) DeleteObject(cfg::dat.hBrushColorKey); cfg::dat.hBrushColorKey = CreateSolidBrush(RGB(255, 0, 255)); - cfg::dat.bWantFastGradients = db_get_b(NULL, "CLCExt", "FastGradients", 0); - cfg::dat.titleBarHeight = db_get_b(NULL, "CLCExt", "frame_height", DEFAULT_TITLEBAR_HEIGHT); - cfg::dat.group_padding = db_get_dw(NULL, "CLCExt", "grp_padding", 0); + cfg::dat.bWantFastGradients = db_get_b(0, "CLCExt", "FastGradients", 0); + cfg::dat.titleBarHeight = db_get_b(0, "CLCExt", "frame_height", DEFAULT_TITLEBAR_HEIGHT); + cfg::dat.group_padding = db_get_dw(0, "CLCExt", "grp_padding", 0); } static RECT rcWindow = { 0 }; @@ -577,7 +577,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) if (disableautoupd) return; - if (!db_get_b(NULL, "CLUI", "AutoSize", 0)) + if (!db_get_b(0, "CLUI", "AutoSize", 0)) return; if (Docking_IsDocked(0, 0)) @@ -585,7 +585,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) if (hFrameContactTree == 0) return; - maxHeight = db_get_b(NULL, "CLUI", "MaxSizeHeight", 75); + maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75); rcOld = rcWindow; GetWindowRect(hwnd, &rcWindow); @@ -615,7 +615,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) if (newHeight > (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100) newHeight = (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100; - if (db_get_b(NULL, "CLUI", "AutoSizeUpward", 0)) { + if (db_get_b(0, "CLUI", "AutoSizeUpward", 0)) { rcWindow.top = rcWindow.bottom - newHeight; if (rcWindow.top < rcWorkArea.top) rcWindow.top = rcWorkArea.top; } @@ -730,7 +730,7 @@ static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, MCO static void ShowCLUI(HWND hwnd) { int state = old_cliststate; - int onTop = db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT); + int onTop = db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT); SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); @@ -775,8 +775,8 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case WM_CREATE: { int flags = WS_CHILD | CCS_BOTTOM; - flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; - flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; + flags |= db_get_b(0, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; + flags |= db_get_b(0, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; g_clistApi.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, hwnd, nullptr, g_plugin.getInst(), nullptr); if (flags & WS_VISIBLE) { ShowWindow(g_clistApi.hwndStatus, SW_SHOW); @@ -786,8 +786,8 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetClassLong(g_clistApi.hwndStatus, GCL_STYLE, GetClassLong(g_clistApi.hwndStatus, GCL_STYLE) & ~(CS_VREDRAW | CS_HREDRAW)); } g_oldSize.cx = g_oldSize.cy = 0; - old_cliststate = db_get_b(NULL, "CList", "State", SETTING_STATE_NORMAL); - db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); + old_cliststate = db_get_b(0, "CList", "State", SETTING_STATE_NORMAL); + db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VISIBLE); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); if (!cfg::dat.bFirstRun) @@ -822,13 +822,13 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break; case M_CREATECLC: { - if (db_get_b(NULL, "CLUI", "useskin", 0)) + if (db_get_b(0, "CLUI", "useskin", 0)) IMG_LoadItems(); CreateButtonBar(hwnd); SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); { LONG style; - BYTE windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW); + BYTE windowStyle = db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW); ShowWindow(g_clistApi.hwndContactList, SW_HIDE); style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE); if (windowStyle != SETTING_WINDOWSTYLE_DEFAULT) { @@ -837,7 +837,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } else { style &= ~(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); - if (db_get_b(NULL, "CList", "AlwaysHideOnTB", 1)) + if (db_get_b(0, "CList", "AlwaysHideOnTB", 1)) style &= ~WS_EX_APPWINDOW; else style |= WS_EX_APPWINDOW; @@ -866,13 +866,13 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l Tweak_It(cfg::clcdat->bkColour); } - db_set_b(NULL, "CList", "State", old_cliststate); + db_set_b(0, "CList", "State", old_cliststate); - if (db_get_b(NULL, "CList", "AutoApplyLastViewMode", 0)) { + if (db_get_b(0, "CList", "AutoApplyLastViewMode", 0)) { DBVARIANT dbv = { 0 }; - if (!db_get_s(NULL, "CList", "LastViewMode", &dbv)) { + if (!db_get_s(0, "CList", "LastViewMode", &dbv)) { if (mir_strlen(dbv.pszVal) > 2) { - if (db_get_dw(NULL, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff) + if (db_get_dw(0, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff) ApplyViewMode((char *)dbv.pszVal); } db_free(&dbv); @@ -1115,11 +1115,11 @@ skipbg: // if docked, dont remember pos (except for width) if (!Clist_IsDocked()) { - db_set_dw(NULL, "CList", "Height", (DWORD)(rc.bottom - rc.top)); - db_set_dw(NULL, "CList", "x", (DWORD)rc.left); - db_set_dw(NULL, "CList", "y", (DWORD)rc.top); + db_set_dw(0, "CList", "Height", (DWORD)(rc.bottom - rc.top)); + db_set_dw(0, "CList", "x", (DWORD)rc.left); + db_set_dw(0, "CList", "y", (DWORD)rc.top); } - db_set_dw(NULL, "CList", "Width", (DWORD)(rc.right - rc.left)); + db_set_dw(0, "CList", "Width", (DWORD)(rc.right - rc.left)); } } return TRUE; @@ -1129,8 +1129,8 @@ skipbg: return 0; case CLUIINTM_REMOVEFROMTASKBAR: { - BYTE windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); - if (windowStyle == SETTING_WINDOWSTYLE_DEFAULT && db_get_b(NULL, "CList", "AlwaysHideOnTB", 0)) + BYTE windowStyle = db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); + if (windowStyle == SETTING_WINDOWSTYLE_DEFAULT && db_get_b(0, "CList", "AlwaysHideOnTB", 0)) RemoveFromTaskBar(hwnd); return 0; } @@ -1152,7 +1152,7 @@ skipbg: SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); transparentFocus = 1; } - SetWindowPos(g_clistApi.hwndContactList, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOSENDCHANGING); + SetWindowPos(g_clistApi.hwndContactList, db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOSENDCHANGING); } PostMessage(hwnd, CLUIINTM_REMOVEFROMTASKBAR, 0, 0); return DefWindowProc(hwnd, msg, wParam, lParam); @@ -1175,7 +1175,7 @@ skipbg: GetWindowRect(hwnd, &r); GetCursorPos(&pt); - if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6 && !db_get_b(NULL, "CLUI", "AutoSize", 0)) { + if (pt.y <= r.bottom && pt.y >= r.bottom - clip - 6 && !db_get_b(0, "CLUI", "AutoSize", 0)) { if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10) return HTBOTTOM; if (pt.x < r.left + clip + 10) @@ -1183,7 +1183,7 @@ skipbg: if (pt.x > r.right - clip - 10) return HTBOTTOMRIGHT; } - else if (pt.y >= r.top && pt.y <= r.top + 3 && !db_get_b(NULL, "CLUI", "AutoSize", 0)) { + else if (pt.y >= r.top && pt.y <= r.top + 3 && !db_get_b(0, "CLUI", "AutoSize", 0)) { if (pt.x > r.left + clip + 10 && pt.x < r.right - clip - 10) return HTTOP; if (pt.x < r.left + clip + 10) @@ -1286,14 +1286,14 @@ skipbg: case WM_SYSCOMMAND: { - BYTE bWindowStyle = db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); + BYTE bWindowStyle = db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); if (SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle) { if (wParam == SC_RESTORE) { CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); SendMessage(hwnd, WM_SIZE, 0, 0); SendMessage(hwnd, CLUIINTM_REDRAW, 0, 0); SendMessage(hwnd, CLUIINTM_STATUSBARUPDATE, 0, 0); - db_set_b(NULL, "CList", "State", SETTING_STATE_NORMAL); + db_set_b(0, "CList", "State", SETTING_STATE_NORMAL); break; } } @@ -1302,8 +1302,8 @@ skipbg: return 0; if (wParam == SC_MINIMIZE) { - if (SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle && !db_get_b(NULL, "CList", "AlwaysHideOnTB", 0)) { - db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED); + if (SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle && !db_get_b(0, "CList", "AlwaysHideOnTB", 0)) { + db_set_b(0, "CList", "State", SETTING_STATE_MINIMIZED); break; } g_clistApi.pfnShowHide(); @@ -1437,8 +1437,8 @@ skipbg: case IDC_TBSOUND: case IDC_STBSOUND: cfg::dat.soundsOff = !cfg::dat.soundsOff; - db_set_b(NULL, "CLUI", "NoSounds", (BYTE)cfg::dat.soundsOff); - db_set_b(NULL, "Skin", "UseSound", (BYTE)(cfg::dat.soundsOff ? 0 : 1)); + db_set_b(0, "CLUI", "NoSounds", (BYTE)cfg::dat.soundsOff); + db_set_b(0, "Skin", "UseSound", (BYTE)(cfg::dat.soundsOff ? 0 : 1)); return 0; case IDC_TBSELECTVIEWMODE: @@ -1523,7 +1523,7 @@ buttons_done: } if (dwOldFlags != cfg::dat.dwFlags) { InvalidateRect(g_clistApi.hwndContactTree, nullptr, FALSE); - db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags); + db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags); if ((dwOldFlags & (CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_CLISTSUNKEN)) != (cfg::dat.dwFlags & (CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_CLISTSUNKEN))) { ConfigureFrame(); ConfigureCLUIGeometry(1); @@ -1562,7 +1562,7 @@ buttons_done: if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0) break; - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { + if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) { POINT pt; pt = nm->pt; ClientToScreen(g_clistApi.hwndContactTree, &pt); @@ -1597,7 +1597,7 @@ buttons_done: GetWindowRect(g_clistApi.hwndStatus, &rc); if (PtInRect(&rc, pt)) { HMENU hMenu; - if (db_get_b(NULL, "CLUI", "SBarRightClk", 0)) + if (db_get_b(0, "CLUI", "SBarRightClk", 0)) hMenu = Menu_GetMainMenu(); else hMenu = Menu_GetStatusMenu(); @@ -1638,7 +1638,7 @@ buttons_done: int nParts = SendMessage(g_clistApi.hwndStatus, SB_GETPARTS, 0, 0); SIZE textSize; - BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1); + BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1); SetBkMode(dis->hDC, TRANSPARENT); int x = dis->rcItem.left; @@ -1672,7 +1672,7 @@ buttons_done: DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - 16) >> 1, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); - if (db_get_b(NULL, "CLUI", "sbar_showlocked", 1)) { + if (db_get_b(0, "CLUI", "sbar_showlocked", 1)) { if (pa->bIsLocked) { hIcon = Skin_LoadIcon(SKINICON_OTHER_STATUS_LOCKED); if (hIcon != nullptr) { @@ -1716,7 +1716,7 @@ buttons_done: return 0; case WM_CLOSE: - if (SETTING_WINDOWSTYLE_DEFAULT == db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT) && !db_get_b(NULL, "CList", "AlwaysHideOnTB", 0)) { + if (SETTING_WINDOWSTYLE_DEFAULT == db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT) && !db_get_b(0, "CList", "AlwaysHideOnTB", 0)) { PostMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); return 0; } @@ -1816,11 +1816,11 @@ void LoadCLUIModule(void) wndclass.lpszClassName = L"EventAreaClass"; RegisterClass(&wndclass); - oldhideoffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); - cluiPos.left = db_get_dw(NULL, "CList", "x", 600); - cluiPos.top = db_get_dw(NULL, "CList", "y", 200); - cluiPos.right = db_get_dw(NULL, "CList", "Width", 150); - cluiPos.bottom = db_get_dw(NULL, "CList", "Height", 350); + oldhideoffline = db_get_b(0, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); + cluiPos.left = db_get_dw(0, "CList", "x", 600); + cluiPos.top = db_get_dw(0, "CList", "y", 200); + cluiPos.right = db_get_dw(0, "CList", "Width", 150); + cluiPos.bottom = db_get_dw(0, "CList", "Height", 350); LoadExtraIconModule(); LoadCLUIFramesModule(); @@ -1828,7 +1828,7 @@ void LoadCLUIModule(void) CreateServiceFunction(MS_CLUI_SHOWMAINMENU, CLN_ShowMainMenu); CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU, CLN_ShowStatusMenu); - if (db_get_b(NULL, "CLUI", "FloaterMode", 0)) { + if (db_get_b(0, "CLUI", "FloaterMode", 0)) { MessageBox(nullptr, TranslateT("You need the FloatingContacts plugin, cause the embedded floating contacts were removed."), TranslateT("Warning"), MB_OK | MB_ICONWARNING); diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp index 56ac254013..dc13bee1e7 100644 --- a/plugins/Clist_nicer/src/cluiframes.cpp +++ b/plugins/Clist_nicer/src/cluiframes.cpp @@ -396,26 +396,26 @@ int DBLoadFrameSettingsAtPos(int pos, int Frameid) { CMStringA buf; - Frames[Frameid].collapsed = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("Collapse%d", pos), Frames[Frameid].collapsed); + Frames[Frameid].collapsed = 0 != db_get_b(0, CLUIFrameModule, buf.Format("Collapse%d", pos), Frames[Frameid].collapsed); - Frames[Frameid].Locked = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("Locked%d", pos), Frames[Frameid].Locked); - Frames[Frameid].visible = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("Visible%d", pos), Frames[Frameid].visible); - Frames[Frameid].TitleBar.ShowTitleBar = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("TBVisile%d", pos), Frames[Frameid].TitleBar.ShowTitleBar); + Frames[Frameid].Locked = 0 != db_get_b(0, CLUIFrameModule, buf.Format("Locked%d", pos), Frames[Frameid].Locked); + Frames[Frameid].visible = 0 != db_get_b(0, CLUIFrameModule, buf.Format("Visible%d", pos), Frames[Frameid].visible); + Frames[Frameid].TitleBar.ShowTitleBar = 0 != db_get_b(0, CLUIFrameModule, buf.Format("TBVisile%d", pos), Frames[Frameid].TitleBar.ShowTitleBar); - Frames[Frameid].height = db_get_w(NULL, CLUIFrameModule, buf.Format("Height%d", pos), Frames[Frameid].height); - Frames[Frameid].HeightWhenCollapsed = db_get_w(NULL, CLUIFrameModule, buf.Format("HeightCollapsed%d", pos), 0); - Frames[Frameid].align = db_get_w(NULL, CLUIFrameModule, buf.Format("Align%d", pos), Frames[Frameid].align); + Frames[Frameid].height = db_get_w(0, CLUIFrameModule, buf.Format("Height%d", pos), Frames[Frameid].height); + Frames[Frameid].HeightWhenCollapsed = db_get_w(0, CLUIFrameModule, buf.Format("HeightCollapsed%d", pos), 0); + Frames[Frameid].align = db_get_w(0, CLUIFrameModule, buf.Format("Align%d", pos), Frames[Frameid].align); Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, buf.Format("FloatX%d", pos), 100, 0, 1024); Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, buf.Format("FloatY%d", pos), 100, 0, 1024); Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, buf.Format("FloatW%d", pos), 100, 0, 1024); Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, buf.Format("FloatH%d", pos), 100, 0, 1024); - Frames[Frameid].floating = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("Floating%d", pos), 0); - Frames[Frameid].order = db_get_w(NULL, CLUIFrameModule, buf.Format("Order%d", pos), 0); + Frames[Frameid].floating = 0 != db_get_b(0, CLUIFrameModule, buf.Format("Floating%d", pos), 0); + Frames[Frameid].order = db_get_w(0, CLUIFrameModule, buf.Format("Order%d", pos), 0); - Frames[Frameid].UseBorder = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("UseBorder%d", pos), Frames[Frameid].UseBorder); - Frames[Frameid].Skinned = 0 != db_get_b(NULL, CLUIFrameModule, buf.Format("Skinned%d", pos), Frames[Frameid].Skinned); + Frames[Frameid].UseBorder = 0 != db_get_b(0, CLUIFrameModule, buf.Format("UseBorder%d", pos), Frames[Frameid].UseBorder); + Frames[Frameid].Skinned = 0 != db_get_b(0, CLUIFrameModule, buf.Format("Skinned%d", pos), Frames[Frameid].Skinned); return 0; } @@ -430,20 +430,20 @@ int DBStoreFrameSettingsAtPos(int pos, int Frameid) db_set_b(0, CLUIFrameModule, buf.Format("Visible%d", pos), (BYTE)btoint(Frames[Frameid].visible)); db_set_b(0, CLUIFrameModule, buf.Format("TBVisile%d", pos), (BYTE)btoint(Frames[Frameid].TitleBar.ShowTitleBar)); - db_set_w(NULL, CLUIFrameModule, buf.Format("Height%d", pos), (WORD)Frames[Frameid].height); - db_set_w(NULL, CLUIFrameModule, buf.Format("HeightCollapsed%d", pos), (WORD)Frames[Frameid].HeightWhenCollapsed); - db_set_w(NULL, CLUIFrameModule, buf.Format("Align%d", pos), (WORD)Frames[Frameid].align); + db_set_w(0, CLUIFrameModule, buf.Format("Height%d", pos), (WORD)Frames[Frameid].height); + db_set_w(0, CLUIFrameModule, buf.Format("HeightCollapsed%d", pos), (WORD)Frames[Frameid].HeightWhenCollapsed); + db_set_w(0, CLUIFrameModule, buf.Format("Align%d", pos), (WORD)Frames[Frameid].align); //FloatingPos - db_set_w(NULL, CLUIFrameModule, buf.Format("FloatX%d", pos), (WORD)Frames[Frameid].FloatingPos.x); - db_set_w(NULL, CLUIFrameModule, buf.Format("FloatY%d", pos), (WORD)Frames[Frameid].FloatingPos.y); - db_set_w(NULL, CLUIFrameModule, buf.Format("FloatW%d", pos), (WORD)Frames[Frameid].FloatingSize.x); + db_set_w(0, CLUIFrameModule, buf.Format("FloatX%d", pos), (WORD)Frames[Frameid].FloatingPos.x); + db_set_w(0, CLUIFrameModule, buf.Format("FloatY%d", pos), (WORD)Frames[Frameid].FloatingPos.y); + db_set_w(0, CLUIFrameModule, buf.Format("FloatW%d", pos), (WORD)Frames[Frameid].FloatingSize.x); db_set_w(0, CLUIFrameModule, buf.Format("FloatH%d", pos), (WORD)Frames[Frameid].FloatingSize.y); db_set_b(0, CLUIFrameModule, buf.Format("Floating%d", pos), (BYTE)btoint(Frames[Frameid].floating)); db_set_b(0, CLUIFrameModule, buf.Format("UseBorder%d", pos), (BYTE)btoint(Frames[Frameid].UseBorder)); db_set_w(0, CLUIFrameModule, buf.Format("Order%d", pos), (WORD)Frames[Frameid].order); - db_set_b(NULL, CLUIFrameModule, buf.Format("Skinned%d", pos), Frames[Frameid].Skinned); + db_set_b(0, CLUIFrameModule, buf.Format("Skinned%d", pos), Frames[Frameid].Skinned); return 0; } @@ -469,7 +469,7 @@ int CLUIFramesLoadFrameSettings(int Frameid) if (Frameid < 0 || Frameid >= nFramescount) return -1; - int maxstored = db_get_w(NULL, CLUIFrameModule, "StoredFrames", -1); + int maxstored = db_get_w(0, CLUIFrameModule, "StoredFrames", -1); if (maxstored == -1) return 0; @@ -489,7 +489,7 @@ int CLUIFramesStoreFrameSettings(int Frameid) if (Frameid < 0 || Frameid >= nFramescount) return -1; - int maxstored = db_get_w(NULL, CLUIFrameModule, "StoredFrames", -1); + int maxstored = db_get_w(0, CLUIFrameModule, "StoredFrames", -1); if (maxstored == -1) maxstored = 0; @@ -500,7 +500,7 @@ int CLUIFramesStoreFrameSettings(int Frameid) } DBStoreFrameSettingsAtPos(storpos, Frameid); - db_set_w(NULL, CLUIFrameModule, "StoredFrames", (WORD)maxstored); + db_set_w(0, CLUIFrameModule, "StoredFrames", (WORD)maxstored); return 0; } @@ -1210,7 +1210,7 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM) if (Clist_IsDocked()) return 0; - if (db_get_b(NULL, "CLUI", "AutoSize", 0)) + if (db_get_b(0, "CLUI", "AutoSize", 0)) return 0; GetWindowRect(g_clistApi.hwndContactList, &rc); @@ -1593,7 +1593,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) // create frame Frames[nFramescount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName, Frames[nFramescount].name, - (db_get_b(NULL, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) + (db_get_b(0, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER) | WS_CHILD | WS_CLIPCHILDREN | (Frames[nFramescount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) | WS_CLIPCHILDREN, 0, 0, 0, 0, g_clistApi.hwndContactList, nullptr, g_plugin.getInst(), nullptr); @@ -2116,19 +2116,19 @@ boolean AlignCOLLIconToLeft; //will hide frame icon int OnFrameTitleBarBackgroundChange() { - AlignCOLLIconToLeft = db_get_b(NULL, "FrameTitleBar", "AlignCOLLIconToLeft", 0); - bkColour = db_get_dw(NULL, "FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); + AlignCOLLIconToLeft = db_get_b(0, "FrameTitleBar", "AlignCOLLIconToLeft", 0); + bkColour = db_get_dw(0, "FrameTitleBar", "BkColour", CLCDEFAULT_BKCOLOUR); if (hBmpBackground) { DeleteObject(hBmpBackground); hBmpBackground = nullptr; } - if (db_get_b(NULL, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + if (db_get_b(0, "FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { ptrW tszBitmapName(db_get_wsa(NULL, "FrameTitleBar", "BkBitmap")); if (tszBitmapName != NULL) hBmpBackground = Bitmap_Load(tszBitmapName); } - backgroundBmpUse = db_get_w(NULL, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + backgroundBmpUse = db_get_w(0, "FrameTitleBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); CLUIFramesOnClistResize(0, 0); return 0; @@ -2362,7 +2362,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA } if ((!(wParam&MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) { - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", 0)) { + if (db_get_b(0, "CLUI", "ClientAreaDrag", 0)) { POINT pt; GetCursorPos(&pt); return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y)); @@ -3009,7 +3009,7 @@ int LoadCLUIFramesModule(void) OnFrameTitleBarBackgroundChange(); FramesSysNotStarted = FALSE; - g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, db_get_dw(NULL, "CLUI", "clr_frameborder", GetSysColor(COLOR_3DDKSHADOW))); + g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, db_get_dw(0, "CLUI", "clr_frameborder", GetSysColor(COLOR_3DDKSHADOW))); return 0; } diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 6ac0c0af8d..4798167798 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -37,24 +37,24 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault(hwndDlg);
opt_clui_changed = 0;
- CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSHIDEONTASKBAR, db_get_b(NULL, "CList", "AlwaysHideOnTB", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALWAYSHIDEONTASKBAR, db_get_b(0, "CList", "AlwaysHideOnTB", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_FADEINOUT, cfg::dat.fadeinout ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOSIZE, cfg::dat.autosize ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(0, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(0, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Title bar"));
SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Tool Window"));
SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Thin border"));
SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("No border"));
- SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_SETCURSEL, db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW), 0);
+ SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_SETCURSEL, db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW), 0);
SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", 75));
+ SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MaxSizeHeight", 75));
SendDlgItemMessage(hwndDlg, IDC_CLIPBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
SendDlgItemMessage(hwndDlg, IDC_CLIPBORDERSPIN, UDM_SETPOS, 0, cfg::dat.bClipBorder);
@@ -69,10 +69,10 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CTOPSPIN, UDM_SETPOS, 0, cfg::dat.bCTop);
SendDlgItemMessage(hwndDlg, IDC_CBOTTOMSPIN, UDM_SETPOS, 0, cfg::dat.bCBottom);
- CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(0, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(0, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1));
- SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
+ SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(0, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0));
Utils::enableDlgControl(hwndDlg, IDC_HIDETIME, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
Utils::enableDlgControl(hwndDlg, IDC_HIDETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
Utils::enableDlgControl(hwndDlg, IDC_STATIC01, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
@@ -166,16 +166,16 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (!opt_clui_changed)
return TRUE;
- db_set_b(NULL, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
+ db_set_b(0, "CLUI", "FadeInOut", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT));
cfg::dat.fadeinout = IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT) ? 1 : 0;
oldFading = cfg::dat.fadeinout;
cfg::dat.fadeinout = FALSE;
- db_set_b(NULL, "CLUI", "WindowStyle", windowStyle);
+ db_set_b(0, "CLUI", "WindowStyle", windowStyle);
cfg::dat.gapBetweenFrames = GetDlgItemInt(hwndDlg, IDC_FRAMEGAP, &translated, FALSE);
- db_set_dw(NULL, "CLUIFrames", "GapBetweenFrames", cfg::dat.gapBetweenFrames);
- db_set_b(NULL, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
+ db_set_dw(0, "CLUIFrames", "GapBetweenFrames", cfg::dat.gapBetweenFrames);
+ db_set_b(0, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP));
SetWindowPos(g_clistApi.hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
cfg::dat.bCLeft = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLEFTSPIN, UDM_GETPOS, 0, 0);
@@ -183,11 +183,11 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l cfg::dat.bCTop = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CTOPSPIN, UDM_GETPOS, 0, 0);
cfg::dat.bCBottom = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CBOTTOMSPIN, UDM_GETPOS, 0, 0);
- db_set_dw(NULL, "CLUI", "clmargins", MAKELONG(MAKEWORD(cfg::dat.bCLeft, cfg::dat.bCRight), MAKEWORD(cfg::dat.bCTop, cfg::dat.bCBottom)));
+ db_set_dw(0, "CLUI", "clmargins", MAKELONG(MAKEWORD(cfg::dat.bCLeft, cfg::dat.bCRight), MAKEWORD(cfg::dat.bCTop, cfg::dat.bCBottom)));
SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
- db_set_b(NULL, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
- db_set_b(NULL, "CList", "AlwaysHideOnTB", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSHIDEONTASKBAR));
+ db_set_b(0, "CList", "BringToFront", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT));
+ db_set_b(0, "CList", "AlwaysHideOnTB", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSHIDEONTASKBAR));
if (windowStyle != SETTING_WINDOWSTYLE_DEFAULT) {
LONG style;
@@ -210,7 +210,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l LONG style;
style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE);
style &= ~(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE);
- if (db_get_b(NULL, "CList", "AlwaysHideOnTB", 1))
+ if (db_get_b(0, "CList", "AlwaysHideOnTB", 1))
style &= ~WS_EX_APPWINDOW;
else {
style |= WS_EX_APPWINDOW;
@@ -220,11 +220,11 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l }
cfg::dat.bClipBorder = (BYTE)GetDlgItemInt(hwndDlg, IDC_CLIPBORDER, &translated, FALSE);
- db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags);
- db_set_b(NULL, "CLUI", "clipborder", cfg::dat.bClipBorder);
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ db_set_b(0, "CLUI", "clipborder", cfg::dat.bClipBorder);
- db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
- db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
+ db_set_b(0, "CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU));
+ db_set_b(0, "CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG));
ApplyCLUIBorderStyle();
@@ -235,33 +235,33 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l wchar_t title[256];
GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, _countof(title));
- db_set_ws(NULL, "CList", "TitleText", title);
+ db_set_ws(0, "CList", "TitleText", title);
SetWindowText(g_clistApi.hwndContactList, title);
cfg::dat.dwFlags = IsDlgButtonChecked(hwndDlg, IDC_ROUNDEDBORDER) ? cfg::dat.dwFlags | CLUI_FRAME_ROUNDEDFRAME : cfg::dat.dwFlags & ~CLUI_FRAME_ROUNDEDFRAME;
- db_set_b(NULL, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
+ db_set_b(0, "CLUI", "AutoSize", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE));
if ((cfg::dat.autosize = IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE) ? 1 : 0)) {
SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
SendMessage(g_clistApi.hwndContactTree, WM_SIZE, 0, 0);
}
- db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
- db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
- db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
- db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
+ db_set_b(0, "CLUI", "MaxSizeHeight", (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, nullptr, FALSE));
+ db_set_b(0, "CLUI", "AutoSizeUpward", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD));
+ db_set_b(0, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE));
+ db_set_w(0, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0));
- db_set_b(NULL, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
+ db_set_b(0, "CList", "Transparent", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT));
cfg::dat.isTransparent = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT) ? 1 : 0;
- db_set_b(NULL, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(0, "CList", "Alpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0));
cfg::dat.alpha = (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0);
- db_set_b(NULL, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
+ db_set_b(0, "CList", "AutoAlpha", (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0));
cfg::dat.autoalpha = (BYTE)SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0);
- db_set_b(NULL, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
- db_set_b(NULL, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
- db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ db_set_b(0, "CList", "WindowShadow", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW));
+ db_set_b(0, "CList", "OnDesktop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP));
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
cfg::dat.bFullTransparent = IsDlgButtonChecked(hwndDlg, IDC_FULLTRANSPARENT) ? 1 : 0;
- db_set_b(NULL, "CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent);
+ db_set_b(0, "CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent);
if (cfg::dat.bLayeredHack)
SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
@@ -269,7 +269,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (g_CLUISkinnedBkColorRGB)
cfg::dat.colorkey = g_CLUISkinnedBkColorRGB;
else if (cfg::dat.bClipBorder == 0 && !(cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME))
- cfg::dat.colorkey = db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ cfg::dat.colorkey = db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
else {
SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
cfg::dat.colorkey = RGB(255, 0, 255);
@@ -314,20 +314,20 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_INITDIALOG:
opt_sbar_changed = 0;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED); {
- BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
+ CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(0, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED); {
+ BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED);
}
- CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(0, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, cfg::dat.bEqualSections ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(0, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(0, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SKINBACKGROUND, cfg::dat.bSkinnedStatusBar ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, cfg::dat.bShowXStatusOnSbar ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MARKLOCKED, db_get_b(NULL, "CLUI", "sbar_showlocked", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MARKLOCKED, db_get_b(0, "CLUI", "sbar_showlocked", 1) ? BST_CHECKED : BST_UNCHECKED);
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) {
Utils::enableDlgControl(hwndDlg, IDC_SHOWICON, FALSE);
@@ -364,28 +364,28 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (!opt_sbar_changed)
return TRUE;
- db_set_b(NULL, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
- db_set_b(NULL, "CLUI", "SBarShow", (BYTE)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0)));
- db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
- db_set_b(NULL, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
- db_set_b(NULL, "CLUI", "sb_skinned", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SKINBACKGROUND));
- db_set_b(NULL, "CLUI", "sbar_showlocked", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MARKLOCKED));
+ db_set_b(0, "CLUI", "ShowSBar", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR));
+ db_set_b(0, "CLUI", "SBarShow", (BYTE)((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0)));
+ db_set_b(0, "CLUI", "SBarRightClk", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA));
+ db_set_b(0, "CLUI", "EqualSections", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS));
+ db_set_b(0, "CLUI", "sb_skinned", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SKINBACKGROUND));
+ db_set_b(0, "CLUI", "sbar_showlocked", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MARKLOCKED));
cfg::dat.bEqualSections = IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS) ? 1 : 0;
cfg::dat.bSkinnedStatusBar = IsDlgButtonChecked(hwndDlg, IDC_SKINBACKGROUND) ? 1 : 0;
cfg::dat.bShowXStatusOnSbar = IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) ? 1 : 0;
- db_set_b(NULL, "CLUI", "xstatus_sbar", (BYTE)cfg::dat.bShowXStatusOnSbar);
- db_set_b(NULL, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
- if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
+ db_set_b(0, "CLUI", "xstatus_sbar", (BYTE)cfg::dat.bShowXStatusOnSbar);
+ db_set_b(0, "CLUI", "SBarBevel", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL));
+ if (db_get_b(0, "CLUI", "ShowGrip", 1) != (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) {
HWND parent = GetParent(g_clistApi.hwndStatus);
int flags = WS_CHILD | CCS_BOTTOM;
- db_set_b(NULL, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
+ db_set_b(0, "CLUI", "ShowGrip", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP));
ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
mir_unsubclassWindow(g_clistApi.hwndStatus, NewStatusBarWndProc);
DestroyWindow(g_clistApi.hwndStatus);
- flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
- flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
+ flags |= db_get_b(0, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
+ flags |= db_get_b(0, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
g_clistApi.hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
mir_subclassWindow(g_clistApi.hwndStatus, NewStatusBarWndProc);
@@ -399,7 +399,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ShowWindow(g_clistApi.hwndStatus, SW_HIDE);
cfg::dat.dwFlags &= ~CLUI_FRAME_SBARSHOW;
}
- db_set_dw(NULL, "CLUI", "Frameflags", cfg::dat.dwFlags);
+ db_set_dw(0, "CLUI", "Frameflags", cfg::dat.dwFlags);
ConfigureCLUIGeometry(1);
SendMessage(g_clistApi.hwndContactList, WM_SIZE, 0, 0);
CluiProtocolStatusChanged(0, nullptr);
@@ -428,7 +428,7 @@ DWORD GetCLUIWindowStyle(BYTE style) void ApplyCLUIBorderStyle()
{
- BYTE windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW);
+ BYTE windowStyle = db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW);
WINDOWPLACEMENT p;
bool minToTray = TRUE;
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 98c87934b2..60a05ed26c 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -87,7 +87,7 @@ void CluiProtocolStatusChanged(int, const char*) partCount = toshow;
}
else {
- BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1);
+ BYTE showOpts = db_get_b(0, "CLUI", "SBarShow", 1);
wchar_t szName[32];
HDC hdc = GetDC(nullptr);
@@ -134,7 +134,7 @@ void CluiProtocolStatusChanged(int, const char*) SendMessage(g_clistApi.hwndStatus, SB_SIMPLE, FALSE, 0);
partWidths[partCount - 1] = -1;
- BYTE windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", 0);
+ BYTE windowStyle = db_get_b(0, "CLUI", "WindowStyle", 0);
SendMessage(g_clistApi.hwndStatus, SB_SETMINHEIGHT, 18 + cfg::dat.bClipBorder + ((windowStyle == SETTING_WINDOWSTYLE_THINBORDER || windowStyle == SETTING_WINDOWSTYLE_NOBORDER) ? 3 : 0), 0);
SendMessage(g_clistApi.hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths);
@@ -154,7 +154,7 @@ void CluiProtocolStatusChanged(int, const char*) PD->protopos = partCount;
int flags = SBT_OWNERDRAW;
- if (db_get_b(NULL, "CLUI", "SBarBevel", 1) == 0)
+ if (db_get_b(0, "CLUI", "SBarBevel", 1) == 0)
flags |= SBT_NOBORDERS;
SendMessageA(g_clistApi.hwndStatus, SB_SETTEXTA, partCount | flags, (LPARAM)PD);
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 6ac1ab17cf..284b22380e 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -122,7 +122,7 @@ void API::updateState() if (sysConfig.isVistaPlus) {
sysState.isDwmActive = (pfnDwmIsCompositionEnabled && (pfnDwmIsCompositionEnabled(&result) == S_OK) && result) ? true : false;
- sysState.isAero = /* (CSkin::m_skinEnabled == false) && */ db_get_b(NULL, "CLUI", "useAero", 1) /* && CSkin::m_fAeroSkinsValid */ && sysState.isDwmActive;
+ sysState.isAero = /* (CSkin::m_skinEnabled == false) && */ db_get_b(0, "CLUI", "useAero", 1) /* && CSkin::m_fAeroSkinsValid */ && sysState.isDwmActive;
}
}
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index e3b4016a02..2fcabf7dcb 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -128,11 +128,11 @@ void MF_UpdateThread(LPVOID) void MF_InitCheck(void)
{
- BYTE bMsgFrequency = db_get_b(NULL, "CList", "fhistdata", 0);
+ BYTE bMsgFrequency = db_get_b(0, "CList", "fhistdata", 0);
if (!bMsgFrequency) {
for (auto &hContact : Contacts())
MF_CalcFrequency(hContact, 100, 0);
- db_set_b(NULL, "CList", "fhistdata", 1);
+ db_set_b(0, "CList", "fhistdata", 1);
}
}
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 964b91fc4b..6cffd44a57 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -299,31 +299,31 @@ void LoadExtBkSettingsFromDB() p->imageItem = nullptr;
CMStringA buffer;
buffer.Format("%s_IGNORE", p->szDBname);
- p->IGNORED = (BYTE)db_get_b(NULL, "CLCExt", buffer, p->IGNORED);
+ p->IGNORED = (BYTE)db_get_b(0, "CLCExt", buffer, p->IGNORED);
buffer.Format("%s_GRADIENT", p->szDBname);
- p->GRADIENT = (BYTE)db_get_dw(NULL, "CLCExt", buffer, p->GRADIENT);
+ p->GRADIENT = (BYTE)db_get_dw(0, "CLCExt", buffer, p->GRADIENT);
buffer.Format("%s_CORNER", p->szDBname);
- p->CORNER = (BYTE)db_get_dw(NULL, "CLCExt", buffer, p->CORNER);
+ p->CORNER = (BYTE)db_get_dw(0, "CLCExt", buffer, p->CORNER);
buffer.Format("%s_COLOR", p->szDBname);
- p->COLOR = db_get_dw(NULL, "CLCExt", buffer, p->COLOR);
+ p->COLOR = db_get_dw(0, "CLCExt", buffer, p->COLOR);
buffer.Format("%s_COLOR2", p->szDBname);
- p->COLOR2 = db_get_dw(NULL, "CLCExt", buffer, p->COLOR2);
+ p->COLOR2 = db_get_dw(0, "CLCExt", buffer, p->COLOR2);
buffer.Format("%s_COLOR2_TRANSPARENT", p->szDBname);
- p->COLOR2_TRANSPARENT = (BYTE)db_get_b(NULL, "CLCExt", buffer, p->COLOR2_TRANSPARENT);
+ p->COLOR2_TRANSPARENT = (BYTE)db_get_b(0, "CLCExt", buffer, p->COLOR2_TRANSPARENT);
buffer.Format("%s_TEXTCOLOR", p->szDBname);
- p->TEXTCOLOR = db_get_dw(NULL, "CLCExt", buffer, p->TEXTCOLOR);
+ p->TEXTCOLOR = db_get_dw(0, "CLCExt", buffer, p->TEXTCOLOR);
buffer.Format("%s_ALPHA", p->szDBname);
- p->ALPHA = db_get_b(NULL, "CLCExt", buffer, p->ALPHA);
+ p->ALPHA = db_get_b(0, "CLCExt", buffer, p->ALPHA);
buffer.Format("%s_MRGN_LEFT", p->szDBname);
- p->MARGIN_LEFT = db_get_b(NULL, "CLCExt", buffer, p->MARGIN_LEFT);
+ p->MARGIN_LEFT = db_get_b(0, "CLCExt", buffer, p->MARGIN_LEFT);
buffer.Format("%s_MRGN_TOP", p->szDBname);
- p->MARGIN_TOP = db_get_b(NULL, "CLCExt", buffer, p->MARGIN_TOP);
+ p->MARGIN_TOP = db_get_b(0, "CLCExt", buffer, p->MARGIN_TOP);
buffer.Format("%s_MRGN_RIGHT", p->szDBname);
- p->MARGIN_RIGHT = db_get_b(NULL, "CLCExt", buffer, p->MARGIN_RIGHT);
+ p->MARGIN_RIGHT = db_get_b(0, "CLCExt", buffer, p->MARGIN_RIGHT);
buffer.Format("%s_MRGN_BOTTOM", p->szDBname);
- p->MARGIN_BOTTOM = db_get_b(NULL, "CLCExt", buffer, p->MARGIN_BOTTOM);
+ p->MARGIN_BOTTOM = db_get_b(0, "CLCExt", buffer, p->MARGIN_BOTTOM);
buffer.Format("%s_BDRSTYLE", p->szDBname);
- p->BORDERSTYLE = db_get_dw(NULL, "CLCExt", buffer, p->BORDERSTYLE);
+ p->BORDERSTYLE = db_get_dw(0, "CLCExt", buffer, p->BORDERSTYLE);
}
if (cfg::dat.bFirstRun) {
@@ -346,39 +346,39 @@ static void SaveCompleteStructToDB() if (p->statusID != ID_EXTBKSEPARATOR) {
char buffer[255];
mir_snprintf(buffer, "%s_IGNORE", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, p->IGNORED);
+ db_set_b(0, "CLCExt", buffer, p->IGNORED);
mir_snprintf(buffer, "%s_GRADIENT", p->szDBname);
- db_set_dw(NULL, "CLCExt", buffer, p->GRADIENT);
+ db_set_dw(0, "CLCExt", buffer, p->GRADIENT);
mir_snprintf(buffer, "%s_CORNER", p->szDBname);
- db_set_dw(NULL, "CLCExt", buffer, p->CORNER);
+ db_set_dw(0, "CLCExt", buffer, p->CORNER);
mir_snprintf(buffer, "%s_COLOR", p->szDBname);
- db_set_dw(NULL, "CLCExt", buffer, p->COLOR);
+ db_set_dw(0, "CLCExt", buffer, p->COLOR);
mir_snprintf(buffer, "%s_COLOR2", p->szDBname);
- db_set_dw(NULL, "CLCExt", buffer, p->COLOR2);
+ db_set_dw(0, "CLCExt", buffer, p->COLOR2);
mir_snprintf(buffer, "%s_COLOR2_TRANSPARENT", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, p->COLOR2_TRANSPARENT);
+ db_set_b(0, "CLCExt", buffer, p->COLOR2_TRANSPARENT);
mir_snprintf(buffer, "%s_TEXTCOLOR", p->szDBname);
- db_set_dw(NULL, "CLCExt", buffer, p->TEXTCOLOR);
+ db_set_dw(0, "CLCExt", buffer, p->TEXTCOLOR);
mir_snprintf(buffer, "%s_ALPHA", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, (BYTE)p->ALPHA);
+ db_set_b(0, "CLCExt", buffer, (BYTE)p->ALPHA);
mir_snprintf(buffer, "%s_MRGN_LEFT", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, (BYTE)p->MARGIN_LEFT);
+ db_set_b(0, "CLCExt", buffer, (BYTE)p->MARGIN_LEFT);
mir_snprintf(buffer, "%s_MRGN_TOP", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, (BYTE)p->MARGIN_TOP);
+ db_set_b(0, "CLCExt", buffer, (BYTE)p->MARGIN_TOP);
mir_snprintf(buffer, "%s_MRGN_RIGHT", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, (BYTE)p->MARGIN_RIGHT);
+ db_set_b(0, "CLCExt", buffer, (BYTE)p->MARGIN_RIGHT);
mir_snprintf(buffer, "%s_MRGN_BOTTOM", p->szDBname);
- db_set_b(NULL, "CLCExt", buffer, (BYTE)p->MARGIN_BOTTOM);
+ db_set_b(0, "CLCExt", buffer, (BYTE)p->MARGIN_BOTTOM);
mir_snprintf(buffer, "%s_BDRSTYLE", p->szDBname);
- db_set_dw(NULL, "CLCExt", buffer, p->BORDERSTYLE);
+ db_set_dw(0, "CLCExt", buffer, p->BORDERSTYLE);
}
}
}
void SetButtonToSkinned()
{
- bool bSkinned = (cfg::dat.bSkinnedButtonMode = db_get_b(NULL, "CLCExt", "bskinned", 0)) != 0;
- bool bFlat = bSkinned || (db_get_b(NULL, "TopToolBar", "UseFlatButton", 0) != 0);
+ bool bSkinned = (cfg::dat.bSkinnedButtonMode = db_get_b(0, "CLCExt", "bskinned", 0)) != 0;
+ bool bFlat = bSkinned || (db_get_b(0, "TopToolBar", "UseFlatButton", 0) != 0);
for (int i = 0;; i++) {
if (BTNS[i].pszButtonID == nullptr)
@@ -399,8 +399,8 @@ void Reload3dBevelColors() if (cfg::dat.hPen3DDark)
DeleteObject(cfg::dat.hPen3DDark);
- cfg::dat.hPen3DBright = CreatePen(PS_SOLID, 1, db_get_dw(NULL, "CLCExt", "3dbright", GetSysColor(COLOR_3DLIGHT)));
- cfg::dat.hPen3DDark = CreatePen(PS_SOLID, 1, db_get_dw(NULL, "CLCExt", "3ddark", GetSysColor(COLOR_3DSHADOW)));
+ cfg::dat.hPen3DBright = CreatePen(PS_SOLID, 1, db_get_dw(0, "CLCExt", "3dbright", GetSysColor(COLOR_3DLIGHT)));
+ cfg::dat.hPen3DDark = CreatePen(PS_SOLID, 1, db_get_dw(0, "CLCExt", "3ddark", GetSysColor(COLOR_3DSHADOW)));
}
// Save Non-arStatusItems Settings
@@ -408,8 +408,8 @@ void SaveNonStatusItemsSettings(HWND hwndDlg) {
BOOL translated;
- db_set_b(NULL, "CLCExt", "EXBK_EqualSelection", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSELECTION));
- db_set_b(NULL, "CLCExt", "EXBK_SelBlend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SELBLEND));
+ db_set_b(0, "CLCExt", "EXBK_EqualSelection", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_EQUALSELECTION));
+ db_set_b(0, "CLCExt", "EXBK_SelBlend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SELBLEND));
cfg::dat.cornerRadius = GetDlgItemInt(hwndDlg, IDC_CORNERRAD, &translated, FALSE);
cfg::dat.bApplyIndentToBg = IsDlgButtonChecked(hwndDlg, IDC_APPLYINDENTBG) ? 1 : 0;
@@ -419,16 +419,16 @@ void SaveNonStatusItemsSettings(HWND hwndDlg) cfg::dat.titleBarHeight = (BYTE)GetDlgItemInt(hwndDlg, IDC_LASTITEMPADDING, &translated, FALSE);
cfg::dat.group_padding = GetDlgItemInt(hwndDlg, IDC_GRPTOPPADDING, &translated, FALSE);
- db_set_b(NULL, "CLCExt", "CornerRad", cfg::dat.cornerRadius);
- db_set_b(NULL, "CLCExt", "applyindentbg", (BYTE)cfg::dat.bApplyIndentToBg);
- db_set_b(NULL, "CLCExt", "useperproto", (BYTE)cfg::dat.bUsePerProto);
- db_set_b(NULL, "CLCExt", "override_status", (BYTE)cfg::dat.bOverridePerStatusColors);
- db_set_b(NULL, "CLCExt", "bskinned", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SETALLBUTTONSKINNED) ? 1 : 0));
- db_set_b(NULL, "CLCExt", "FastGradients", cfg::dat.bWantFastGradients);
- db_set_b(NULL, "CLC", "IgnoreSelforGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNORESELFORGROUPS));
+ db_set_b(0, "CLCExt", "CornerRad", cfg::dat.cornerRadius);
+ db_set_b(0, "CLCExt", "applyindentbg", (BYTE)cfg::dat.bApplyIndentToBg);
+ db_set_b(0, "CLCExt", "useperproto", (BYTE)cfg::dat.bUsePerProto);
+ db_set_b(0, "CLCExt", "override_status", (BYTE)cfg::dat.bOverridePerStatusColors);
+ db_set_b(0, "CLCExt", "bskinned", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SETALLBUTTONSKINNED) ? 1 : 0));
+ db_set_b(0, "CLCExt", "FastGradients", cfg::dat.bWantFastGradients);
+ db_set_b(0, "CLC", "IgnoreSelforGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNORESELFORGROUPS));
- db_set_dw(NULL, "CLCExt", "grp_padding", cfg::dat.group_padding);
- db_set_b(NULL, "CLCExt", "frame_height", cfg::dat.titleBarHeight);
+ db_set_dw(0, "CLCExt", "grp_padding", cfg::dat.group_padding);
+ db_set_b(0, "CLCExt", "frame_height", cfg::dat.titleBarHeight);
Reload3dBevelColors();
SetButtonToSkinned();
@@ -508,32 +508,32 @@ void extbk_export(char *file) mir_snprintf(szSection, "Font%d", n);
mir_snprintf(szKey, "Font%dName", n);
- if (!db_get_s(NULL, "CLC", szKey, &dbv)) {
+ if (!db_get_s(0, "CLC", szKey, &dbv)) {
WritePrivateProfileStringA(szSection, "Name", dbv.pszVal, file);
mir_free(dbv.pszVal);
}
mir_snprintf(szKey, "Font%dSize", n);
- data = (DWORD)db_get_b(NULL, "CLC", szKey, 8);
+ data = (DWORD)db_get_b(0, "CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Size", &data, 1, file);
mir_snprintf(szKey, "Font%dSty", n);
- data = (DWORD)db_get_b(NULL, "CLC", szKey, 8);
+ data = (DWORD)db_get_b(0, "CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Style", &data, 1, file);
mir_snprintf(szKey, "Font%dSet", n);
- data = (DWORD)db_get_b(NULL, "CLC", szKey, 8);
+ data = (DWORD)db_get_b(0, "CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Set", &data, 1, file);
mir_snprintf(szKey, "Font%dCol", n);
- data = db_get_dw(NULL, "CLC", szKey, 8);
+ data = db_get_dw(0, "CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Color", &data, 4, file);
mir_snprintf(szKey, "Font%dFlags", n);
- data = (DWORD)db_get_dw(NULL, "CLC", szKey, 8);
+ data = (DWORD)db_get_dw(0, "CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "Flags", &data, 4, file);
mir_snprintf(szKey, "Font%dAs", n);
- data = (DWORD)db_get_w(NULL, "CLC", szKey, 8);
+ data = (DWORD)db_get_w(0, "CLC", szKey, 8);
WritePrivateProfileStructA(szSection, "SameAs", &data, 2, file);
}
@@ -542,20 +542,20 @@ void extbk_export(char *file) data = 0;
switch (_tagSettings[i].size) {
case 1:
- data = (DWORD)db_get_b(NULL, _tagSettings[i].szModule, _tagSettings[i].szSetting, (BYTE)_tagSettings[i].defaultval);
+ data = (DWORD)db_get_b(0, _tagSettings[i].szModule, _tagSettings[i].szSetting, (BYTE)_tagSettings[i].defaultval);
break;
case 2:
- data = (DWORD)db_get_w(NULL, _tagSettings[i].szModule, _tagSettings[i].szSetting, (DWORD)_tagSettings[i].defaultval);
+ data = (DWORD)db_get_w(0, _tagSettings[i].szModule, _tagSettings[i].szSetting, (DWORD)_tagSettings[i].defaultval);
break;
case 4:
- data = (DWORD)db_get_dw(NULL, _tagSettings[i].szModule, _tagSettings[i].szSetting, (DWORD)_tagSettings[i].defaultval);
+ data = (DWORD)db_get_dw(0, _tagSettings[i].szModule, _tagSettings[i].szSetting, (DWORD)_tagSettings[i].defaultval);
break;
}
WritePrivateProfileStructA("Global", _tagSettings[i].szSetting, &data, _tagSettings[i].size, file);
i++;
}
- if (!db_get_s(NULL, "CLC", "BkBitmap", &dbv)) {
+ if (!db_get_s(0, "CLC", "BkBitmap", &dbv)) {
WritePrivateProfileStringA("Global", "BkBitmap", dbv.pszVal, file);
db_free(&dbv);
}
@@ -891,7 +891,7 @@ done_with_glyph: GetPrivateProfileStringA(itemname, "Colorkey", "e5e5e5", buffer, 500, szFileName);
COLORREF clr = HexStringToLong(buffer);
cfg::dat.colorkey = clr;
- db_set_dw(NULL, "CLUI", "ColorKey", clr);
+ db_set_dw(0, "CLUI", "ColorKey", clr);
if (g_CLUISkinnedBkColor)
DeleteObject(g_CLUISkinnedBkColor);
g_CLUISkinnedBkColor = CreateSolidBrush(clr);
@@ -1224,14 +1224,14 @@ void IMG_LoadItems() free(szSections);
if (g_ImageItems) {
- db_set_b(NULL, "CLCExt", "bskinned", 1);
+ db_set_b(0, "CLCExt", "bskinned", 1);
SetButtonToSkinned();
}
if (g_CLUIImageItem) {
cfg::dat.bFullTransparent = TRUE;
cfg::dat.dwFlags &= ~CLUI_FRAME_CLISTSUNKEN;
- db_set_b(NULL, "CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent);
- db_set_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_NOBORDER);
+ db_set_b(0, "CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent);
+ db_set_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_NOBORDER);
ApplyCLUIBorderStyle();
SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(g_clistApi.hwndContactList, cfg::dat.colorkey, 0, LWA_COLORKEY);
@@ -1384,37 +1384,37 @@ void extbk_import(char *file, HWND hwndDlg) mir_snprintf(szKey, "Font%dName", n);
GetPrivateProfileStringA(szSection, "Name", "Arial", buffer, sizeof(buffer), file);
- db_set_s(NULL, "CLC", szKey, buffer);
+ db_set_s(0, "CLC", szKey, buffer);
mir_snprintf(szKey, "Font%dSize", n);
data = 0;
GetPrivateProfileStructA(szSection, "Size", &data, 1, file);
- db_set_b(NULL, "CLC", szKey, (BYTE)data);
+ db_set_b(0, "CLC", szKey, (BYTE)data);
mir_snprintf(szKey, "Font%dSty", n);
data = 0;
GetPrivateProfileStructA(szSection, "Style", &data, 1, file);
- db_set_b(NULL, "CLC", szKey, (BYTE)data);
+ db_set_b(0, "CLC", szKey, (BYTE)data);
mir_snprintf(szKey, "Font%dSet", n);
data = 0;
GetPrivateProfileStructA(szSection, "Set", &data, 1, file);
- db_set_b(NULL, "CLC", szKey, (BYTE)data);
+ db_set_b(0, "CLC", szKey, (BYTE)data);
mir_snprintf(szKey, "Font%dCol", n);
data = 0;
GetPrivateProfileStructA(szSection, "Color", &data, 4, file);
- db_set_dw(NULL, "CLC", szKey, data);
+ db_set_dw(0, "CLC", szKey, data);
mir_snprintf(szKey, "Font%dFlags", n);
data = 0;
GetPrivateProfileStructA(szSection, "Flags", &data, 4, file);
- db_set_dw(NULL, "CLC", szKey, (WORD)data);
+ db_set_dw(0, "CLC", szKey, (WORD)data);
mir_snprintf(szKey, "Font%dAs", n);
data = 0;
GetPrivateProfileStructA(szSection, "SameAs", &data, 2, file);
- db_set_dw(NULL, "CLC", szKey, (WORD)data);
+ db_set_dw(0, "CLC", szKey, (WORD)data);
}
}
i = 0;
@@ -1427,20 +1427,20 @@ void extbk_import(char *file, HWND hwndDlg) GetPrivateProfileStructA("Global", _tagSettings[i].szSetting, &data, _tagSettings[i].size, file);
switch (_tagSettings[i].size) {
case 1:
- db_set_b(NULL, _tagSettings[i].szModule, _tagSettings[i].szSetting, (BYTE)data);
+ db_set_b(0, _tagSettings[i].szModule, _tagSettings[i].szSetting, (BYTE)data);
break;
case 4:
- db_set_dw(NULL, _tagSettings[i].szModule, _tagSettings[i].szSetting, data);
+ db_set_dw(0, _tagSettings[i].szModule, _tagSettings[i].szSetting, data);
break;
case 2:
- db_set_w(NULL, _tagSettings[i].szModule, _tagSettings[i].szSetting, (WORD)data);
+ db_set_w(0, _tagSettings[i].szModule, _tagSettings[i].szSetting, (WORD)data);
break;
}
i++;
}
GetPrivateProfileStringA("Global", "BkBitmap", "", szString, MAX_PATH, file);
if (szString[0] != 0)
- db_set_s(NULL, "CLC", "BkBitmap", szString);
+ db_set_s(0, "CLC", "BkBitmap", szString);
}
Reload3dBevelColors();
@@ -1465,10 +1465,10 @@ static void ApplyCLUISkin() WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, nullptr, nullptr);
- if (db_get_b(NULL, "CLUI", "skin_changed", 0)) {
+ if (db_get_b(0, "CLUI", "skin_changed", 0)) {
extbk_import(szFinalName, nullptr);
SaveCompleteStructToDB();
- db_set_b(NULL, "CLUI", "skin_changed", 0);
+ db_set_b(0, "CLUI", "skin_changed", 0);
}
IMG_LoadItems();
ShowWindow(g_clistApi.hwndContactList, SW_SHOWNORMAL);
@@ -1486,9 +1486,9 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBVARIANT dbv;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_EQUALSELECTION, (db_get_b(NULL, "CLCExt", "EXBK_EqualSelection", 1) == 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SELBLEND, db_get_b(NULL, "CLCExt", "EXBK_SelBlend", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SETALLBUTTONSKINNED, db_get_b(NULL, "CLCExt", "bskinned", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_EQUALSELECTION, (db_get_b(0, "CLCExt", "EXBK_EqualSelection", 1) == 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SELBLEND, db_get_b(0, "CLCExt", "EXBK_SelBlend", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SETALLBUTTONSKINNED, db_get_b(0, "CLCExt", "bskinned", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg, IDC_CORNERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
SendDlgItemMessage(hwndDlg, IDC_CORNERSPIN, UDM_SETPOS, 0, cfg::dat.cornerRadius);
@@ -1503,16 +1503,16 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_USEPERPROTO, cfg::dat.bUsePerProto ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_OVERRIDEPERSTATUSCOLOR, cfg::dat.bOverridePerStatusColors ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_FASTGRADIENT, cfg::dat.bWantFastGradients ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_IGNORESELFORGROUPS, db_get_b(NULL, "CLC", "IgnoreSelforGroups", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IGNORESELFORGROUPS, db_get_b(0, "CLC", "IgnoreSelforGroups", 0) ? BST_CHECKED : BST_UNCHECKED);
- if (!db_get_s(NULL, "CLC", "ContactSkins", &dbv)) {
+ if (!db_get_s(0, "CLC", "ContactSkins", &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_SKINFILE, dbv.pszVal);
db_free(&dbv);
Utils::enableDlgControl(hwndDlg, IDC_RELOAD, TRUE);
}
else
Utils::enableDlgControl(hwndDlg, IDC_RELOAD, FALSE);
- CheckDlgButton(hwndDlg, IDC_USESKIN, db_get_b(NULL, "CLUI", "useskin", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_USESKIN, db_get_b(0, "CLUI", "useskin", 0) ? BST_CHECKED : BST_UNCHECKED);
if (!db_get_ws(NULL, "CLC", "AdvancedSkin", &dbv)) {
SetDlgItemText(hwndDlg, IDC_SKINFILENAME, dbv.pwszVal);
db_free(&dbv);
@@ -1526,7 +1526,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_USESKIN:
{
int useskin = IsDlgButtonChecked(hwndDlg, IDC_USESKIN);
- db_set_b(NULL, "CLUI", "useskin", (BYTE)(useskin ? 1 : 0));
+ db_set_b(0, "CLUI", "useskin", (BYTE)(useskin ? 1 : 0));
}
break;
@@ -1571,15 +1571,15 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
else
skinChanged = TRUE;
- db_set_ws(NULL, "CLC", "AdvancedSkin", final_path);
- db_set_b(NULL, "CLUI", "skin_changed", (BYTE)skinChanged);
+ db_set_ws(0, "CLC", "AdvancedSkin", final_path);
+ db_set_b(0, "CLUI", "skin_changed", (BYTE)skinChanged);
SetDlgItemText(hwndDlg, IDC_SKINFILENAME, final_path);
}
}
break;
case IDC_RELOADSKIN:
- db_set_b(NULL, "CLUI", "skin_changed", 1);
+ db_set_b(0, "CLUI", "skin_changed", 1);
ApplyCLUISkin();
break;
@@ -1628,7 +1628,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
{
- int oPage = db_get_b(NULL, "CLUI", "opage", 0);
+ int oPage = db_get_b(0, "CLUI", "opage", 0);
RECT rcClient;
GetClientRect(hwnd, &rcClient);
@@ -1745,7 +1745,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara tci.mask = TCIF_PARAM;
TabCtrl_GetItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)), &tci);
ShowWindow((HWND)tci.lParam, SW_SHOW);
- db_set_b(NULL, "CLUI", "opage", (BYTE)TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)));
+ db_set_b(0, "CLUI", "opage", (BYTE)TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)));
Utils::enableDlgControl(hwnd, IDC_EXPORT, TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)) != 0);
Utils::enableDlgControl(hwnd, IDC_IMPORT, TabCtrl_GetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB)) != 0);
break;
@@ -1787,7 +1787,7 @@ int CoolSB_SetupScrollBar() !arStatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE]->imageItem)
cfg::dat.bSkinnedScrollbar = FALSE;
- if (db_get_b(NULL, "CLC", "NoVScrollBar", 0)) {
+ if (db_get_b(0, "CLC", "NoVScrollBar", 0)) {
UninitializeCoolSB(g_clistApi.hwndContactTree);
return 0;
}
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 4bf1266d31..94465ed1c6 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -124,49 +124,49 @@ int CMPlugin::Load() cfg::dat.hMenuNotify = CreatePopupMenu();
cfg::dat.wNextMenuID = 1;
- cfg::dat.sortTimer = db_get_dw(NULL, "CLC", "SortTimer", 150);
- cfg::dat.avatarBorder = (COLORREF)db_get_dw(NULL, "CLC", "avatarborder", 0);
- cfg::dat.avatarRadius = (COLORREF)db_get_dw(NULL, "CLC", "avatarradius", 4);
+ cfg::dat.sortTimer = db_get_dw(0, "CLC", "SortTimer", 150);
+ cfg::dat.avatarBorder = (COLORREF)db_get_dw(0, "CLC", "avatarborder", 0);
+ cfg::dat.avatarRadius = (COLORREF)db_get_dw(0, "CLC", "avatarradius", 4);
cfg::dat.hBrushAvatarBorder = CreateSolidBrush(cfg::dat.avatarBorder);
- cfg::dat.avatarSize = db_get_w(NULL, "CList", "AvatarSize", 24);
- cfg::dat.dualRowMode = db_get_b(NULL, "CLC", "DualRowMode", 0);
- cfg::dat.avatarPadding = db_get_b(NULL, "CList", "AvatarPadding", 0);
- cfg::dat.isTransparent = db_get_b(NULL, "CList", "Transparent", 0);
- cfg::dat.alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
- cfg::dat.autoalpha = db_get_b(NULL, "CList", "AutoAlpha", SETTING_ALPHA_DEFAULT);
- cfg::dat.fadeinout = db_get_b(NULL, "CLUI", "FadeInOut", 0);
- cfg::dat.autosize = db_get_b(NULL, "CLUI", "AutoSize", 0);
- cfg::dat.bNoOfflineAvatars = db_get_b(NULL, "CList", "NoOfflineAV", 1);
- cfg::dat.bFullTransparent = db_get_b(NULL, "CLUI", "fulltransparent", 0);
- cfg::dat.bDblClkAvatars = db_get_b(NULL, "CLC", "dblclkav", 0);
- cfg::dat.bEqualSections = db_get_b(NULL, "CLUI", "EqualSections", 0);
- cfg::dat.bCenterStatusIcons = db_get_b(NULL, "CLC", "si_centered", 1);
+ cfg::dat.avatarSize = db_get_w(0, "CList", "AvatarSize", 24);
+ cfg::dat.dualRowMode = db_get_b(0, "CLC", "DualRowMode", 0);
+ cfg::dat.avatarPadding = db_get_b(0, "CList", "AvatarPadding", 0);
+ cfg::dat.isTransparent = db_get_b(0, "CList", "Transparent", 0);
+ cfg::dat.alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
+ cfg::dat.autoalpha = db_get_b(0, "CList", "AutoAlpha", SETTING_ALPHA_DEFAULT);
+ cfg::dat.fadeinout = db_get_b(0, "CLUI", "FadeInOut", 0);
+ cfg::dat.autosize = db_get_b(0, "CLUI", "AutoSize", 0);
+ cfg::dat.bNoOfflineAvatars = db_get_b(0, "CList", "NoOfflineAV", 1);
+ cfg::dat.bFullTransparent = db_get_b(0, "CLUI", "fulltransparent", 0);
+ cfg::dat.bDblClkAvatars = db_get_b(0, "CLC", "dblclkav", 0);
+ cfg::dat.bEqualSections = db_get_b(0, "CLUI", "EqualSections", 0);
+ cfg::dat.bCenterStatusIcons = db_get_b(0, "CLC", "si_centered", 1);
cfg::dat.boldHideOffline = -1;
cfg::dat.bSecIMAvail = ServiceExists("SecureIM/IsContactSecured") ? 1 : 0;
- cfg::dat.bNoTrayTips = db_get_b(NULL, "CList", "NoTrayTips", 0);
- cfg::dat.bShowLocalTime = db_get_b(NULL, "CLC", "ShowLocalTime", 1);
- cfg::dat.bShowLocalTimeSelective = db_get_b(NULL, "CLC", "SelectiveLocalTime", 1);
- cfg::dat.bDontSeparateOffline = db_get_b(NULL, "CList", "DontSeparateOffline", 0);
- cfg::dat.bShowXStatusOnSbar = db_get_b(NULL, "CLUI", "xstatus_sbar", 0);
- cfg::dat.bLayeredHack = db_get_b(NULL, "CLUI", "layeredhack", 1);
- cfg::dat.bFirstRun = db_get_b(NULL, "CLUI", "firstrun", 1);
+ cfg::dat.bNoTrayTips = db_get_b(0, "CList", "NoTrayTips", 0);
+ cfg::dat.bShowLocalTime = db_get_b(0, "CLC", "ShowLocalTime", 1);
+ cfg::dat.bShowLocalTimeSelective = db_get_b(0, "CLC", "SelectiveLocalTime", 1);
+ cfg::dat.bDontSeparateOffline = db_get_b(0, "CList", "DontSeparateOffline", 0);
+ cfg::dat.bShowXStatusOnSbar = db_get_b(0, "CLUI", "xstatus_sbar", 0);
+ cfg::dat.bLayeredHack = db_get_b(0, "CLUI", "layeredhack", 1);
+ cfg::dat.bFirstRun = db_get_b(0, "CLUI", "firstrun", 1);
cfg::dat.langPackCP = Langpack_GetDefaultCodePage();
- cfg::dat.realTimeSaving = db_get_b(NULL, "CLUI", "save_pos_always", 0);
+ cfg::dat.realTimeSaving = db_get_b(0, "CLUI", "save_pos_always", 0);
- DWORD sortOrder = db_get_dw(NULL, "CList", "SortOrder", SORTBY_NAME);
+ DWORD sortOrder = db_get_dw(0, "CList", "SortOrder", SORTBY_NAME);
cfg::dat.sortOrder[0] = LOBYTE(LOWORD(sortOrder));
cfg::dat.sortOrder[1] = HIBYTE(LOWORD(sortOrder));
cfg::dat.sortOrder[2] = LOBYTE(HIWORD(sortOrder));
if (cfg::dat.bFirstRun)
- db_set_b(NULL, "CLUI", "firstrun", 0);
+ db_set_b(0, "CLUI", "firstrun", 0);
ReloadThemedOptions();
Reload3dBevelColors();
- cfg::dat.dwFlags = db_get_dw(NULL, "CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN);
- cfg::dat.dwFlags |= (db_get_b(NULL, "CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
- cfg::dat.soundsOff = db_get_b(NULL, "Skin", "UseSound", 1) ? 0 : 1;
+ cfg::dat.dwFlags = db_get_dw(0, "CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN);
+ cfg::dat.dwFlags |= (db_get_b(0, "CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
+ cfg::dat.soundsOff = db_get_b(0, "Skin", "UseSound", 1) ? 0 : 1;
Profile_GetPathW(MAX_PATH, cfg::dat.tszProfilePath);
wcslwr(cfg::dat.tszProfilePath);
diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 007fdb34e5..b1352384c7 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -87,7 +87,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HDC hdc = BeginPaint(hwnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
RECT rcClient, rcWindow;
- BYTE windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT);
+ BYTE windowStyle = db_get_b(0, "CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT);
LONG b_offset = cfg::dat.bClipBorder + (windowStyle == SETTING_WINDOWSTYLE_NOBORDER ? 2 : (windowStyle == SETTING_WINDOWSTYLE_THINBORDER ? 1 : 0));
GetClientRect(hwnd, &rcClient);
@@ -154,7 +154,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event
tooltip_active = TRUE;
- else if (db_get_dw(NULL, "mToolTip", "ShowStatusTip", 0)) {
+ else if (db_get_dw(0, "mToolTip", "ShowStatusTip", 0)) {
PROTOACCOUNT *pa = Proto_GetAccount(PD->RealName);
if (pa == nullptr)
break;
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 2951f8d44f..9a36ba6b49 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -293,19 +293,19 @@ void SaveViewMode(const char *name, const wchar_t *szGroupFilter, const char *sz char szSetting[512];
mir_snprintf(szSetting, "%c%s_PF", 246, name);
- db_set_s(NULL, CLVM_MODULE, szSetting, szProtoFilter);
+ db_set_s(0, CLVM_MODULE, szSetting, szProtoFilter);
mir_snprintf(szSetting, "%c%s_GF", 246, name);
- db_set_ws(NULL, CLVM_MODULE, szSetting, szGroupFilter);
+ db_set_ws(0, CLVM_MODULE, szSetting, szGroupFilter);
mir_snprintf(szSetting, "%c%s_SM", 246, name);
- db_set_dw(NULL, CLVM_MODULE, szSetting, statusMask);
+ db_set_dw(0, CLVM_MODULE, szSetting, statusMask);
mir_snprintf(szSetting, "%c%s_SSM", 246, name);
- db_set_dw(NULL, CLVM_MODULE, szSetting, stickyStatusMask);
+ db_set_dw(0, CLVM_MODULE, szSetting, stickyStatusMask);
mir_snprintf(szSetting, "%c%s_OPT", 246, name);
- db_set_dw(NULL, CLVM_MODULE, szSetting, options);
+ db_set_dw(0, CLVM_MODULE, szSetting, options);
mir_snprintf(szSetting, "%c%s_LM", 246, name);
- db_set_dw(NULL, CLVM_MODULE, szSetting, lmdat);
+ db_set_dw(0, CLVM_MODULE, szSetting, lmdat);
- db_set_dw(NULL, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
+ db_set_dw(0, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
}
// saves the state of the filter definitions for the current item
@@ -430,7 +430,7 @@ void UpdateFilters() }
mir_snprintf(szSetting, "%c%s_PF", 246, szBuf);
- if (db_get_s(NULL, CLVM_MODULE, szSetting, &dbv_pf))
+ if (db_get_s(0, CLVM_MODULE, szSetting, &dbv_pf))
goto cleanup;
mir_snprintf(szSetting, "%c%s_GF", 246, szBuf);
@@ -438,17 +438,17 @@ void UpdateFilters() goto cleanup;
mir_snprintf(szSetting, "%c%s_OPT", 246, szBuf);
- if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1) {
+ if ((opt = db_get_dw(0, CLVM_MODULE, szSetting, -1)) != -1) {
SendDlgItemMessage(sttClvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
}
mir_snprintf(szSetting, "%c%s_SM", 246, szBuf);
- statusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
+ statusMask = db_get_dw(0, CLVM_MODULE, szSetting, -1);
mir_snprintf(szSetting, "%c%s_SSM", 246, szBuf);
- sttStickyStatusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
+ sttStickyStatusMask = db_get_dw(0, CLVM_MODULE, szSetting, -1);
- dwFlags = db_get_dw(NULL, CLVM_MODULE, szBuf, 0);
+ dwFlags = db_get_dw(0, CLVM_MODULE, szBuf, 0);
{
char szMask[256];
HWND hwndList = GetDlgItem(sttClvmHwnd, IDC_PROTOCOLS);
@@ -520,7 +520,7 @@ void UpdateFilters() Utils::enableDlgControl(sttClvmHwnd, IDC_LASTMESSAGEUNIT, useLastMsg);
mir_snprintf(szSetting, "%c%s_LM", 246, szBuf);
- lmdat = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
+ lmdat = db_get_dw(0, CLVM_MODULE, szSetting, 0);
SetDlgItemInt(sttClvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE);
bTmp = LOBYTE(HIWORD(lmdat));
@@ -672,7 +672,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP szBuf[255] = 0;
if (mir_strlen(szBuf) > 2) {
- if (db_get_dw(NULL, CLVM_MODULE, szBuf, -1) != -1)
+ if (db_get_dw(0, CLVM_MODULE, szBuf, -1) != -1)
MessageBox(nullptr, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK);
else {
int iNewItem = SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf);
@@ -864,7 +864,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_USER + 100:
{
- bool bSkinned = db_get_b(NULL, "CLCExt", "bskinned", 0) != 0;
+ bool bSkinned = db_get_b(0, "CLCExt", "bskinned", 0) != 0;
for (auto &it : _buttons) {
HWND hwndButton = GetDlgItem(hwnd, it.btn_id);
SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(it.icon));
@@ -967,7 +967,7 @@ clvm_reset_command: SetButtonStates();
cfg::dat.current_viewmode[0] = 0;
cfg::dat.old_viewmode[0] = 0;
- db_set_s(NULL, "CList", "LastViewMode", "");
+ db_set_s(0, "CList", "LastViewMode", "");
break;
case IDC_CONFIGUREMODES:
@@ -1039,23 +1039,23 @@ void ApplyViewMode(const char *name) }
mir_snprintf(szSetting, "%c%s_SM", 246, name);
- cfg::dat.statusMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
+ cfg::dat.statusMaskFilter = db_get_dw(0, CLVM_MODULE, szSetting, -1);
if (cfg::dat.statusMaskFilter >= 1)
cfg::dat.bFilterEffective |= CLVM_FILTER_STATUS;
mir_snprintf(szSetting, "%c%s_SSM", 246, name);
- cfg::dat.stickyMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
+ cfg::dat.stickyMaskFilter = db_get_dw(0, CLVM_MODULE, szSetting, -1);
if (cfg::dat.stickyMaskFilter != -1)
cfg::dat.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
- cfg::dat.filterFlags = db_get_dw(NULL, CLVM_MODULE, name, 0);
+ cfg::dat.filterFlags = db_get_dw(0, CLVM_MODULE, name, 0);
KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
if (cfg::dat.filterFlags & CLVM_AUTOCLEAR) {
DWORD timerexpire;
mir_snprintf(szSetting, "%c%s_OPT", 246, name);
- timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
+ timerexpire = LOWORD(db_get_dw(0, CLVM_MODULE, szSetting, 0));
strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
cfg::dat.old_viewmode[255] = 0;
SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, nullptr);
@@ -1073,7 +1073,7 @@ void ApplyViewMode(const char *name) cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG;
mir_snprintf(szSetting, "%c%s_LM", 246, name);
- cfg::dat.lastMsgFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
+ cfg::dat.lastMsgFilter = db_get_dw(0, CLVM_MODULE, szSetting, 0);
if (LOBYTE(HIWORD(cfg::dat.lastMsgFilter)))
cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN;
else
@@ -1099,7 +1099,7 @@ void ApplyViewMode(const char *name) cfg::dat.bFilterEffective |= CLVM_STICKY_CONTACTS;
if (cfg::dat.boldHideOffline == (BYTE)-1)
- cfg::dat.boldHideOffline = db_get_b(NULL, "CList", "HideOffline", 0);
+ cfg::dat.boldHideOffline = db_get_b(0, "CList", "HideOffline", 0);
g_clistApi.pfnSetHideOffline(false);
if (name == nullptr) {
@@ -1112,5 +1112,5 @@ void ApplyViewMode(const char *name) Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
SetButtonStates();
- db_set_s(NULL, "CList", "LastViewMode", cfg::dat.current_viewmode);
+ db_set_s(0, "CList", "LastViewMode", cfg::dat.current_viewmode);
}
diff --git a/plugins/Cln_skinedit/src/main.cpp b/plugins/Cln_skinedit/src/main.cpp index 8c95c929ff..1637cf86ed 100644 --- a/plugins/Cln_skinedit/src/main.cpp +++ b/plugins/Cln_skinedit/src/main.cpp @@ -688,8 +688,8 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped")); SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched")); - SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3ddark", RGB(224, 224, 224))); - SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3dbright", RGB(224, 224, 224))); + SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, db_get_dw(0, "CLCExt", "3ddark", RGB(224, 224, 224))); + SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(0, "CLCExt", "3dbright", RGB(224, 224, 224))); return 0; case WM_DRAWITEM: @@ -829,8 +829,8 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa // save struct to DB if (psd->pfnSaveCompleteStruct) psd->pfnSaveCompleteStruct(); - db_set_dw(NULL, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0)); - db_set_dw(NULL, "CLCExt", "3ddark", SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, "CLCExt", "3dbright", SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, "CLCExt", "3ddark", SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_GETCOLOUR, 0, 0)); if (psd->pfnClcOptionsChanged) psd->pfnClcOptionsChanged(); diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp index 9634eba955..a2cfa5a2e5 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.cpp +++ b/plugins/CloudFile/src/Services/dropbox_service.cpp @@ -103,7 +103,7 @@ void CDropboxService::RequestAccessTokenThread(void *param) } node = root.at("access_token"); - db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str()); + db_set_s(0, GetAccountName(), "TokenSecret", node.as_string().c_str()); SetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, ""); @@ -133,7 +133,7 @@ void CDropboxService::HandleJsonError(JSONNode &node) auto CDropboxService::UploadFile(const char *data, size_t size, const std::string &path) { ptrA token(getStringA("TokenSecret")); - BYTE strategy = db_get_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + BYTE strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); DropboxAPI::UploadFileRequest request(token, path.c_str(), data, size, (OnConflict)strategy); NLHR_PTR response(request.Send(m_hConnection)); @@ -162,7 +162,7 @@ void CDropboxService::UploadFileChunk(const std::string &sessionId, const char * auto CDropboxService::CommitUploadSession(const std::string &sessionId, const char *data, size_t size, size_t offset, const std::string &path) { ptrA token(getStringA("TokenSecret")); - BYTE strategy = db_get_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + BYTE strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); DropboxAPI::CommitUploadSessionRequest request(token, sessionId.c_str(), offset, path.c_str(), data, size, (OnConflict)strategy); NLHR_PTR response(request.Send(m_hConnection)); diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp index 9679c17fc0..313aa5efa7 100644 --- a/plugins/CloudFile/src/Services/google_service.cpp +++ b/plugins/CloudFile/src/Services/google_service.cpp @@ -128,14 +128,14 @@ void CGDriveService::RequestAccessTokenThread(void *param) } node = root.at("access_token"); - db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str()); + db_set_s(0, GetAccountName(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); time_t expiresIn = time(0) + node.as_int(); - db_set_dw(NULL, GetAccountName(), "ExpiresIn", expiresIn); + db_set_dw(0, GetAccountName(), "ExpiresIn", expiresIn); node = root.at("refresh_token"); - db_set_s(NULL, GetAccountName(), "RefreshToken", node.as_string().c_str()); + db_set_s(0, GetAccountName(), "RefreshToken", node.as_string().c_str()); SetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, ""); diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp index c435bc19b4..992312e2a8 100644 --- a/plugins/CloudFile/src/Services/microsoft_service.cpp +++ b/plugins/CloudFile/src/Services/microsoft_service.cpp @@ -65,7 +65,7 @@ void COneDriveService::Login(HWND owner) JSONNode root = GetJsonResponse(response); JSONNode node = root.at("access_token"); - db_set_s(NULL, GetAccountName(), "TokenSecret", node.as_string().c_str()); + db_set_s(0, GetAccountName(), "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); time_t expiresIn = time(0) + node.as_int(); @@ -154,7 +154,7 @@ void COneDriveService::HandleJsonError(JSONNode &node) auto COneDriveService::UploadFile(const std::string &parentId, const std::string &fileName, const char *data, size_t size) { ptrA token(getStringA("TokenSecret")); - BYTE strategy = db_get_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + BYTE strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); OneDriveAPI::UploadFileRequest *request = !parentId.empty() ? new OneDriveAPI::UploadFileRequest(token, parentId.c_str(), fileName.c_str(), data, size, (OnConflict)strategy) : new OneDriveAPI::UploadFileRequest(token, fileName.c_str(), data, size, (OnConflict)strategy); @@ -168,7 +168,7 @@ auto COneDriveService::UploadFile(const std::string &parentId, const std::string auto COneDriveService::CreateUploadSession(const std::string &parentId, const std::string &fileName) { ptrA token(getStringA("TokenSecret")); - BYTE strategy = db_get_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + BYTE strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); OneDriveAPI::CreateUploadSessionRequest *request = !parentId.empty() ? new OneDriveAPI::CreateUploadSessionRequest(token, parentId.c_str(), fileName.c_str(), (OnConflict)strategy) : new OneDriveAPI::CreateUploadSessionRequest(token, fileName.c_str(), (OnConflict)strategy); diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp index ca8ba197d6..a1472ee197 100644 --- a/plugins/CloudFile/src/Services/yandex_service.cpp +++ b/plugins/CloudFile/src/Services/yandex_service.cpp @@ -167,7 +167,7 @@ void CYandexService::HandleJsonError(JSONNode &node) auto CYandexService::CreateUploadSession(const std::string &path) { ptrA token(getStringA("TokenSecret")); - BYTE strategy = db_get_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + BYTE strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); YandexAPI::GetUploadUrlRequest request(token, path.c_str(), (OnConflict)strategy); NLHR_PTR response(request.Send(m_hConnection)); diff --git a/plugins/CloudFile/src/menus.cpp b/plugins/CloudFile/src/menus.cpp index 7a5ddb084d..3ca1b085b9 100644 --- a/plugins/CloudFile/src/menus.cpp +++ b/plugins/CloudFile/src/menus.cpp @@ -15,7 +15,7 @@ void InitializeMenus() SET_UID(mi, 0x93d4495b, 0x259b, 0x4fba, 0xbc, 0x14, 0xf9, 0x46, 0x2c, 0xda, 0xfc, 0x6d); mi.name.a = LPGEN("Upload to..."); - ptrA defaultService(db_get_sa(NULL, MODULENAME, "DefaultService")); + ptrA defaultService(g_plugin.getStringA("DefaultService")); if (defaultService) { CCloudService *service = FindService(defaultService); if (service) { diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp index c17ef8d9d2..0ac7c120a0 100644 --- a/plugins/CloudFile/src/options.cpp +++ b/plugins/CloudFile/src/options.cpp @@ -21,7 +21,7 @@ bool COptionsMainDlg::OnInitDialog() { CDlgBase::OnInitDialog(); - ptrA defaultService(db_get_sa(NULL, MODULENAME, "DefaultService")); + ptrA defaultService(g_plugin.getStringA("DefaultService")); int iItem = m_defaultService.AddString(TranslateT("None")); m_defaultService.SetCurSel(iItem); @@ -31,7 +31,7 @@ bool COptionsMainDlg::OnInitDialog() m_defaultService.SetCurSel(iItem); } - BYTE strategy = db_get_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + BYTE strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); switch (strategy) { case OnConflict::RENAME: @@ -58,16 +58,16 @@ bool COptionsMainDlg::OnApply() int iItem = m_defaultService.GetCurSel(); CCloudService *service = (CCloudService*)m_defaultService.GetItemData(iItem); if (service) - db_set_s(NULL, MODULENAME, "DefaultService", service->GetAccountName()); + g_plugin.setString("DefaultService", service->GetAccountName()); else - db_unset(NULL, MODULENAME, "DefaultService"); + g_plugin.delSetting("DefaultService"); if (m_renameOnConflict.GetState()) - db_set_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::RENAME); + g_plugin.setByte("ConflictStrategy", OnConflict::RENAME); else if (m_repalceOnConflict.GetState()) - db_set_b(NULL, MODULENAME, "ConflictStrategy", OnConflict::REPLACE); + g_plugin.setByte("ConflictStrategy", OnConflict::REPLACE); else - db_unset(NULL, MODULENAME, "ConflictStrategy"); + g_plugin.delSetting("ConflictStrategy"); return true; } diff --git a/plugins/CloudFile/src/services.cpp b/plugins/CloudFile/src/services.cpp index 9f1867cb6e..e0a01fbfba 100644 --- a/plugins/CloudFile/src/services.cpp +++ b/plugins/CloudFile/src/services.cpp @@ -24,7 +24,7 @@ static INT_PTR GetService(WPARAM wParam, LPARAM lParam) ptrA accountName(mir_strdup((char*)wParam)); if (!accountName || !mir_strlen(accountName)) - accountName = db_get_sa(NULL, MODULENAME, "DefaultService"); + accountName = g_plugin.getStringA("DefaultService"); if (accountName == nullptr) return 2; @@ -63,7 +63,7 @@ INT_PTR Upload(WPARAM wParam, LPARAM lParam) ptrA accountName(mir_strdup(uploadData->accountName)); if (!mir_strlen(accountName)) - accountName = db_get_sa(NULL, MODULENAME, "DefaultService"); + accountName = g_plugin.getStringA("DefaultService"); if (accountName == nullptr) return 2; diff --git a/plugins/CloudFile/src/srmm.cpp b/plugins/CloudFile/src/srmm.cpp index ae12de3bf1..b4d44c9fdd 100644 --- a/plugins/CloudFile/src/srmm.cpp +++ b/plugins/CloudFile/src/srmm.cpp @@ -42,7 +42,7 @@ int OnSrmmButtonPressed(WPARAM, LPARAM lParam) return 0; if (cbc->flags != BBCF_ARROWCLICKED) { - ptrA defaultService(db_get_sa(NULL, MODULENAME, "DefaultService")); + ptrA defaultService(g_plugin.getStringA("DefaultService")); if (defaultService) { CCloudService *service = FindService(defaultService); if (service) diff --git a/plugins/CloudFile/src/utils.cpp b/plugins/CloudFile/src/utils.cpp index 22611fe539..5d75225db8 100644 --- a/plugins/CloudFile/src/utils.cpp +++ b/plugins/CloudFile/src/utils.cpp @@ -5,7 +5,7 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, if (Miranda_IsTerminated()) return; - if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) { + if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATAT ppd = { 0 }; ppd.lchContact = hContact; wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); @@ -102,12 +102,12 @@ void PasteToClipboard(const wchar_t *data) void Report(MCONTACT hContact, const wchar_t *data) { - if (db_get_b(NULL, MODULENAME, "UrlAutoSend", 1)) + if (g_plugin.getByte("UrlAutoSend", 1)) SendToContact(hContact, data); - if (db_get_b(NULL, MODULENAME, "UrlPasteToMessageInputArea", 0)) + if (g_plugin.getByte("UrlPasteToMessageInputArea", 0)) PasteToInputArea(hContact, data); - if (db_get_b(NULL, MODULENAME, "UrlCopyToClipboard", 0)) + if (g_plugin.getByte("UrlCopyToClipboard", 0)) PasteToClipboard(data); } diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index fad86f67d0..0ddb5c5f6b 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -432,26 +432,26 @@ void HandleSoundsCommand(PCommand command, TArgument *argv, int argc, PReply rep switch (argc) {
case 2:
- state = db_get_b(NULL, "Skin", "UseSound", 1);
+ state = db_get_b(0, "Skin", "UseSound", 1);
Set2StateReply(reply, state, 0, LPGENW("Sounds are currently enabled."), L"", LPGENW("Sounds are currently disabled."), L"");
break;
case 3:
switch (Get2StateValue(argv[2])) {
case STATE_ON:
- db_set_b(NULL, "Skin", "UseSound", 1);
+ db_set_b(0, "Skin", "UseSound", 1);
state = TRUE;
break;
case STATE_OFF:
- db_set_b(NULL, "Skin", "UseSound", 0);
+ db_set_b(0, "Skin", "UseSound", 0);
state = FALSE;
break;
case STATE_TOGGLE:
- state = db_get_b(NULL, "Skin", "UseSound", 1);
+ state = db_get_b(0, "Skin", "UseSound", 1);
state = 1 - state;
- db_set_b(NULL, "Skin", "UseSound", state);
+ db_set_b(0, "Skin", "UseSound", state);
break;
default:
@@ -811,28 +811,28 @@ void HandleDatabaseCommand(PCommand command, TArgument *argv, int argc, PReply r switch (type) {
case VALUE_STRING:
- db_set_s(NULL, module, key, (char *)value);
+ db_set_s(0, module, key, (char *)value);
wrote = Translate("string");
break;
case VALUE_BYTE:
- db_set_b(NULL, module, key, (*(char *)value));
+ db_set_b(0, module, key, (*(char *)value));
wrote = Translate("byte");
break;
case VALUE_WORD:
- db_set_w(NULL, module, key, (*(WORD *)value));
+ db_set_w(0, module, key, (*(WORD *)value));
wrote = Translate("word");
break;
case VALUE_DWORD:
- db_set_dw(NULL, module, key, (*(DWORD *)value));
+ db_set_dw(0, module, key, (*(DWORD *)value));
wrote = Translate("dword");
break;
case VALUE_WIDE:
- db_set_ws(NULL, module, key, (WCHAR *)value);
+ db_set_ws(0, module, key, (WCHAR *)value);
wrote = Translate("wide string");
break;
@@ -944,7 +944,7 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe switch (argc) {
case 4:
{
- int value = db_get_b(NULL, module, "NLUseProxy", 0);
+ int value = db_get_b(0, module, "NLUseProxy", 0);
reply->code = MIMRES_SUCCESS;
mir_snwprintf(buffer, L"%S proxy status is %s", protocol, (value) ? L"enabled" : L"disabled");
@@ -956,14 +956,14 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe int state = Get2StateValue(argv[4]);
switch (state) {
case STATE_OFF:
- db_set_b(NULL, module, "NLUseProxy", 0);
+ db_set_b(0, module, "NLUseProxy", 0);
reply->code = MIMRES_SUCCESS;
mir_snwprintf(buffer, TranslateT("'%S' proxy was disabled."), protocol);
break;
case STATE_ON:
- db_set_b(NULL, module, "NLUseProxy", 1);
+ db_set_b(0, module, "NLUseProxy", 1);
reply->code = MIMRES_SUCCESS;
mir_snwprintf(buffer, TranslateT("'%S' proxy was enabled."), protocol);
@@ -971,9 +971,9 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe case STATE_TOGGLE:
{
- int value = db_get_b(NULL, module, "NLUseProxy", 0);
+ int value = db_get_b(0, module, "NLUseProxy", 0);
value = 1 - value;
- db_set_b(NULL, module, "NLUseProxy", value);
+ db_set_b(0, module, "NLUseProxy", value);
reply->code = MIMRES_SUCCESS;
mir_snwprintf(buffer, (value) ? TranslateT("'%S' proxy was enabled.") : TranslateT("'%S' proxy was disabled."), protocol);
@@ -998,8 +998,8 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe {
char host[256], type[256];
GetStringFromDatabase(NULL, module, "NLProxyServer", "<unknown>", host, _countof(host));
- int port = db_get_w(NULL, module, "NLProxyPort", 0);
- PrettyProxyType(db_get_b(NULL, module, "NLProxyType", 0), type, _countof(type));
+ int port = db_get_w(0, module, "NLProxyPort", 0);
+ PrettyProxyType(db_get_b(0, module, "NLProxyType", 0), type, _countof(type));
reply->code = MIMRES_SUCCESS;
mir_snwprintf(buffer, TranslateT("%S proxy server: %S %S:%d."), protocol, type, host, port);
@@ -1014,9 +1014,9 @@ void HandleProtocolProxyCommand(PCommand command, TArgument *argv, int argc, PRe long port = wcstol(argv[6], &stop, 10);
if ((*stop == 0) && (type > 0)) {
- db_set_s(NULL, module, "NLProxyServer", host);
- db_set_w(NULL, module, "NLProxyPort", port);
- db_set_b(NULL, module, "NLProxyType", type);
+ db_set_s(0, module, "NLProxyServer", host);
+ db_set_w(0, module, "NLProxyPort", port);
+ db_set_b(0, module, "NLProxyType", type);
reply->code = MIMRES_SUCCESS;
mir_snwprintf(buffer, TranslateT("%S proxy set to %s %S:%d."), protocol, argv[4], host, port);
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index 7fe08815df..c4b742db8b 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -135,12 +135,12 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size)
{
- return GetStringFromDatabase(NULL, MODULENAME, szSettingName, szError, szResult, size);
+ return GetStringFromDatabase(0, MODULENAME, szSettingName, szError, szResult, size);
}
int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count)
{
- return GetStringFromDatabase(NULL, MODULENAME, szSettingName, szError, szResult, count);
+ return GetStringFromDatabase(0, MODULENAME, szSettingName, szError, szResult, count);
}
#pragma warning (disable: 4312)
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 107ff78e04..031a7b8c11 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -91,22 +91,22 @@ void saveSettingsConnections(struct CONNECTION *connHead) while (tmp != nullptr) {
mir_snprintf(buff, "%dFilterIntIp", i);
- db_set_ws(NULL, PLUGINNAME, buff, tmp->strIntIp);
+ db_set_ws(0, PLUGINNAME, buff, tmp->strIntIp);
mir_snprintf(buff, "%dFilterExtIp", i);
- db_set_ws(NULL, PLUGINNAME, buff, tmp->strExtIp);
+ db_set_ws(0, PLUGINNAME, buff, tmp->strExtIp);
mir_snprintf(buff, "%dFilterPName", i);
- db_set_ws(NULL, PLUGINNAME, buff, tmp->PName);
+ db_set_ws(0, PLUGINNAME, buff, tmp->PName);
mir_snprintf(buff, "%dFilterIntPort", i);
- db_set_dw(NULL, PLUGINNAME, buff, tmp->intIntPort);
+ db_set_dw(0, PLUGINNAME, buff, tmp->intIntPort);
mir_snprintf(buff, "%dFilterExtPort", i);
- db_set_dw(NULL, PLUGINNAME, buff, tmp->intExtPort);
+ db_set_dw(0, PLUGINNAME, buff, tmp->intExtPort);
mir_snprintf(buff, "%dFilterAction", i);
- db_set_dw(NULL, PLUGINNAME, buff, tmp->Pid);
+ db_set_dw(0, PLUGINNAME, buff, tmp->Pid);
i++;
tmp = tmp->next;
}
settingFiltersCount = i;
- db_set_dw(NULL, PLUGINNAME, "FiltersCount", settingFiltersCount);
+ db_set_dw(0, PLUGINNAME, "FiltersCount", settingFiltersCount);
}
@@ -149,16 +149,16 @@ struct CONNECTION* LoadSettingsConnections() //called to load settings from database
void LoadSettings()
{
- settingInterval = (INT)db_get_dw(NULL, PLUGINNAME, "Interval", 500);
- settingInterval1 = (INT)db_get_dw(NULL, PLUGINNAME, "PopupInterval", 0);
- settingResolveIp = db_get_b(NULL, PLUGINNAME, "ResolveIp", TRUE);
- settingDefaultAction = db_get_b(NULL, PLUGINNAME, "FilterDefaultAction", TRUE);
-
- settingSetColours = db_get_b(NULL, PLUGINNAME, "PopupSetColours", 0);
- settingBgColor = (COLORREF)db_get_dw(NULL, PLUGINNAME, "PopupBgColor", (DWORD)0xFFFFFF);
- settingFgColor = (COLORREF)db_get_dw(NULL, PLUGINNAME, "PopupFgColor", (DWORD)0x000000);
- settingFiltersCount = (INT)db_get_dw(NULL, PLUGINNAME, "FiltersCount", 0);
- settingStatusMask = (WORD)db_get_w(NULL, PLUGINNAME, "StatusMask", 16);
+ settingInterval = (INT)db_get_dw(0, PLUGINNAME, "Interval", 500);
+ settingInterval1 = (INT)db_get_dw(0, PLUGINNAME, "PopupInterval", 0);
+ settingResolveIp = db_get_b(0, PLUGINNAME, "ResolveIp", TRUE);
+ settingDefaultAction = db_get_b(0, PLUGINNAME, "FilterDefaultAction", TRUE);
+
+ settingSetColours = db_get_b(0, PLUGINNAME, "PopupSetColours", 0);
+ settingBgColor = (COLORREF)db_get_dw(0, PLUGINNAME, "PopupBgColor", (DWORD)0xFFFFFF);
+ settingFgColor = (COLORREF)db_get_dw(0, PLUGINNAME, "PopupFgColor", (DWORD)0x000000);
+ settingFiltersCount = (INT)db_get_dw(0, PLUGINNAME, "FiltersCount", 0);
+ settingStatusMask = (WORD)db_get_w(0, PLUGINNAME, "StatusMask", 16);
for (int i = 0; i < STATUS_COUNT; i++) {
char buff[128];
mir_snprintf(buff, "Status%d", i);
@@ -506,13 +506,13 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar return TRUE;
case PSN_APPLY:
- db_set_dw(NULL, PLUGINNAME, "Interval", settingInterval);
- db_set_dw(NULL, PLUGINNAME, "PopupInterval", settingInterval1);
- db_set_b(NULL, PLUGINNAME, "PopupSetColours", settingSetColours);
- db_set_dw(NULL, PLUGINNAME, "PopupBgColor", (DWORD)settingBgColor);
- db_set_dw(NULL, PLUGINNAME, "PopupFgColor", (DWORD)settingFgColor);
- db_set_b(NULL, PLUGINNAME, "ResolveIp", settingResolveIp);
- db_set_b(NULL, PLUGINNAME, "FilterDefaultAction", settingDefaultAction);
+ db_set_dw(0, PLUGINNAME, "Interval", settingInterval);
+ db_set_dw(0, PLUGINNAME, "PopupInterval", settingInterval1);
+ db_set_b(0, PLUGINNAME, "PopupSetColours", settingSetColours);
+ db_set_dw(0, PLUGINNAME, "PopupBgColor", (DWORD)settingBgColor);
+ db_set_dw(0, PLUGINNAME, "PopupFgColor", (DWORD)settingFgColor);
+ db_set_b(0, PLUGINNAME, "ResolveIp", settingResolveIp);
+ db_set_b(0, PLUGINNAME, "FilterDefaultAction", settingDefaultAction);
for (int i = 0; i < STATUS_COUNT; i++) {
char buff[128];
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index d68d3f0522..f136dd419f 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -154,7 +154,7 @@ static void ShowConsole(int show) ScrollDown(pActive);
}
ShowWindow(hwndConsole, show ? SW_SHOW : SW_HIDE);
- db_set_b(NULL, "Console", "Show", (BYTE)(show ? 1 : 0));
+ db_set_b(0, "Console", "Show", (BYTE)(show ? 1 : 0));
if (hwnd)
SetForegroundWindow(hwnd);
@@ -955,14 +955,14 @@ static int OnFastDump(WPARAM wParam, LPARAM lParam) static void LoadSettings()
{
- gIcons = db_get_b(NULL, "Console", "ShowIcons", 1);
- gSeparator = db_get_b(NULL, "Console", "Separator", 1);
- gSingleMode = db_get_b(NULL, "Console", "SingleMode", 0);
+ gIcons = db_get_b(0, "Console", "ShowIcons", 1);
+ gSeparator = db_get_b(0, "Console", "Separator", 1);
+ gSingleMode = db_get_b(0, "Console", "SingleMode", 0);
- gWrapLen = db_get_b(NULL, "Console", "Wrap", DEFAULT_WRAPLEN);
+ gWrapLen = db_get_b(0, "Console", "Wrap", DEFAULT_WRAPLEN);
if (gWrapLen < MIN_WRAPLEN) gWrapLen = DEFAULT_WRAPLEN;
- gLimit = db_get_dw(NULL, "Console", "Limit", MIN_LIMIT);
+ gLimit = db_get_dw(0, "Console", "Limit", MIN_LIMIT);
if (gLimit > MAX_LIMIT) gLimit = MAX_LIMIT;
if (gLimit < MIN_LIMIT) gLimit = MIN_LIMIT;
}
@@ -978,7 +978,7 @@ static void SaveSettings(HWND hwndDlg) gWrapLen = len;
SetDlgItemInt(hwndDlg, IDC_WRAP, gWrapLen, FALSE);
- db_set_b(NULL, "Console", "Wrap", (BYTE)len);
+ db_set_b(0, "Console", "Wrap", (BYTE)len);
len = GetDlgItemInt(hwndDlg, IDC_LIMIT, nullptr, FALSE);
if (len < MIN_LIMIT)
@@ -988,13 +988,13 @@ static void SaveSettings(HWND hwndDlg) gLimit = len;
SetDlgItemInt(hwndDlg, IDC_LIMIT, gLimit, FALSE);
- db_set_dw(NULL, "Console", "Limit", len);
+ db_set_dw(0, "Console", "Limit", len);
- db_set_b(NULL, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE));
- db_set_b(NULL, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR));
- db_set_b(NULL, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS));
+ db_set_b(0, "Console", "SingleMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SINGLE));
+ db_set_b(0, "Console", "Separator", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATOR));
+ db_set_b(0, "Console", "ShowIcons", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWICONS));
- db_set_b(NULL, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START));
+ db_set_b(0, "Console", "ShowAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_START));
}
@@ -1003,7 +1003,7 @@ static INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_START, db_get_b(NULL, "Console", "ShowAtStart", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_START, db_get_b(0, "Console", "ShowAtStart", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SINGLE, gSingleMode ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWICONS, gIcons ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SEPARATOR, gSeparator ? BST_CHECKED : BST_UNCHECKED);
@@ -1150,7 +1150,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) OnFontChange(0, 0);
OnColourChange(0, 0);
- if (db_get_b(NULL, "Console", "ShowAtStart", 0) || db_get_b(NULL, "Console", "Show", 1))
+ if (db_get_b(0, "Console", "ShowAtStart", 0) || db_get_b(0, "Console", "Show", 1))
ShowConsole(1);
else
ShowConsole(0);
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index a7955cb70b..71e44df0b2 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -200,7 +200,7 @@ static void SetAllContactChecks(HWND hwndList, MCONTACT hReceiver) // doubtful n if (szProto == nullptr)
return;
- if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT))
+ if (db_get_b(0, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT))
SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, TRUE, 0);
else
SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, FALSE, 0);
@@ -333,7 +333,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (!wndData->SendContacts(hwndDlg))
break;
- SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(NULL, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), nullptr);
+ SetTimer(hwndDlg, TIMERID_MSGSEND, db_get_dw(0, "SRMsg", "MessageTimeout", TIMEOUT_MSGSEND), nullptr);
}
break;
diff --git a/plugins/CountryFlags/src/main.cpp b/plugins/CountryFlags/src/main.cpp index 3af8d023be..1585cd251b 100644 --- a/plugins/CountryFlags/src/main.cpp +++ b/plugins/CountryFlags/src/main.cpp @@ -51,10 +51,10 @@ int CMPlugin::Load() if (CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&nCountriesCount, (LPARAM)&countries))
nCountriesCount = 0;
- bShowStatusIcon = db_get_b(NULL, MODULENAME, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
- bShowExtraIcon = db_get_b(NULL, MODULENAME, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
- bUseUnknown = db_get_b(NULL, MODULENAME, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
- bUseIpToCountry = db_get_b(NULL, MODULENAME, "UseIpToCountry", SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
+ bShowStatusIcon = g_plugin.getByte("ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
+ bShowExtraIcon = g_plugin.getByte("ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
+ bUseUnknown = g_plugin.getByte("UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
+ bUseIpToCountry = g_plugin.getByte("UseIpToCountry", SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
InitIcons();
InitIpToCountry();
diff --git a/plugins/CountryFlags/src/options.cpp b/plugins/CountryFlags/src/options.cpp index cde19a8664..29a2f9c4de 100644 --- a/plugins/CountryFlags/src/options.cpp +++ b/plugins/CountryFlags/src/options.cpp @@ -59,15 +59,15 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARA bool bChanged = false, bTemp;
if ((bTemp = IsDlgButtonChecked(hwndDlg, IDC_CHECK_USEUNKNOWNFLAG) != 0) != bUseUnknown)
- db_set_b(NULL, MODULENAME, "UseUnknownFlag", bUseUnknown = bTemp), bChanged = true;
+ g_plugin.setByte("UseUnknownFlag", bUseUnknown = bTemp), bChanged = true;
if ((bTemp = IsDlgButtonChecked(hwndDlg, IDC_CHECK_USEIPTOCOUNTRY) != 0) != bUseIpToCountry)
- db_set_b(NULL, MODULENAME, "UseIpToCountry", bUseIpToCountry = bTemp), bChanged = true;
+ g_plugin.setByte("UseIpToCountry", bUseIpToCountry = bTemp), bChanged = true;
/* Status Icon */
if ((bTemp = IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWSTATUSICONFLAG) != 0) != bShowStatusIcon)
- db_set_b(NULL, MODULENAME, "ShowStatusIconFlag", bShowStatusIcon = bTemp), bChanged = true;
+ g_plugin.setByte("ShowStatusIconFlag", bShowStatusIcon = bTemp), bChanged = true;
/* Extra Image */
if ((bTemp = IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWEXTRAIMGFLAG) != 0) != bShowExtraIcon)
- db_set_b(NULL, MODULENAME, "ShowExtraImgFlag", bShowExtraIcon = bTemp), bChanged = true;
+ g_plugin.setByte("ShowExtraImgFlag", bShowExtraIcon = bTemp), bChanged = true;
if (bChanged) {
UpdateExtraImages();
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 89d6229fa6..7f603b9a9e 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -154,7 +154,7 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM) INT_PTR CopyLinkToClipboard(WPARAM, LPARAM)
{
- ptrW tmp(db_get_wsa(NULL, MODULENAME, "Username"));
+ ptrW tmp(g_plugin.getWStringA("Username"));
if (tmp != NULL) {
wchar_t buffer[MAX_PATH];
mir_snwprintf(buffer, L"https://vi.miranda-ng.org/detail/%s", tmp);
@@ -336,7 +336,7 @@ static int ModulesLoaded(WPARAM, LPARAM) if (servicemode)
ViewVersionInfo(0, 0);
- else if (db_get_b(NULL, MODULENAME, "UploadChanged", 0) && !ProcessVIHash(false))
+ else if (g_plugin.getByte("UploadChanged", 0) && !ProcessVIHash(false))
UploadVersionInfo(0, 0xa1);
return 0;
@@ -355,9 +355,9 @@ int CMPlugin::Load() if (hMsftedit == nullptr)
return 1;
- clsdates = db_get_b(NULL, MODULENAME, "ClassicDates", 1) != 0;
- dtsubfldr = db_get_b(NULL, MODULENAME, "SubFolders", 1) != 0;
- catchcrashes = db_get_b(NULL, MODULENAME, "CatchCrashes", 1) != 0;
+ clsdates = g_plugin.getByte("ClassicDates", 1) != 0;
+ dtsubfldr = g_plugin.getByte("SubFolders", 1) != 0;
+ catchcrashes = g_plugin.getByte("CatchCrashes", 1) != 0;
profname = Utils_ReplaceVarsW(L"%miranda_profilename%.dat");
profpath = Utils_ReplaceVarsW(L"%miranda_userdata%");
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 52d42d745e..ddf4fd2f56 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -604,6 +604,6 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const wcha if (len > 8192)
free(dst);
- if (db_get_b(0, MODULENAME, "ShowCrashMessageBox", 1) && msg && IDYES == MessageBox(nullptr, msg, L"Miranda Crash Dumper", MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST))
+ if (g_plugin.getByte("ShowCrashMessageBox", 1) && msg && IDYES == MessageBox(nullptr, msg, L"Miranda Crash Dumper", MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST))
StoreStringToClip(buffer);
}
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index c9b642af73..c085d0efc1 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -187,15 +187,15 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TranslateDialogDefault(hwndDlg);
{
DBVARIANT dbv;
- if (db_get_s(NULL, MODULENAME, "Username", &dbv) == 0) {
+ if (g_plugin.getString("Username", &dbv) == 0) {
SetDlgItemTextA(hwndDlg, IDC_USERNAME, dbv.pszVal);
db_free(&dbv);
}
- if (db_get_s(NULL, MODULENAME, "Password", &dbv) == 0) {
+ if (g_plugin.getString("Password", &dbv) == 0) {
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_UPLOADCHN, db_get_b(NULL, MODULENAME, "UploadChanged", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UPLOADCHN, g_plugin.getByte("UploadChanged", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CLASSICDATES, clsdates ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DATESUBFOLDER, dtsubfldr ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CATCHCRASHES, catchcrashes ? BST_CHECKED : BST_UNCHECKED);
@@ -230,28 +230,28 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY) {
char szSetting[100];
GetDlgItemTextA(hwndDlg, IDC_USERNAME, szSetting, _countof(szSetting));
- db_set_s(NULL, MODULENAME, "Username", szSetting);
+ g_plugin.setString("Username", szSetting);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szSetting, _countof(szSetting));
- db_set_s(NULL, MODULENAME, "Password", szSetting);
+ g_plugin.setString("Password", szSetting);
- db_set_b(NULL, MODULENAME, "UploadChanged", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN));
+ g_plugin.setByte("UploadChanged", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN));
clsdates = IsDlgButtonChecked(hwndDlg, IDC_CLASSICDATES) == BST_CHECKED;
if (clsdates)
- db_set_b(NULL, MODULENAME, "ClassicDates", 1);
+ g_plugin.setByte("ClassicDates", 1);
else
- db_set_b(NULL, MODULENAME, "ClassicDates", 0);
+ g_plugin.setByte("ClassicDates", 0);
dtsubfldr = IsDlgButtonChecked(hwndDlg, IDC_DATESUBFOLDER) == BST_CHECKED;
if (dtsubfldr)
- db_set_b(NULL, MODULENAME, "SubFolders", 1);
+ g_plugin.setByte("SubFolders", 1);
else
- db_set_b(NULL, MODULENAME, "SubFolders", 0);
+ g_plugin.setByte("SubFolders", 0);
catchcrashes = IsDlgButtonChecked(hwndDlg, IDC_CATCHCRASHES) == BST_CHECKED;
if (catchcrashes)
- db_set_b(NULL, MODULENAME, "CatchCrashes", 1);
+ g_plugin.setByte("CatchCrashes", 1);
else
- db_set_b(NULL, MODULENAME, "CatchCrashes", 0);
+ g_plugin.setByte("CatchCrashes", 0);
}
break;
}
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index adfe5b0aa0..746567bd28 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -39,14 +39,14 @@ void GetLoginStr(char* user, size_t szuser, char* pass) {
DBVARIANT dbv;
- if (db_get_s(NULL, MODULENAME, "Username", &dbv) == 0) {
+ if (g_plugin.getString("Username", &dbv) == 0) {
strncpy_s(user, szuser, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
else
user[0] = 0;
- if (db_get_s(NULL, MODULENAME, "Password", &dbv) == 0) {
+ if (g_plugin.getString("Password", &dbv) == 0) {
BYTE hash[16];
mir_md5_state_t context;
@@ -129,7 +129,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) // if the recieved code is 200 OK
switch (nlhrReply->resultCode) {
case 200:
- if (db_get_b(NULL, MODULENAME, "UploadChanged", 0))
+ if (g_plugin.getByte("UploadChanged", 0))
ProcessVIHash(true);
ShowMessage(1, TranslateT("Version Info upload successful."));
@@ -242,11 +242,11 @@ bool ProcessVIHash(bool store) arrayToHex(hash, sizeof(hash), hashstr);
if (store) {
- db_set_s(NULL, MODULENAME, "VIHash", hashstr);
+ g_plugin.setString("VIHash", hashstr);
return true;
}
- ptrA VIHash(db_get_sa(NULL, MODULENAME, "VIHash"));
+ ptrA VIHash(g_plugin.getStringA("VIHash"));
if (VIHash == NULL)
return false;
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 9d0bb2cbd4..c2908ff458 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -421,6 +421,6 @@ bool IsPluginEnabled(wchar_t* filename) char* fname;
crsi_t2a(fname, filename);
char* ext = strstr(_strlwr(fname), ".dll");
- bool res = ext && ext[4] == '\0' && db_get_b(NULL, "PluginDisable", fname, 0) == 0;
+ bool res = ext && ext[4] == '\0' && db_get_b(0, "PluginDisable", fname, 0) == 0;
return res;
}
diff --git a/plugins/CurrencyRates/src/CommonOptionDlg.cpp b/plugins/CurrencyRates/src/CommonOptionDlg.cpp index 2878f2a91f..db0fa32b65 100644 --- a/plugins/CurrencyRates/src/CommonOptionDlg.cpp +++ b/plugins/CurrencyRates/src/CommonOptionDlg.cpp @@ -60,11 +60,11 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr for (int i = 0; i < _countof(pszRefreshRateTypes); ++i) ::SendMessage(hwndCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(pszRefreshRateTypes[i])); - int nRefreshRateType = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); + int nRefreshRateType = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS) nRefreshRateType = RRT_MINUTES; - UINT nRate = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); + UINT nRate = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); switch (nRefreshRateType) { default: case RRT_SECONDS: @@ -201,17 +201,17 @@ void CommonOptionDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp, CCommonDlgPr assert(visitor.m_pszDbStatusMsgFormat); rData.m_bFireSetingsChangedEvent = true; - db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, nType); - db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, nRefreshRate); + db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, nType); + db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, nRefreshRate); tstring s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_CONTACT_LIST_FORMAT)); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, s.c_str()); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbDisplayNameFormat, s.c_str()); s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_STATUS_MESSAGE_FORMAT)); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, s.c_str()); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbStatusMsgFormat, s.c_str()); s = get_window_text(::GetDlgItem(hWnd, IDC_EDIT_TENDENCY_FORMAT)); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, s.c_str()); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbTendencyFormat, s.c_str()); CAdvProviderSettings* pAdvSet = get_adv_settings(rData.m_pCurrencyRatesProvider, false); if (pAdvSet) diff --git a/plugins/CurrencyRates/src/CurrencyConverter.cpp b/plugins/CurrencyRates/src/CurrencyConverter.cpp index d71655b014..b4ea9b18c1 100644 --- a/plugins/CurrencyRates/src/CurrencyConverter.cpp +++ b/plugins/CurrencyRates/src/CurrencyConverter.cpp @@ -201,8 +201,8 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM auto from = rSection.GetCurrencyRate(nFrom); auto to = rSection.GetCurrencyRate(nTo); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_FROM_ID, from.GetID().c_str()); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_TO_ID, to.GetID().c_str()); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_FROM_ID, from.GetID().c_str()); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_STR_CC_CURRENCYRATE_TO_ID, to.GetID().c_str()); const auto pProvider = get_currency_converter_provider(); assert(pProvider); diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp index d05b977394..634e645b1d 100644 --- a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp +++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp @@ -690,11 +690,11 @@ DWORD get_refresh_timeout_miliseconds(const CCurrencyRatesProviderVisitorDbSetti assert(visitor.m_pszDbRefreshRateType); assert(visitor.m_pszDbRefreshRateValue); - int nRefreshRateType = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); + int nRefreshRateType = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateType, RRT_MINUTES); if (nRefreshRateType < RRT_SECONDS || nRefreshRateType > RRT_HOURS) nRefreshRateType = RRT_MINUTES; - DWORD nTimeout = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); + DWORD nTimeout = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbRefreshRateValue, 1); switch (nRefreshRateType) { default: case RRT_SECONDS: diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp index a2906c619b..ea2861e378 100644 --- a/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp +++ b/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp @@ -47,7 +47,7 @@ void CCurrencyRatesProviders::InitProviders() CreateProviders(); const WORD nCurrentVersion = 17; - WORD nVersion = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, 1); + WORD nVersion = db_get_w(0, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, 1); for (auto &hContact : Contacts(CURRENCYRATES_MODULE_NAME)) { TCurrencyRatesProviderPtr pProvider = GetContactProviderPtr(hContact); @@ -58,7 +58,7 @@ void CCurrencyRatesProviders::InitProviders() } } - db_set_w(NULL, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, nCurrentVersion); + db_set_w(0, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, nCurrentVersion); } CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::GetContactProviderPtr(MCONTACT hContact)const diff --git a/plugins/CurrencyRates/src/Forex.cpp b/plugins/CurrencyRates/src/Forex.cpp index 2715beaca0..5047bfa31d 100644 --- a/plugins/CurrencyRates/src/Forex.cpp +++ b/plugins/CurrencyRates/src/Forex.cpp @@ -45,7 +45,7 @@ INT_PTR CurrencyRatesMenu_RefreshAll(WPARAM, LPARAM) INT_PTR CurrencyRatesMenu_EnableDisable(WPARAM, LPARAM) { g_bAutoUpdate = (g_bAutoUpdate) ? false : true; - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_AUTO_UPDATE, g_bAutoUpdate); + db_set_b(0, CURRENCYRATES_MODULE_NAME, DB_STR_AUTO_UPDATE, g_bAutoUpdate); const CModuleInfo::TCurrencyRatesProvidersPtr& pProviders = CModuleInfo::GetCurrencyRateProvidersPtr(); const CCurrencyRatesProviders::TCurrencyRatesProviders& rapProviders = pProviders->GetProviders(); @@ -194,7 +194,7 @@ int CurrencyRatesEventFunc_OnModulesLoaded(WPARAM, LPARAM) HookEvent(ME_TTB_MODULELOADED, CurrencyRates_OnToolbarLoaded); - g_bAutoUpdate = 1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_AUTO_UPDATE, 1); + g_bAutoUpdate = 1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_STR_AUTO_UPDATE, 1); InitMenu(); diff --git a/plugins/CurrencyRates/src/Log.cpp b/plugins/CurrencyRates/src/Log.cpp index ebc5e76a43..c769f1a98d 100644 --- a/plugins/CurrencyRates/src/Log.cpp +++ b/plugins/CurrencyRates/src/Log.cpp @@ -14,7 +14,7 @@ namespace #ifdef _DEBUG return true; #else - return (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, DB_STR_ENABLE_LOG, false)); + return (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_STR_ENABLE_LOG, false)); #endif } diff --git a/plugins/CurrencyRates/src/SettingsDlg.cpp b/plugins/CurrencyRates/src/SettingsDlg.cpp index e24b0e381c..99cb998adc 100644 --- a/plugins/CurrencyRates/src/SettingsDlg.cpp +++ b/plugins/CurrencyRates/src/SettingsDlg.cpp @@ -656,9 +656,9 @@ CAdvProviderSettings::CAdvProviderSettings(const ICurrencyRatesProvider* pCurren assert(visitor.m_pszDbLogFormat); assert(visitor.m_pszDbLogCondition); - m_wLogMode = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, static_cast<WORD>(lmDisabled)); + m_wLogMode = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, static_cast<WORD>(lmDisabled)); m_sFormatHistory = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, visitor.m_pszDefHistoryFormat); - m_bIsOnlyChangedHistory = 1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, 0); + m_bIsOnlyChangedHistory = 1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, 0); m_sLogFileName = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile); if (true == m_sLogFileName.empty()) { @@ -669,10 +669,10 @@ CAdvProviderSettings::CAdvProviderSettings(const ICurrencyRatesProvider* pCurren } m_sFormatLogFile = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, visitor.m_pszDefLogFileFormat); - m_bIsOnlyChangedLogFile = (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, 0)); + m_bIsOnlyChangedLogFile = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, 0)); m_sPopupFormat = CurrencyRates_DBGetStringT(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, visitor.m_pszDefPopupFormat); - m_bShowPopupIfValueChanged = (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, 0)); + m_bShowPopupIfValueChanged = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, 0)); } CAdvProviderSettings::~CAdvProviderSettings() @@ -703,22 +703,22 @@ void CAdvProviderSettings::SaveToDb()const assert(visitor.m_pszDbPopupDelayTimeout); assert(visitor.m_pszDbPopupHistoryFlag); - db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, m_wLogMode); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, m_sFormatHistory.c_str()); - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, m_bIsOnlyChangedHistory); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile, m_sLogFileName.c_str()); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, m_sFormatLogFile.c_str()); - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, m_bIsOnlyChangedLogFile); - db_set_ws(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, m_sPopupFormat.c_str()); - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, m_bShowPopupIfValueChanged); + db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogMode, m_wLogMode); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryFormat, m_sFormatHistory.c_str()); + db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbHistoryCondition, m_bIsOnlyChangedHistory); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFile, m_sLogFileName.c_str()); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogFormat, m_sFormatLogFile.c_str()); + db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbLogCondition, m_bIsOnlyChangedLogFile); + db_set_ws(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupFormat, m_sPopupFormat.c_str()); + db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupCondition, m_bShowPopupIfValueChanged); if (nullptr != m_pPopupSettings) { - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode())); - db_set_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_pPopupSettings->GetColourBk()); - db_set_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_pPopupSettings->GetColourText()); - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode())); - db_set_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_pPopupSettings->GetDelayTimeout()); - db_set_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_pPopupSettings->GetHistoryFlag()); + db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_pPopupSettings->GetColourMode())); + db_set_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_pPopupSettings->GetColourBk()); + db_set_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_pPopupSettings->GetColourText()); + db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_pPopupSettings->GetDelayMode())); + db_set_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_pPopupSettings->GetDelayTimeout()); + db_set_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_pPopupSettings->GetHistoryFlag()); } } @@ -829,19 +829,19 @@ CPopupSettings::CPopupSettings(const ICurrencyRatesProvider* pCurrencyRatesProvi assert(visitor.m_pszDbPopupDelayTimeout); assert(visitor.m_pszDbPopupHistoryFlag); - BYTE m = db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_modeColour)); + BYTE m = db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupColourMode, static_cast<BYTE>(m_modeColour)); if (m >= colourDefault && m <= colourUserDefined) m_modeColour = static_cast<EColourMode>(m); - m_rgbBkg = db_get_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_rgbBkg); - m_rgbText = db_get_dw(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_rgbText); + m_rgbBkg = db_get_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupBkColour, m_rgbBkg); + m_rgbText = db_get_dw(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupTextColour, m_rgbText); - m = db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_modeDelay)); + m = db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayMode, static_cast<BYTE>(m_modeDelay)); if (m >= delayFromPopup && m <= delayPermanent) { m_modeDelay = static_cast<EDelayMode>(m); } - m_wDelay = db_get_w(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_wDelay); - m_bUseHistory = (1 == db_get_b(NULL, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_bUseHistory)); + m_wDelay = db_get_w(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupDelayTimeout, m_wDelay); + m_bUseHistory = (1 == db_get_b(0, CURRENCYRATES_MODULE_NAME, visitor.m_pszDbPopupHistoryFlag, m_bUseHistory)); } /*static */ diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index dcc3e6463b..343aa625da 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -8,7 +8,7 @@ int deleteModule(MCONTACT hContact, const char *module, int confirm) if (!module || IsModuleEmpty(hContact, module))
return 0;
- if (confirm && db_get_b(NULL, MODULENAME, "WarnOnDelete", 1)) {
+ if (confirm && g_plugin.getByte("WarnOnDelete", 1)) {
wchar_t text[MSG_SIZE];
mir_snwprintf(text, TranslateT("Are you sure you want to delete module \"%s\"?"), _A2T(module));
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 193ea74cc3..939a1b554d 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -127,14 +127,14 @@ static int ModulesLoaded(WPARAM, LPARAM) hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D');
g_plugin.addHotkey(&hkd);
- g_bUsePopups = db_get_b(NULL, MODULENAME, "UsePopUps", 0) != 0;
+ g_bUsePopups = g_plugin.getByte("UsePopUps", 0) != 0;
// Load the name order
for (int i = 0; i < NAMEORDERCOUNT; i++)
nameOrder[i] = i;
DBVARIANT dbv = { 0 };
- if (!db_get_s(NULL, "Contact", "NameOrder", &dbv, DBVT_BLOB)) {
+ if (!db_get_s(0, "Contact", "NameOrder", &dbv, DBVT_BLOB)) {
memcpy(nameOrder, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
@@ -517,7 +517,7 @@ void loadListSettings(HWND hwnd, ColumnsSettings *cs) int i = 0;
while (cs[i].name) {
sLC.pszText = TranslateW(cs[i].name);
- sLC.cx = db_get_w(NULL, MODULENAME, cs[i].dbname, cs[i].defsize);
+ sLC.cx = g_plugin.getWord(cs[i].dbname, cs[i].defsize);
ListView_InsertColumn(hwnd, cs[i].index, &sLC);
i++;
}
@@ -532,7 +532,7 @@ void saveListSettings(HWND hwnd, ColumnsSettings *cs) while (cs[i].name) {
if (ListView_GetColumn(hwnd, cs[i].index, &sLC)) {
mir_snprintf(tmp, cs[i].dbname, i);
- db_set_w(NULL, MODULENAME, tmp, (WORD)sLC.cx);
+ g_plugin.setWord(tmp, (WORD)sLC.cx);
}
i++;
}
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 1698814b4d..fbef13920e 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -128,7 +128,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR }
}
else if ((mtis->type == CONTACT) && hContact) {
- if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
+ if (db_get_b(0, "CList", "ConfirmDelete", 1)) {
wchar_t str[MSG_SIZE];
mir_snwprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
@@ -213,7 +213,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowText(hwnd, TranslateT("Database Editor++"));
// setup the splitter
- SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, (LONG_PTR)db_get_w(NULL, MODULENAME, "Splitter", 200));
+ SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, (LONG_PTR)g_plugin.getWord("Splitter", 200));
SendMessage(hwnd, GC_SPLITTERMOVED, 0, 0);
mir_subclassWindow(GetDlgItem(hwnd, IDC_SPLITTER), SplitterSubclassProc);
@@ -233,29 +233,29 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TranslateMenu(GetSubMenu(hMenu, i));
Utils_RestoreWindowPosition(hwnd, NULL, MODULENAME, "Main_");
- if (db_get_b(NULL, MODULENAME, "Maximized", 0))
+ if (g_plugin.getByte("Maximized", 0))
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
- g_Inline = !db_get_b(NULL, MODULENAME, "DontAllowInLineEdit", 1);
+ g_Inline = !g_plugin.getByte("DontAllowInLineEdit", 1);
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_INLINE_EDIT, MF_BYCOMMAND | (g_Inline ? MF_CHECKED : MF_UNCHECKED));
g_Mode = MODE_ALL;
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_FILTER_ALL, MF_BYCOMMAND | MF_CHECKED);
- g_Hex = db_get_b(NULL, MODULENAME, "HexMode", 0);
+ g_Hex = g_plugin.getByte("HexMode", 0);
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_BYTE_HEX, MF_BYCOMMAND | ((g_Hex & HEX_BYTE) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_WORD_HEX, MF_BYCOMMAND | ((g_Hex & HEX_WORD) ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(GetSubMenu(hMenu, 5), MENU_DWORD_HEX, MF_BYCOMMAND | ((g_Hex & HEX_DWORD) ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1) ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (g_plugin.getByte("RestoreOnOpen", 1) ? MF_CHECKED : MF_UNCHECKED));
- g_Order = db_get_b(NULL, MODULENAME, "SortMode", 1);
+ g_Order = g_plugin.getByte("SortMode", 1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SORT_ORDER, MF_BYCOMMAND | (g_Order ? MF_CHECKED : MF_UNCHECKED));
int restore;
if (hRestore)
restore = 3;
- else if (db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1))
+ else if (g_plugin.getByte("RestoreOnOpen", 1))
restore = 2;
else
restore = 0;
@@ -283,7 +283,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (splitterPos > rc2.right - rc2.left - 150)
splitterPos = rc2.right - rc2.left - 150;
SetWindowLongPtr(GetDlgItem(hwnd, IDC_SPLITTER), GWLP_USERDATA, splitterPos);
- db_set_w(NULL, MODULENAME, "Splitter", (WORD)splitterPos);
+ g_plugin.setWord("Splitter", (WORD)splitterPos);
}
PostMessage(hwnd, WM_SIZE, 0, 0);
}
@@ -304,7 +304,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_DESTROY: // free our shit!
- if (db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1)) {
+ if (g_plugin.getByte("RestoreOnOpen", 1)) {
HTREEITEM item;
if (item = TreeView_GetSelection(hwnd2Tree)) {
@@ -322,16 +322,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) type = mtis->type;
}
- db_set_dw(NULL, MODULENAME, "LastContact", hContact);
+ g_plugin.setDword("LastContact", hContact);
if (type == CONTACT)
- db_set_s(NULL, MODULENAME, "LastModule", "");
+ g_plugin.setString("LastModule", "");
else
- db_set_s(NULL, MODULENAME, "LastModule", _T2A(text));
+ g_plugin.setString("LastModule", _T2A(text));
}
else {
- db_unset(NULL, MODULENAME, "LastContact");
- db_unset(NULL, MODULENAME, "LastModule");
+ g_plugin.delSetting("LastContact");
+ g_plugin.delSetting("LastModule");
}
int pos = ListView_GetSelectionMark(hwnd2List);
@@ -339,26 +339,26 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (pos != -1) {
char data[FLD_SIZE];
ListView_GetItemTextA(hwnd2List, pos, 0, data, _countof(data));
- db_set_s(NULL, MODULENAME, "LastSetting", data);
+ g_plugin.setString("LastSetting", data);
}
else
- db_unset(NULL, MODULENAME, "LastSetting");
+ g_plugin.delSetting("LastSetting");
}
}
- db_set_b(NULL, MODULENAME, "HexMode", (byte)g_Hex);
- db_set_b(NULL, MODULENAME, "SortMode", (byte)g_Order);
- db_set_b(NULL, MODULENAME, "DontAllowInLineEdit", (byte)!g_Inline);
+ g_plugin.setByte("HexMode", (byte)g_Hex);
+ g_plugin.setByte("SortMode", (byte)g_Order);
+ g_plugin.setByte("DontAllowInLineEdit", (byte)!g_Inline);
{
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hwnd, &wp);
if (wp.flags == WPF_RESTORETOMAXIMIZED) {
- db_set_b(NULL, MODULENAME, "Maximized", 1);
+ g_plugin.setByte("Maximized", 1);
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
}
- else db_set_b(NULL, MODULENAME, "Maximized", 0);
+ else g_plugin.setByte("Maximized", 0);
Utils_SaveWindowPosition(hwnd, NULL, MODULENAME, "Main_");
ShowWindow(hwnd, SW_HIDE);
@@ -491,9 +491,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case MENU_SAVE_POSITION:
{
- BOOL save = !db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1);
+ BOOL save = !g_plugin.getByte("RestoreOnOpen", 1);
CheckMenuItem(GetSubMenu(GetMenu(hwnd), 5), MENU_SAVE_POSITION, MF_BYCOMMAND | (save ? MF_CHECKED : MF_UNCHECKED));
- db_set_b(NULL, MODULENAME, "RestoreOnOpen", (byte)save);
+ g_plugin.setByte("RestoreOnOpen", (byte)save);
}
break;
case MENU_INLINE_EDIT:
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 3d3b15d5db..109dc77f0a 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -340,11 +340,11 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) break;
case 2: // restore saved
- if (GetValueA(NULL, MODULENAME, "LastModule", SelectedModule, _countof(SelectedModule))) {
- hSelectedContact = db_get_dw(NULL, MODULENAME, "LastContact", INVALID_CONTACT_ID);
+ if (GetValueA(0, MODULENAME, "LastModule", SelectedModule, _countof(SelectedModule))) {
+ hSelectedContact = g_plugin.getDword("LastContact", INVALID_CONTACT_ID);
if (hSelectedContact != INVALID_CONTACT_ID)
Select = 1;
- GetValueA(NULL, MODULENAME, "LastSetting", SelectedSetting, _countof(SelectedSetting));
+ GetValueA(0, MODULENAME, "LastSetting", SelectedSetting, _countof(SelectedSetting));
}
break;
@@ -403,7 +403,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID param) insertItem(hContact, module->name, contact);
}
- if (db_get_b(NULL, MODULENAME, "ExpandSettingsOnOpen", 0))
+ if (g_plugin.getByte("ExpandSettingsOnOpen", 0))
TreeView_Expand(hwnd2Tree, contact, TVE_EXPAND);
if (Select && hSelectedContact == NULL) {
@@ -711,7 +711,7 @@ void moduleListRightClick(HWND hwnd, WPARAM, LPARAM lParam) // hwnd here is to t break;
case MENU_DELETE_CONTACT:
- if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
+ if (db_get_b(0, "CList", "ConfirmDelete", 1)) {
wchar_t str[MSG_SIZE];
mir_snwprintf(str, TranslateT("Are you sure you want to delete contact \"%s\"?"), text);
if (dlg(str, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index bcc4ea98fb..870f1d2ea0 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -6,12 +6,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) {
case WM_INITDIALOG:
bInitDone = false;
- CheckDlgButton(hwnd, IDC_EXPANDSETTINGS, db_get_b(NULL, MODULENAME, "ExpandSettingsOnOpen", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_RESTORESETTINGS, db_get_b(NULL, MODULENAME, "RestoreOnOpen", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_WARNONDEL, db_get_b(NULL, MODULENAME, "WarnOnDelete", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_EXPANDSETTINGS, g_plugin.getByte("ExpandSettingsOnOpen", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_RESTORESETTINGS, g_plugin.getByte("RestoreOnOpen", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_WARNONDEL, g_plugin.getByte("WarnOnDelete", 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_POPUPS, g_bUsePopups ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, db_get_w(NULL, MODULENAME, "PopupDelay", 4), 0);
- SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(NULL, MODULENAME, "PopupColour", RGB(255, 0, 0)));
+ SetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, g_plugin.getWord("PopupDelay", 4), 0);
+ SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)g_plugin.getDword("PopupColour", RGB(255, 0, 0)));
TranslateDialogDefault(hwnd);
bInitDone = true;
return TRUE;
@@ -38,13 +38,13 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "ExpandSettingsOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_EXPANDSETTINGS));
- db_set_b(NULL, MODULENAME, "RestoreOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_RESTORESETTINGS));
- db_set_b(NULL, MODULENAME, "WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL));
+ g_plugin.setByte("ExpandSettingsOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_EXPANDSETTINGS));
+ g_plugin.setByte("RestoreOnOpen", (BYTE)IsDlgButtonChecked(hwnd, IDC_RESTORESETTINGS));
+ g_plugin.setByte("WarnOnDelete", (BYTE)IsDlgButtonChecked(hwnd, IDC_WARNONDEL));
g_bUsePopups = IsDlgButtonChecked(hwnd, IDC_POPUPS) != 0;
- db_set_b(NULL, MODULENAME, "UsePopUps", (BYTE)g_bUsePopups);
- db_set_w(NULL, MODULENAME, "PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0));
- db_set_dw(NULL, MODULENAME, "PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
+ g_plugin.setByte("UsePopUps", (BYTE)g_bUsePopups);
+ g_plugin.setWord("PopupDelay", (WORD)GetDlgItemInt(hwnd, IDC_POPUPTIMEOUT, nullptr, 0));
+ g_plugin.setDword("PopupColour", (DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0));
return TRUE;
}
break;
diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 488f881460..cb0359d930 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -43,7 +43,7 @@ static INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA GetDlgItemTextA(hwnd, IDC_MODNAME, modulename, _countof(modulename));
if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
// null contact
- db_set_b(NULL, modulename, "(Default)", 0);
+ db_set_b(0, modulename, "(Default)", 0);
for (auto &hContact : Contacts())
db_set_b(hContact, modulename, "(Default)", 0);
}
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index ccb766e9ae..c1804603f6 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -127,7 +127,7 @@ void DeleteSettingsFromList(MCONTACT hContact, const char *module, const char *s if (!count) return;
- if (db_get_b(NULL, MODULENAME, "WarnOnDelete", 1)) {
+ if (g_plugin.getByte("WarnOnDelete", 1)) {
wchar_t text[MSG_SIZE];
mir_snwprintf(text, TranslateT("Are you sure you want to delete setting(s): %d?"), count);
if (dlg(text, MB_YESNO | MB_ICONEXCLAMATION) == IDNO)
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 787354cc95..d117298fc9 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -348,9 +348,9 @@ void openWatchedVarWindow() void popupWatchedVar(MCONTACT hContact, const char *module, const char *setting)
{
- COLORREF colorBack = db_get_dw(NULL, MODULENAME, "PopupColour", RGB(255, 0, 0));
- COLORREF colorText = db_get_dw(NULL, MODULENAME, "PopupTextColour", RGB(0, 0, 0));
- int timeout = db_get_b(NULL, MODULENAME, "PopupDelay", 3);
+ COLORREF colorBack = g_plugin.getDword("PopupColour", RGB(255, 0, 0));
+ COLORREF colorText = g_plugin.getDword("PopupTextColour", RGB(0, 0, 0));
+ int timeout = g_plugin.getByte("PopupDelay", 3);
wchar_t name[NAME_SIZE], text[MAX_SECONDLINE], value[MAX_SECONDLINE];
GetContactName(hContact, nullptr, name, _countof(name));
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index ae17cb3e9f..8fd8a3e1c9 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -38,7 +38,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara DBVARIANT dbv = { 0 };
dbv.type = DBVT_ASCIIZ;
- int bCheck = db_get_b(NULL, MODULENAME, "Check", 1);
+ int bCheck = g_plugin.getByte("Check", 1);
wchar_t buffer[4096];
GetStringFromDatabase("Username", L"", buffer, _countof(buffer));
@@ -50,24 +50,24 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara GetStringFromDatabase("Server", L"", buffer, _countof(buffer));
SetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer);
- SetDlgItemInt(hWnd, IDC_PORT_EDIT, db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT), FALSE);
+ SetDlgItemInt(hWnd, IDC_PORT_EDIT, g_plugin.getDword("Port", EXCHANGE_PORT), FALSE);
- SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, db_get_dw(NULL, MODULENAME, "Interval", DEFAULT_INTERVAL), FALSE);
+ SetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, g_plugin.getDword("Interval", DEFAULT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_RECONNECT, (db_get_b(NULL, MODULENAME, "Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_RECONNECT, (g_plugin.getByte("Reconnect", 0)) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, db_get_dw(NULL, MODULENAME, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE);
- CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)db_get_b(NULL, MODULENAME, "UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, g_plugin.getDword("ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE);
+ CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)g_plugin.getByte("UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), ServiceExists(MS_POPUP_ADDPOPUPT)); //disable the popups checkbox if no popup module is present
CheckDlgButton(hWnd, IDC_CHECK_EMAILS, (bCheck) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_INTERVAL_EDIT), bCheck);
- int portCheck = db_get_b(NULL, MODULENAME, "UsePortCheck", 1);
+ int portCheck = g_plugin.getByte("UsePortCheck", 1);
CheckDlgButton(hWnd, IDC_USE_PORTCHECK, (portCheck) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PORT_EDIT), portCheck);
- int retries = db_get_b(NULL, MODULENAME, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
+ int retries = g_plugin.getByte("MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
SetDlgItemInt(hWnd, IDC_MAX_RETRIES, retries, FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_RECONNECT_INTERVAL), IsDlgButtonChecked(hWnd, IDC_RECONNECT));
@@ -108,30 +108,30 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS));
+ g_plugin.setByte("Check", IsDlgButtonChecked(hWnd, IDC_CHECK_EMAILS));
wchar_t buffer[4096];
GetDlgItemText(hWnd, IDC_USER_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, MODULENAME, "Username", buffer);
+ g_plugin.setWString("Username", buffer);
GetDlgItemText(hWnd, IDC_PASSWORD_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, MODULENAME, "Password", buffer);
+ g_plugin.setWString("Password", buffer);
GetDlgItemText(hWnd, IDC_SERVER_EDIT, buffer, _countof(buffer));
- db_set_ws(NULL, MODULENAME, "Server", buffer);
+ g_plugin.setWString("Server", buffer);
GetDlgItemText(hWnd, IDC_PORT_EDIT, buffer, _countof(buffer));
- db_set_dw(NULL, MODULENAME, "Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
+ g_plugin.setDword("Port", GetDlgItemInt(hWnd, IDC_PORT_EDIT, nullptr, FALSE));
- db_set_dw(NULL, MODULENAME, "Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE));
- db_set_dw(NULL, MODULENAME, "ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE));
+ g_plugin.setDword("Interval", GetDlgItemInt(hWnd, IDC_INTERVAL_EDIT, nullptr, FALSE));
+ g_plugin.setDword("ReconnectInterval", GetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
+ g_plugin.setByte("Reconnect", IsDlgButtonChecked(hWnd, IDC_RECONNECT));
- db_set_b(NULL, MODULENAME, "UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
- db_set_b(NULL, MODULENAME, "UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
+ g_plugin.setByte("UsePopups", IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
+ g_plugin.setByte("UsePortCheck", IsDlgButtonChecked(hWnd, IDC_USE_PORTCHECK));
- db_set_b(NULL, MODULENAME, "MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
+ g_plugin.setByte("MaxRetries", GetDlgItemInt(hWnd, IDC_MAX_RETRIES, nullptr, FALSE));
exchangeServer.Reconnect(); //login info may be changed
UpdateTimers(); //interval might get changed
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index b15f7a8932..dbf2e30884 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -36,7 +36,7 @@ CExchangeServer::~CExchangeServer() int CExchangeServer::Connect(int bForceConnect)
{
- int maxRetries = db_get_b(NULL, MODULENAME, "MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
+ int maxRetries = g_plugin.getByte("MaxRetries", MAX_EXCHANGE_CONNECT_RETRIES);
if (bForceConnect) {
bTryConnect = 1;
cConnections = 0;
@@ -67,7 +67,7 @@ int CExchangeServer::Connect(int bForceConnect) GetStringFromDatabase("Password", L"", password, _countof(password));
GetStringFromDatabase("Server", L"", server, _countof(server));
- int port = db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT);
+ int port = g_plugin.getDword("Port", EXCHANGE_PORT);
if (mir_wstrlen(server) > 0) //only connect if there's a server to connect to
return DoConnect(user, password, server, port);
@@ -139,13 +139,13 @@ void InitSocketAddr(sockaddr_in *addrServer, char *szServer) else
memcpy(&(addrServer->sin_addr), hp->h_addr, hp->h_length);
- int port = db_get_dw(NULL, MODULENAME, "Port", EXCHANGE_PORT);
+ int port = g_plugin.getDword("Port", EXCHANGE_PORT);
addrServer->sin_port = htons(port);
}
int CExchangeServer::IsServerAvailable()
{
- if (!db_get_b(NULL, MODULENAME, "UsePortCheck", 1))
+ if (!g_plugin.getByte("UsePortCheck", 1))
return 1;
SOCKET sServer = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -294,7 +294,7 @@ int CExchangeServer::Check(int bNoEmailsNotify) int ShowMessage(wchar_t *message, int cUnreadEmails)
{
- int usePopups = ServiceExists(MS_POPUP_ADDPOPUPT) ? db_get_b(NULL, MODULENAME, "UsePopups", 0) : 0;
+ int usePopups = ServiceExists(MS_POPUP_ADDPOPUPT) ? g_plugin.getByte("UsePopups", 0) : 0;
if (usePopups)
return ShowPopupMessage(TranslateT("Exchange email"), message, cUnreadEmails);
diff --git a/plugins/Exchange/src/hooked_events.cpp b/plugins/Exchange/src/hooked_events.cpp index a7a9c2f4f4..42b3cedd1c 100644 --- a/plugins/Exchange/src/hooked_events.cpp +++ b/plugins/Exchange/src/hooked_events.cpp @@ -93,14 +93,14 @@ int UpdateTimers() {
KillTimers();
int interval;
- interval = db_get_dw(NULL, MODULENAME, "Interval", DEFAULT_INTERVAL);
+ interval = g_plugin.getDword("Interval", DEFAULT_INTERVAL);
interval *= 1000; //go from miliseconds to seconds
hCheckTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnCheckTimer);
- int bReconnect = db_get_b(NULL, MODULENAME, "Reconnect", 0);
+ int bReconnect = g_plugin.getByte("Reconnect", 0);
if (bReconnect) //user wants to forcefully reconnect every x minutes
{
- interval = db_get_dw(NULL, MODULENAME, "ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
+ interval = g_plugin.getDword("ReconnectInterval", DEFAULT_RECONNECT_INTERVAL);
interval *= 1000 * 60; //go from miliseconds to seconds to minutes
hReconnectTimer = SetTimer(nullptr, 0, interval, (TIMERPROC) OnReconnectTimer);
}
@@ -132,7 +132,7 @@ VOID CALLBACK OnCheckTimer(HWND, UINT, UINT_PTR, DWORD) else{
exchangeServer.Connect();
}*/
- int bCheck = db_get_b(NULL, MODULENAME, "Check", 1);
+ int bCheck = g_plugin.getByte("Check", 1);
if (bCheck) //only check if we were told to
{
diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index 75b4ef4b93..d133aab166 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -113,7 +113,7 @@ int GetStringFromDatabase(char *szSettingName, wchar_t *szError, wchar_t *szResu DBVARIANT dbv = { 0 };
int res = 1;
dbv.type = DBVT_ASCIIZ;
- if (db_get_ws(NULL, MODULENAME, szSettingName, &dbv) == 0) {
+ if (g_plugin.getWString(szSettingName, &dbv) == 0) {
res = 0;
size_t tmp = mir_wstrlen(dbv.pwszVal);
size_t len = (tmp < size - 1) ? tmp : size - 1;
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index f9c39ae5b4..beb4d59c88 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -48,7 +48,7 @@ DBEntry *DBEntry::getNext(DBEntry *entry) for (; entryID < count; entryID++) {
int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", entryID, -1);
if (ftpNum != -1) {
- ptrA Value(db_get_sa(NULL, MODULENAME, frmt.Format("Filename%d", entryID)));
+ ptrA Value(g_plugin.getStringA(frmt.Format("Filename%d", entryID)));
if (Value) {
strncpy_s(szValue, Value, _TRUNCATE);
entry->m_fileID = entryID;
@@ -90,7 +90,7 @@ DBEntry* DBEntry::get(int fileID) int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", fileID, -1);
if (ftpNum != -1) {
- ptrA Value(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Filename%d", fileID)));
+ ptrA Value(g_plugin.getStringA(CMStringA(FORMAT, "Filename%d", fileID)));
if (Value) {
strncpy_s(szValue, Value, _TRUNCATE);
entry->m_fileID = fileID;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 01dd4374a7..18230a7b24 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -101,7 +101,7 @@ void InitMenuItems() CMStringA frmt;
for (int i = 0; i < ServerList::FTP_COUNT; i++) {
- ptrA Name(db_get_sa(NULL, MODULENAME, frmt.Format("Name%d", i)));
+ ptrA Name(g_plugin.getStringA(frmt.Format("Name%d", i)));
if (Name)
mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1);
diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index cb32cc66c4..b71aaaa0a1 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -33,32 +33,32 @@ void Options::deinit() void Options::loadOptions()
{
- selected = db_get_b(0, MODULENAME, "Selected", 0);
- defaultFTP = db_get_b(0, MODULENAME, "Default", 0);
- bAutosend = db_get_b(0, MODULENAME, "Autosend", 0) ? true : false;
- bCloseDlg = db_get_b(0, MODULENAME, "CloseDlg", 0) ? true : false;
- bCopyLink = db_get_b(0, MODULENAME, "CopyLink", 1) ? true : false;
- bUseSubmenu = db_get_b(0, MODULENAME, "UseSubmenu", 1) ? true : false;
- bHideInactive = db_get_b(0, MODULENAME, "HideInactive", 1) ? true : false;
- bAutoDelete = db_get_b(0, MODULENAME, "DeleteTimer", 0) ? true : false;
- iDeleteTime = db_get_dw(0, MODULENAME, "AutoDeleteTime", 60);
- timeRange = (ETimeRange)db_get_b(0, MODULENAME, "TimeRange", TR_MINUTES);
- iCompressionLevel = db_get_b(0, MODULENAME, "CompressionLevel", 6);
- bSetZipName = db_get_b(0, MODULENAME, "SetZipName", 0) ? true : false;
+ selected = g_plugin.getByte("Selected", 0);
+ defaultFTP = g_plugin.getByte("Default", 0);
+ bAutosend = g_plugin.getByte("Autosend", 0) ? true : false;
+ bCloseDlg = g_plugin.getByte("CloseDlg", 0) ? true : false;
+ bCopyLink = g_plugin.getByte("CopyLink", 1) ? true : false;
+ bUseSubmenu = g_plugin.getByte("UseSubmenu", 1) ? true : false;
+ bHideInactive = g_plugin.getByte("HideInactive", 1) ? true : false;
+ bAutoDelete = g_plugin.getByte("DeleteTimer", 0) ? true : false;
+ iDeleteTime = g_plugin.getDword("AutoDeleteTime", 60);
+ timeRange = (ETimeRange)g_plugin.getByte("TimeRange", TR_MINUTES);
+ iCompressionLevel = g_plugin.getByte("CompressionLevel", 6);
+ bSetZipName = g_plugin.getByte("SetZipName", 0) ? true : false;
}
void Options::saveOptions() const
{
- db_set_b(0, MODULENAME, "Autosend", bAutosend ? 1 : 0);
- db_set_b(0, MODULENAME, "CopyLink", bCopyLink ? 1 : 0);
- db_set_b(0, MODULENAME, "UseSubmenu", bUseSubmenu ? 1 : 0);
- db_set_b(0, MODULENAME, "HideInactive", bHideInactive ? 1 : 0);
- db_set_b(0, MODULENAME, "CloseDlg", bCloseDlg ? 1 : 0);
- db_set_b(0, MODULENAME, "DeleteTimer", bAutoDelete ? 1 : 0);
- db_set_dw(0, MODULENAME, "AutoDeleteTime", iDeleteTime);
- db_set_b(0, MODULENAME, "TimeRange", (int)timeRange);
- db_set_b(0, MODULENAME, "CompressionLevel", iCompressionLevel);
- db_set_b(0, MODULENAME, "SetZipName", bSetZipName ? 1 : 0);
+ g_plugin.setByte("Autosend", bAutosend ? 1 : 0);
+ g_plugin.setByte("CopyLink", bCopyLink ? 1 : 0);
+ g_plugin.setByte("UseSubmenu", bUseSubmenu ? 1 : 0);
+ g_plugin.setByte("HideInactive", bHideInactive ? 1 : 0);
+ g_plugin.setByte("CloseDlg", bCloseDlg ? 1 : 0);
+ g_plugin.setByte("DeleteTimer", bAutoDelete ? 1 : 0);
+ g_plugin.setDword("AutoDeleteTime", iDeleteTime);
+ g_plugin.setByte("TimeRange", (int)timeRange);
+ g_plugin.setByte("CompressionLevel", iCompressionLevel);
+ g_plugin.setByte("SetZipName", bSetZipName ? 1 : 0);
}
void Options::enableItems(HWND hwndDlg, bool state)
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index b29c263aef..33cce223ec 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -57,31 +57,31 @@ void ServerList::saveToDb() const DB::setWordF(0, MODULENAME, "Port%d", opt.selected, ftp->m_iPort);
DB::setByteF(0, MODULENAME, "Passive%d", opt.selected, ftp->m_bPassive);
DB::setByteF(0, MODULENAME, "Enabled%d", opt.selected, ftp->m_bEnabled);
- db_set_b(0, MODULENAME, "Selected", opt.selected);
- db_set_b(0, MODULENAME, "Default", opt.defaultFTP);
+ g_plugin.setByte("Selected", opt.selected);
+ g_plugin.setByte("Default", opt.defaultFTP);
}
ServerList::FTP::FTP(int index)
{
- ptrA Name(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Name%d", index)));
+ ptrA Name(g_plugin.getStringA(CMStringA(FORMAT, "Name%d", index)));
if (Name)
mir_snwprintf(m_stzName, TranslateT("FTP Server %d"), index + 1);
- ptrA Pass(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Password%d", index)));
+ ptrA Pass(g_plugin.getStringA(CMStringA(FORMAT, "Password%d", index)));
if (Pass)
strncpy_s(m_szPass, Pass, _TRUNCATE);
- ptrA Server(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Server%d", index)));
+ ptrA Server(g_plugin.getStringA(CMStringA(FORMAT, "Server%d", index)));
if (Server)
strncpy_s(m_szServer, Server, _TRUNCATE);
- ptrA User(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "User%d", index)));
+ ptrA User(g_plugin.getStringA(CMStringA(FORMAT, "User%d", index)));
if (User)
strncpy_s(m_szUser, User, _TRUNCATE);
- ptrA Url(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Url%d", index)));
+ ptrA Url(g_plugin.getStringA(CMStringA(FORMAT, "Url%d", index)));
if (Url)
strncpy_s(m_szUrl, Url, _TRUNCATE);
- ptrA Dir(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Dir%d", index)));
+ ptrA Dir(g_plugin.getStringA(CMStringA(FORMAT, "Dir%d", index)));
if (Dir)
strncpy_s(m_szDir, Dir, _TRUNCATE);
- ptrA Chmod(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Chmod%d", index)));
+ ptrA Chmod(g_plugin.getStringA(CMStringA(FORMAT, "Chmod%d", index)));
if (Chmod)
strncpy_s(m_szChmod, Chmod, _TRUNCATE);
m_ftpProto = (FTP::EProtoType)DB::getWordF(0, MODULENAME, "FtpProto%d", index, FTP::FT_STANDARD);
diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index e866115cd6..6b17c59f52 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -111,7 +111,7 @@ void Utils::curlSetOpt(CURL *hCurl, ServerList::FTP *ftp, char *url, struct curl if (ftp->m_bPassive)
curl_easy_setopt(hCurl, CURLOPT_FTPPORT, 0);
else {
- ptrA localip(db_get_sa(NULL, MODULENAME, "LocalIP"));
+ ptrA localip(g_plugin.getStringA("LocalIP"));
if (localip)
curl_easy_setopt(hCurl, CURLOPT_FTPPORT, localip);
else
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 15da617d05..2885c42007 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -498,7 +498,7 @@ int ShowMenu(bool centered) szMenu.cy = max(szMenu.cy, szColumn.cy);
szColumn.cx = szColumn.cy = 0;
- int maxWidth = GetSystemMetrics(SM_CXSCREEN) * db_get_b(NULL, "FavContacts", "MenuWidth", 66) / 100;
+ int maxWidth = GetSystemMetrics(SM_CXSCREEN) * db_get_b(0, "FavContacts", "MenuWidth", 66) / 100;
if (szMenu.cx > maxWidth) {
g_widthMultiplier = (float)maxWidth / szMenu.cx;
szMenu.cx *= g_widthMultiplier;
diff --git a/plugins/FavContacts/src/options.cpp b/plugins/FavContacts/src/options.cpp index 0a5fe13acb..1d341ddabe 100644 --- a/plugins/FavContacts/src/options.cpp +++ b/plugins/FavContacts/src/options.cpp @@ -22,36 +22,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void LoadOptions()
{
- g_Options.bSecondLine = db_get_b(NULL, "FavContacts", "SecondLine", 1);
- g_Options.bAvatars = db_get_b(NULL, "FavContacts", "Avatars", 1);
- g_Options.bAvatarBorder = db_get_b(NULL, "FavContacts", "AvatarBorder", 0);
- g_Options.wAvatarRadius = db_get_w(NULL, "FavContacts", "AvatarRadius", 3);
- g_Options.bNoTransparentBorder = db_get_b(NULL, "FavContacts", "NoTransparentBorder",
- !db_get_b(NULL, "FavContacts", "AvatarBorderTransparent", 1));
- g_Options.bSysColors = db_get_b(NULL, "FavContacts", "SysColors", 0);
- g_Options.bCenterHotkey = db_get_b(NULL, "FavContacts", "CenterHotkey", 1);
- g_Options.bUseGroups = db_get_b(NULL, "FavContacts", "UseGroups", 0);
- g_Options.bUseColumns = db_get_b(NULL, "FavContacts", "UseColumns", 1);
- g_Options.bRightAvatars = db_get_b(NULL, "FavContacts", "RightAvatars", 0);
- g_Options.bDimIdle = db_get_b(NULL, "FavContacts", "DimIdle", 1);
-
- g_Options.wMaxRecent = db_get_b(NULL, "FavContacts", "MaxRecent", 10);
+ g_Options.bSecondLine = db_get_b(0, "FavContacts", "SecondLine", 1);
+ g_Options.bAvatars = db_get_b(0, "FavContacts", "Avatars", 1);
+ g_Options.bAvatarBorder = db_get_b(0, "FavContacts", "AvatarBorder", 0);
+ g_Options.wAvatarRadius = db_get_w(0, "FavContacts", "AvatarRadius", 3);
+ g_Options.bNoTransparentBorder = db_get_b(0, "FavContacts", "NoTransparentBorder",
+ !db_get_b(0, "FavContacts", "AvatarBorderTransparent", 1));
+ g_Options.bSysColors = db_get_b(0, "FavContacts", "SysColors", 0);
+ g_Options.bCenterHotkey = db_get_b(0, "FavContacts", "CenterHotkey", 1);
+ g_Options.bUseGroups = db_get_b(0, "FavContacts", "UseGroups", 0);
+ g_Options.bUseColumns = db_get_b(0, "FavContacts", "UseColumns", 1);
+ g_Options.bRightAvatars = db_get_b(0, "FavContacts", "RightAvatars", 0);
+ g_Options.bDimIdle = db_get_b(0, "FavContacts", "DimIdle", 1);
+
+ g_Options.wMaxRecent = db_get_b(0, "FavContacts", "MaxRecent", 10);
}
static void sttSaveOptions()
{
- db_set_b(NULL, "FavContacts", "SecondLine", g_Options.bSecondLine);
- db_set_b(NULL, "FavContacts", "Avatars", g_Options.bAvatars);
- db_set_b(NULL, "FavContacts", "AvatarBorder", g_Options.bAvatarBorder);
- db_set_w(NULL, "FavContacts", "AvatarRadius", g_Options.wAvatarRadius);
- db_set_b(NULL, "FavContacts", "NoTransparentBorder", g_Options.bNoTransparentBorder);
- db_set_b(NULL, "FavContacts", "SysColors", g_Options.bSysColors);
- db_set_b(NULL, "FavContacts", "CenterHotkey", g_Options.bCenterHotkey);
- db_set_b(NULL, "FavContacts", "UseGroups", g_Options.bUseGroups);
- db_set_b(NULL, "FavContacts", "UseColumns", g_Options.bUseColumns);
- db_set_b(NULL, "FavContacts", "RightAvatars", g_Options.bRightAvatars);
- db_set_b(NULL, "FavContacts", "DimIdle", g_Options.bDimIdle);
- db_set_w(NULL, "FavContacts", "MaxRecent", g_Options.wMaxRecent);
+ db_set_b(0, "FavContacts", "SecondLine", g_Options.bSecondLine);
+ db_set_b(0, "FavContacts", "Avatars", g_Options.bAvatars);
+ db_set_b(0, "FavContacts", "AvatarBorder", g_Options.bAvatarBorder);
+ db_set_w(0, "FavContacts", "AvatarRadius", g_Options.wAvatarRadius);
+ db_set_b(0, "FavContacts", "NoTransparentBorder", g_Options.bNoTransparentBorder);
+ db_set_b(0, "FavContacts", "SysColors", g_Options.bSysColors);
+ db_set_b(0, "FavContacts", "CenterHotkey", g_Options.bCenterHotkey);
+ db_set_b(0, "FavContacts", "UseGroups", g_Options.bUseGroups);
+ db_set_b(0, "FavContacts", "UseColumns", g_Options.bUseColumns);
+ db_set_b(0, "FavContacts", "RightAvatars", g_Options.bRightAvatars);
+ db_set_b(0, "FavContacts", "DimIdle", g_Options.bDimIdle);
+ db_set_w(0, "FavContacts", "MaxRecent", g_Options.wMaxRecent);
}
static void sttResetListOptions(HWND hwndList)
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 327bbb7d59..1718722937 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -136,17 +136,17 @@ int RetrieveFileSize(wchar_t *filename) FILEECHO::FILEECHO(MCONTACT Contact)
{
hContact = Contact;
- dwSendInterval = db_get_dw(NULL, MODULENAME, "SendDelay", 6000);
+ dwSendInterval = g_plugin.getDword("SendDelay", 6000);
- chunkMaxLen = db_get_dw(NULL, MODULENAME, "ChunkSize", 5000);
+ chunkMaxLen = g_plugin.getDword("ChunkSize", 5000);
chunkCount = 0;
filename = nullptr;
- rgbRecv = db_get_dw(NULL, MODULENAME, "colorRecv", RGB(64, 255, 64));
- rgbSent = db_get_dw(NULL, MODULENAME, "colorSent", RGB(255, 255, 64));
- rgbUnSent = db_get_dw(NULL, MODULENAME, "colorUnsent", RGB(128, 128, 128));
- rgbToSend = db_get_dw(NULL, MODULENAME, "colorTosend", RGB(192, 192, 192));
- asBinary = db_get_dw(NULL, MODULENAME, "base64", 1) == 0;
+ rgbRecv = g_plugin.getDword("colorRecv", RGB(64, 255, 64));
+ rgbSent = g_plugin.getDword("colorSent", RGB(255, 255, 64));
+ rgbUnSent = g_plugin.getDword("colorUnsent", RGB(128, 128, 128));
+ rgbToSend = g_plugin.getDword("colorTosend", RGB(192, 192, 192));
+ asBinary = g_plugin.getDword("base64", 1) == 0;
}
uint controlEnabled[][2] =
@@ -235,7 +235,7 @@ int FILEECHO::createTransfer() #ifdef DEBUG
overhead = 0;
#endif
- BYTE bAuto = db_get_b(NULL, "SRFile", "AutoAccept", 0);
+ BYTE bAuto = db_get_b(0, "SRFile", "AutoAccept", 0);
hFile = CreateFileA(filename, inSend ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE), inSend ? FILE_SHARE_READ : 0, nullptr, inSend ? OPEN_EXISTING : (bAuto ? CREATE_ALWAYS : CREATE_NEW), FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE && !inSend && GetLastError() == ERROR_FILE_EXISTS) {
@@ -404,8 +404,8 @@ void FILEECHO::incomeRequest(char *param) inSend = FALSE;
Skin_PlaySound("RecvFile");
- int AutoMin = db_get_b(NULL, "SRFile", "AutoMin", 0);
- if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
+ int AutoMin = db_get_b(0, "SRFile", "AutoMin", 0);
+ if (db_get_b(0, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
PostMessage(hDlg, WM_COMMAND, IDC_PLAY, 0);
if (AutoMin)
ShowWindow(hDlg, SW_SHOWMINIMIZED);
@@ -486,7 +486,7 @@ void FILEECHO::onRecvTimer() SetDlgItemText(hDlg, IDC_STATUS, msg);
MakePopupMsg(hDlg, hContact, msg);
setState(STATE_FINISHED);
- if (db_get_b(NULL, "SRFile", "AutoClose", 0)) {
+ if (db_get_b(0, "SRFile", "AutoClose", 0)) {
PostMessage(hDlg, WM_CLOSE, 0, 0);
g_clistApi.pfnRemoveEvent(hContact, 0);
}
diff --git a/plugins/FileAsMessage/src/optionsdlg.cpp b/plugins/FileAsMessage/src/optionsdlg.cpp index 2a1a2d0786..c1d6be2df8 100644 --- a/plugins/FileAsMessage/src/optionsdlg.cpp +++ b/plugins/FileAsMessage/src/optionsdlg.cpp @@ -44,11 +44,11 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (int indx = 0; indx < _countof(settingId); indx++)
if (settingId[indx] > 0)
- SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULENAME, settingName[indx], settingDefault[indx]));
+ SendDlgItemMessage(hwndDlg, settingId[indx], CPM_SETCOLOUR, 0, g_plugin.getDword(settingName[indx], settingDefault[indx]));
else
- SetDlgItemInt(hwndDlg, -settingId[indx], db_get_dw(NULL, MODULENAME, settingName[indx], settingDefault[indx]), FALSE);
+ SetDlgItemInt(hwndDlg, -settingId[indx], g_plugin.getDword(settingName[indx], settingDefault[indx]), FALSE);
- CheckDlgButton(hwndDlg, IDC_ALPHANUM, db_get_dw(NULL, MODULENAME, "base64", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALPHANUM, g_plugin.getDword("base64", 1) ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
@@ -93,9 +93,9 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l value = GetDlgItemInt(hwndDlg, -settingId[indx], &succ, FALSE);
if (!succ) value = settingDefault[indx];
}
- db_set_dw(NULL, MODULENAME, settingName[indx], value);
+ g_plugin.setDword(settingName[indx], value);
}
- db_set_dw(NULL, MODULENAME, "base64", (IsDlgButtonChecked(hwndDlg, IDC_ALPHANUM) == BST_CHECKED) ? 1 : 0);
+ g_plugin.setDword("base64", (IsDlgButtonChecked(hwndDlg, IDC_ALPHANUM) == BST_CHECKED) ? 1 : 0);
return TRUE;
}
diff --git a/plugins/FingerprintNG/src/finger_groups.h b/plugins/FingerprintNG/src/finger_groups.h index c0ef7d0c1b..99cad38788 100644 --- a/plugins/FingerprintNG/src/finger_groups.h +++ b/plugins/FingerprintNG/src/finger_groups.h @@ -1,110 +1,110 @@ case MIRANDA_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupMiranda", 1))
+ if (g_plugin.getByte("GroupMiranda", 1))
return LPGENW("Client icons") L"/" LPGENW("Miranda clients");
break;
case MIRANDA_VERSION_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupMirandaVersion", 1))
+ if (g_plugin.getByte("GroupMirandaVersion", 1))
return LPGENW("Client icons") L"/" LPGENW("Miranda clients");
break;
case MIRANDA_PACKS_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupMirandaPacks", 1))
+ if (g_plugin.getByte("GroupMirandaPacks", 1))
return LPGENW("Client icons") L"/" LPGENW("Miranda clients") L"/" LPGENW("Pack overlays");
break;
case MULTI_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupMulti", 1))
+ if (g_plugin.getByte("GroupMulti", 1))
return LPGENW("Client icons") L"/" LPGENW("Multi-proto clients");
break;
case GG_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupGG", 1))
+ if (g_plugin.getByte("GroupGG", 1))
return LPGENW("Client icons") L"/" LPGENW("Gadu-Gadu clients");
break;
case ICQ_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupICQ", 1))
+ if (g_plugin.getByte("GroupICQ", 1))
return LPGENW("Client icons") L"/" LPGENW("ICQ clients");
break;
case IRC_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupIRC", 1))
+ if (g_plugin.getByte("GroupIRC", 1))
return LPGENW("Client icons") L"/" LPGENW("IRC clients");
break;
case JABBER_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupJabber", 1))
+ if (g_plugin.getByte("GroupJabber", 1))
return LPGENW("Client icons") L"/" LPGENW("Jabber clients");
break;
case MRA_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupMRA", 1))
+ if (g_plugin.getByte("GroupMRA", 1))
return LPGENW("Client icons") L"/" LPGENW("MRA clients");
break;
case MSN_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupMSN", 1))
+ if (g_plugin.getByte("GroupMSN", 1))
return LPGENW("Client icons") L"/" LPGENW("MSN clients");
break;
case QQ_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupQQ", 1))
+ if (g_plugin.getByte("GroupQQ", 1))
return LPGENW("Client icons") L"/" LPGENW("QQ clients");
break;
case RSS_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupRSS", 1))
+ if (g_plugin.getByte("GroupRSS", 1))
return LPGENW("Client icons") L"/" LPGENW("RSS clients");
break;
case WEATHER_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupWeather", 1))
+ if (g_plugin.getByte("GroupWeather", 1))
return LPGENW("Client icons") L"/" LPGENW("Weather clients");
break;
case FACEBOOK_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupFacebook", 1))
+ if (g_plugin.getByte("GroupFacebook", 1))
return LPGENW("Client icons") L"/" LPGENW("Facebook clients");
break;
case VK_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupVK", 1))
+ if (g_plugin.getByte("GroupVK", 1))
return LPGENW("Client icons") L"/" LPGENW("VKontakte clients");
break;
case OTHER_PROTOS_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOtherProtos", 1))
+ if (g_plugin.getByte("GroupOtherProtos", 1))
return LPGENW("Client icons") L"/" LPGENW("Other protocols");
break;
case OTHERS_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOthers", 1))
+ if (g_plugin.getByte("GroupOthers", 1))
return LPGENW("Client icons") L"/" LPGENW("Other icons");
break;
case OVERLAYS_RESOURCE_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOverlaysResource", 1))
+ if (g_plugin.getByte("GroupOverlaysResource", 1))
return LPGENW("Client icons") L"/" LPGENW("Overlays") L"/" LPGENW("Resource");
break;
case OVERLAYS_PLATFORM_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOverlaysPlatform", 1))
+ if (g_plugin.getByte("GroupOverlaysPlatform", 1))
return LPGENW("Client icons") L"/" LPGENW("Overlays") L"/" LPGENW("Platform");
break;
case OVERLAYS_UNICODE_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOverlaysUnicode", 1))
+ if (g_plugin.getByte("GroupOverlaysUnicode", 1))
return LPGENW("Client icons") L"/" LPGENW("Overlays") L"/" LPGENW("Platform");
break;
case OVERLAYS_SECURITY_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOverlaysSecurity", 1))
+ if (g_plugin.getByte("GroupOverlaysSecurity", 1))
return LPGENW("Client icons") L"/" LPGENW("Overlays") L"/" LPGENW("Security");
break;
case OVERLAYS_PROTO_CASE:
- if (db_get_b(NULL, MODULENAME, "GroupOverlaysProtos", 1))
+ if (g_plugin.getByte("GroupOverlaysProtos", 1))
return LPGENW("Client icons") L"/" LPGENW("Overlays") L"/" LPGENW("Protocol");
break;
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 4b41598829..9e40f0641a 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -113,7 +113,7 @@ void RegisterIcons() for (i = 0; i < DEFAULT_KN_FP_OVERLAYS_COUNT; i++) Prepare(&def_kn_fp_overlays_mask[i], true); - if (db_get_b(NULL, MODULENAME, "GroupMirandaVersion", 0)) { + if (g_plugin.getByte("GroupMirandaVersion", 0)) { for (i = 0; i < DEFAULT_KN_FP_OVERLAYS2_COUNT; i++) Prepare(&def_kn_fp_overlays2_mask[i], true); } @@ -124,7 +124,7 @@ void RegisterIcons() Prepare(&def_kn_fp_overlays2_mask[i], false); } - if (db_get_b(NULL, MODULENAME, "GroupOverlaysUnicode", 1)) { + if (g_plugin.getByte("GroupOverlaysUnicode", 1)) { for (i = 0; i < DEFAULT_KN_FP_OVERLAYS3_COUNT; i++) Prepare(&def_kn_fp_overlays3_mask[i], true); } @@ -855,7 +855,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) { - if (!db_get_b(NULL, MODULENAME, "StatusBarIcon", 1)) + if (!g_plugin.getByte("StatusBarIcon", 1)) return 0; MessageWindowEventData *event = (MessageWindowEventData *)lParam; @@ -895,7 +895,7 @@ int OnModulesLoaded(WPARAM, LPARAM) RegisterIcons(); - if (db_get_b(NULL, MODULENAME, "StatusBarIcon", 1)) { + if (g_plugin.getByte("StatusBarIcon", 1)) { StatusIconData sid = {}; sid.szModule = MODULENAME; sid.flags = MBF_HIDDEN; diff --git a/plugins/FingerprintNG/src/options.cpp b/plugins/FingerprintNG/src/options.cpp index 1e14f09a36..223157e8e0 100644 --- a/plugins/FingerprintNG/src/options.cpp +++ b/plugins/FingerprintNG/src/options.cpp @@ -65,12 +65,12 @@ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); static void LoadDBCheckState(HWND hwndDlg, int idCtrl, LPCSTR szSetting, BYTE bDef)
{
- CheckDlgButton(hwndDlg, idCtrl, db_get_b(NULL, MODULENAME, szSetting, bDef) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, idCtrl, g_plugin.getByte(szSetting, bDef) ? BST_CHECKED : BST_UNCHECKED);
}
static void StoreDBCheckState(HWND hwndDlg, int idCtrl, LPCSTR szSetting)
{
- db_set_b(NULL, MODULENAME, szSetting, (BYTE)IsDlgButtonChecked(hwndDlg, idCtrl));
+ g_plugin.setByte(szSetting, (BYTE)IsDlgButtonChecked(hwndDlg, idCtrl));
}
static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index f2dbe2f004..bb91bc2d10 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -278,26 +278,26 @@ static int OnPrebuildContactMenu(WPARAM wParam, LPARAM) static void LoadDBSettings()
{
- fcOpt.thumbAlpha = (BYTE)((double)db_get_b(NULL, MODULE, "Opacity", 100) * 2.55);
- fcOpt.bHideOffline = (BOOL)db_get_b(NULL, MODULE, "HideOffline", 0);
- fcOpt.bHideAll = (BOOL)db_get_b(NULL, MODULE, "HideAll", 0);
- fcOpt.bHideWhenFullscreen = (BOOL)db_get_b(NULL, MODULE, "HideWhenFullscreen", 0);
- fcOpt.bMoveTogether = (BOOL)db_get_b(NULL, MODULE, "MoveTogether", 0);
- fcOpt.bFixedWidth = (BOOL)db_get_b(NULL, MODULE, "FixedWidth", 0);
- fcOpt.nThumbWidth = (DWORD)db_get_dw(NULL, MODULE, "Width", 0);
- dwOfflineModes = db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
- fcOpt.bShowTip = (BOOL)db_get_b(NULL, MODULE, "ShowTip", 1);
- fcOpt.TimeIn = (WORD)db_get_w(NULL, MODULE, "TimeIn", 0);
- fcOpt.bToTop = (BOOL)db_get_b(NULL, MODULE, "ToTop", 0);
- fcOpt.ToTopTime = (WORD)db_get_w(NULL, MODULE, "ToTopTime", TOTOPTIME_DEF);
- fcOpt.bHideWhenCListShow = (BOOL)db_get_b(NULL, MODULE, "HideWhenCListShow", 0);
- fcOpt.bUseSingleClick = (BOOL)db_get_b(NULL, MODULE, "UseSingleClick", 0);
- fcOpt.bShowIdle = (BOOL)db_get_b(NULL, MODULE, "ShowIdle", 0);
-
- if (db_get_b(NULL, "ModernData", "HideBehind", 0))
- bIsCListShow = (db_get_b(NULL, "ModernData", "BehindEdge", 0) == 0);
+ fcOpt.thumbAlpha = (BYTE)((double)g_plugin.getByte("Opacity", 100) * 2.55);
+ fcOpt.bHideOffline = (BOOL)g_plugin.getByte("HideOffline", 0);
+ fcOpt.bHideAll = (BOOL)g_plugin.getByte("HideAll", 0);
+ fcOpt.bHideWhenFullscreen = (BOOL)g_plugin.getByte("HideWhenFullscreen", 0);
+ fcOpt.bMoveTogether = (BOOL)g_plugin.getByte("MoveTogether", 0);
+ fcOpt.bFixedWidth = (BOOL)g_plugin.getByte("FixedWidth", 0);
+ fcOpt.nThumbWidth = (DWORD)g_plugin.getDword("Width", 0);
+ dwOfflineModes = db_get_dw(0, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
+ fcOpt.bShowTip = (BOOL)g_plugin.getByte("ShowTip", 1);
+ fcOpt.TimeIn = g_plugin.getWord("TimeIn", 0);
+ fcOpt.bToTop = (BOOL)g_plugin.getByte("ToTop", 0);
+ fcOpt.ToTopTime = g_plugin.getWord("ToTopTime", TOTOPTIME_DEF);
+ fcOpt.bHideWhenCListShow = (BOOL)g_plugin.getByte("HideWhenCListShow", 0);
+ fcOpt.bUseSingleClick = (BOOL)g_plugin.getByte("UseSingleClick", 0);
+ fcOpt.bShowIdle = (BOOL)g_plugin.getByte("ShowIdle", 0);
+
+ if (db_get_b(0, "ModernData", "HideBehind", 0))
+ bIsCListShow = (db_get_b(0, "ModernData", "BehindEdge", 0) == 0);
else
- bIsCListShow = (db_get_b(NULL, "CList", "State", 0) == 2);
+ bIsCListShow = (db_get_b(0, "CList", "State", 0) == 2);
}
void SendMsgDialog(HWND hwnd, wchar_t *pText)
@@ -529,7 +529,7 @@ static void CreateThumbsFont() static void CreateBackgroundBrush()
{
- bkColor = db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR);
+ bkColor = g_plugin.getDword("BkColor", FLT_DEFAULT_BKGNDCOLOR);
if (nullptr != hLTEdgesPen) {
DeleteObject(hLTEdgesPen);
@@ -552,19 +552,19 @@ static void CreateBackgroundBrush() hBkBrush = nullptr;
}
- if (db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
- COLORREF cr = (COLORREF)db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
+ if (g_plugin.getByte("DrawBorder", FLT_DEFAULT_DRAWBORDER)) {
+ COLORREF cr = (COLORREF)g_plugin.getDword("LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR);
hLTEdgesPen = CreatePen(PS_SOLID, 1, cr);
- cr = (COLORREF)db_get_dw(NULL, MODULE, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
+ cr = (COLORREF)g_plugin.getDword("RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR);
hRBEdgesPen = CreatePen(PS_SOLID, 1, cr);
}
- if (db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
+ if (g_plugin.getByte("BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP)) {
ptrW tszBitmapName(db_get_wsa(NULL, MODULE, "BkBitmap"));
if (tszBitmapName != NULL)
hBmpBackground = Bitmap_Load(tszBitmapName);
}
- nBackgroundBmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
+ nBackgroundBmpUse = (WORD)g_plugin.getWord("BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
// Create brush
hBkBrush = CreateSolidBrush(bkColor);
@@ -676,7 +676,7 @@ static IconItemT g_iconList[] = static INT_PTR OnMainMenu_HideAll(WPARAM, LPARAM)
{
fcOpt.bHideAll = !fcOpt.bHideAll;
- db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+ g_plugin.setByte("HideAll", (BYTE)fcOpt.bHideAll);
OnStatusChanged();
@@ -700,7 +700,7 @@ static INT_PTR OnContactMenu_Remove(WPARAM hContact, LPARAM) static INT_PTR OnHotKey_HideWhenCListShow(WPARAM, LPARAM)
{
fcOpt.bHideWhenCListShow = !fcOpt.bHideWhenCListShow;
- db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
+ g_plugin.setByte("HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
OnStatusChanged();
return 0;
}
@@ -831,9 +831,9 @@ static LRESULT __stdcall newMirandaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, HideThumbsOnShowCList();
}
else if (!(wp->flags & SWP_NOMOVE)) {
- BYTE method = db_get_b(NULL, "ModernData", "HideBehind", 0);
+ BYTE method = db_get_b(0, "ModernData", "HideBehind", 0);
if (method) {
- WORD wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", 0);
+ WORD wBehindEdgeBorderSize = db_get_w(0, "ModernData", "HideBehindBorderSize", 0);
RECT rc = { wp->x, wp->y, wp->x + wp->cx, wp->y + wp->cy };
RECT rcScr = { wBehindEdgeBorderSize*(2 - method), 0, GetSystemMetrics(SM_CXSCREEN) - wBehindEdgeBorderSize * (method - 1), GetSystemMetrics(SM_CYSCREEN) };
RECT rcOverlap;
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index 6f80b462eb..d90b9ca700 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -105,43 +105,43 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case PSN_APPLY:
BOOL bSuccess = FALSE;
- fcOpt.bHideOffline = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_OFFLINE);
- db_set_b(NULL, MODULE, "HideOffline", (BYTE)fcOpt.bHideOffline);
+ fcOpt.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_OFFLINE);
+ g_plugin.setByte("HideOffline", (BYTE)fcOpt.bHideOffline);
- fcOpt.bHideAll = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_ALL);
- db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+ fcOpt.bHideAll = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_ALL);
+ g_plugin.setByte("HideAll", (BYTE)fcOpt.bHideAll);
- fcOpt.bHideWhenFullscreen = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN);
- db_set_b(NULL, MODULE, "HideWhenFullscreen", (BYTE)fcOpt.bHideWhenFullscreen);
+ fcOpt.bHideWhenFullscreen = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_FULSCREEN);
+ g_plugin.setByte("HideWhenFullscreen", (BYTE)fcOpt.bHideWhenFullscreen);
- fcOpt.bMoveTogether = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_STICK);
- db_set_b(NULL, MODULE, "MoveTogether", (BYTE)fcOpt.bMoveTogether);
+ fcOpt.bMoveTogether = IsDlgButtonChecked(hwndDlg, IDC_CHK_STICK);
+ g_plugin.setByte("MoveTogether", (BYTE)fcOpt.bMoveTogether);
- fcOpt.bFixedWidth = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
- db_set_b(NULL, MODULE, "FixedWidth", (BYTE)fcOpt.bFixedWidth);
+ fcOpt.bFixedWidth = IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
+ g_plugin.setByte("FixedWidth", (BYTE)fcOpt.bFixedWidth);
fcOpt.nThumbWidth = GetDlgItemInt(hwndDlg, IDC_TXT_WIDTH, &bSuccess, FALSE);
- db_set_dw(NULL, MODULE, "Width", fcOpt.nThumbWidth);
+ g_plugin.setDword("Width", fcOpt.nThumbWidth);
if (bEnableTip) {
- fcOpt.bShowTip = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
- db_set_b(NULL, MODULE, "ShowTip", (BYTE)fcOpt.bShowTip);
+ fcOpt.bShowTip = IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
+ g_plugin.setByte("ShowTip", (BYTE)fcOpt.bShowTip);
fcOpt.TimeIn = GetDlgItemInt(hwndDlg, IDC_TXT_TIMEIN, &bSuccess, FALSE);
- db_set_w(NULL, MODULE, "TimeIn", fcOpt.TimeIn);
+ g_plugin.setWord("TimeIn", fcOpt.TimeIn);
}
- fcOpt.bToTop = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
- db_set_b(NULL, MODULE, "ToTop", (BYTE)fcOpt.bToTop);
+ fcOpt.bToTop = IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
+ g_plugin.setByte("ToTop", (BYTE)fcOpt.bToTop);
fcOpt.ToTopTime = GetDlgItemInt(hwndDlg, IDC_TXT_TOTOPTIME, &bSuccess, FALSE);
- db_set_w(NULL, MODULE, "ToTopTime", fcOpt.ToTopTime);
+ g_plugin.setWord("ToTopTime", fcOpt.ToTopTime);
- fcOpt.bHideWhenCListShow = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
- db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
+ fcOpt.bHideWhenCListShow = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
+ g_plugin.setByte("HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
- fcOpt.bUseSingleClick = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SINGLECLK);
- db_set_b(NULL, MODULE, "UseSingleClick", (BYTE)fcOpt.bUseSingleClick);
+ fcOpt.bUseSingleClick = IsDlgButtonChecked(hwndDlg, IDC_CHK_SINGLECLK);
+ g_plugin.setByte("UseSingleClick", (BYTE)fcOpt.bUseSingleClick);
- fcOpt.bShowIdle = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWIDLE);
- db_set_b(NULL, MODULE, "ShowIdle", (BYTE)fcOpt.bShowIdle);
+ fcOpt.bShowIdle = IsDlgButtonChecked(hwndDlg, IDC_CHK_SHOWIDLE);
+ g_plugin.setByte("ShowIdle", (BYTE)fcOpt.bShowIdle);
ApplyOptionsChanges();
OnStatusChanged();
@@ -164,19 +164,19 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
// Border
- CheckDlgButton(hwndDlg, IDC_DRAWBORDER, db_get_b(NULL, MODULE, "DrawBorder", FLT_DEFAULT_DRAWBORDER) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DRAWBORDER, g_plugin.getByte("DrawBorder", FLT_DEFAULT_DRAWBORDER) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, M_REFRESHBORDERPICKERS, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_LTEDGESCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULE, "LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR));
+ SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_SETCOLOUR, 0, g_plugin.getDword("LTEdgesColor", FLT_DEFAULT_LTEDGESCOLOR));
SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_RBEDGESCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULE, "RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR));
+ SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_SETCOLOUR, 0, g_plugin.getDword("RBEdgesColor", FLT_DEFAULT_RBEDGESCOLOR));
// Background
CheckDlgButton(hwndDlg, IDC_CHK_WIDTH, (fcOpt.bFixedWidth ? BST_CHECKED : BST_UNCHECKED));
SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, FLT_DEFAULT_BKGNDCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULE, "BkColor", FLT_DEFAULT_BKGNDCOLOR));
- CheckDlgButton(hwndDlg, IDC_BITMAP, db_get_b(NULL, MODULE, "BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, g_plugin.getDword("BkColor", FLT_DEFAULT_BKGNDCOLOR));
+ CheckDlgButton(hwndDlg, IDC_BITMAP, g_plugin.getByte("BkUseBitmap", FLT_DEFAULT_BKGNDUSEBITMAP) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
{
DBVARIANT dbv;
@@ -185,7 +185,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP db_free(&dbv);
}
- WORD bmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
+ WORD bmpUse = (WORD)g_plugin.getWord("BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
CheckDlgButton(hwndDlg, IDC_STRETCHH, ((bmpUse & CLB_STRETCHH) ? BST_CHECKED : BST_UNCHECKED));
CheckDlgButton(hwndDlg, IDC_STRETCHV, ((bmpUse & CLB_STRETCHV) ? BST_CHECKED : BST_UNCHECKED));
CheckDlgButton(hwndDlg, IDC_TILEH, ((bmpUse & CLBF_TILEH) ? BST_CHECKED : BST_UNCHECKED));
@@ -195,7 +195,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
// Windows 2K/XP
- BYTE btOpacity = (BYTE)db_get_b(NULL, MODULE, "Opacity", 100);
+ BYTE btOpacity = (BYTE)g_plugin.getByte("Opacity", 100);
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
@@ -280,30 +280,30 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (0 == ((LPNMHDR)lParam)->idFrom) {
switch (((LPNMHDR)lParam)->code) {
case PSN_RESET:
- fcOpt.thumbAlpha = (BYTE)((double)db_get_b(NULL, MODULE, "Opacity", 100) * 2.55);
+ fcOpt.thumbAlpha = (BYTE)((double)g_plugin.getByte("Opacity", 100) * 2.55);
SetThumbsOpacity(fcOpt.thumbAlpha);
break;
case PSN_APPLY:
// Border
- db_set_b(NULL, MODULE, "DrawBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER));
+ g_plugin.setByte("DrawBorder", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DRAWBORDER));
COLORREF col = SendDlgItemMessage(hwndDlg, IDC_LTEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULE, "LTEdgesColor", col);
+ g_plugin.setDword("LTEdgesColor", col);
col = SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULE, "RBEdgesColor", col);
+ g_plugin.setDword("RBEdgesColor", col);
- db_set_b(NULL, MODULE, "Opacity", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0));
+ g_plugin.setByte("Opacity", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0));
// Backgroud
col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULE, "BkColor", col);
+ g_plugin.setDword("BkColor", col);
- db_set_b(NULL, MODULE, "BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
+ g_plugin.setByte("BkUseBitmap", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BITMAP));
wchar_t str[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILENAME, str, _countof(str));
- db_set_ws(NULL, MODULE, "BkBitmap", str);
+ g_plugin.setWString("BkBitmap", str);
WORD flags = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_STRETCHH))
@@ -316,7 +316,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP flags |= CLBF_TILEV;
if (IsDlgButtonChecked(hwndDlg, IDC_PROPORTIONAL))
flags |= CLBF_PROPORTIONAL;
- db_set_w(NULL, MODULE, "BkBitmapOpt", flags);
+ g_plugin.setWord("BkBitmapOpt", flags);
ApplyOptionsChanges();
OnStatusChanged();
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index 35d718798b..a309e7ddaa 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -128,5 +128,5 @@ void CFolderItem::WriteDataToDatabase() strcat_s(szSettingName, sizeof(szSettingName), m_szName);
if (m_tszFormat)
- db_set_ws(NULL, ModuleName, szSettingName, m_tszFormat);
+ db_set_ws(0, ModuleName, szSettingName, m_tszFormat);
}
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index e894e5c6d5..8131aaf905 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -99,24 +99,24 @@ int CMPlugin::Load() CreateProtoServiceFunction(MODULENAME, PS_GETNAME, GetName);
CreateServiceFunction("GmailMNotifier/Notifying", Notifying);
- opt.circleTime = db_get_dw(NULL, MODULENAME, "circleTime", 30);
- opt.notifierOnTray = db_get_dw(NULL, MODULENAME, "notifierOnTray", TRUE);
- opt.notifierOnPop = db_get_dw(NULL, MODULENAME, "notifierOnPop", TRUE);
- opt.popupDuration = db_get_dw(NULL, MODULENAME, "popupDuration", -1);
- opt.popupBgColor = db_get_dw(NULL, MODULENAME, "popupBgColor", RGB(173, 206, 247));
- opt.popupTxtColor = db_get_dw(NULL, MODULENAME, "popupTxtColor", RGB(0, 0, 0));
- opt.OpenUsePrg = db_get_dw(NULL, MODULENAME, "OpenUsePrg", 0);
- opt.ShowCustomIcon = db_get_dw(NULL, MODULENAME, "ShowCustomIcon", FALSE);
- opt.UseOnline = db_get_dw(NULL, MODULENAME, "UseOnline", FALSE);
- opt.AutoLogin = db_get_dw(NULL, MODULENAME, "AutoLogin", TRUE);
- opt.LogThreads = db_get_dw(NULL, MODULENAME, "LogThreads", FALSE);
+ opt.circleTime = g_plugin.getDword("circleTime", 30);
+ opt.notifierOnTray = g_plugin.getDword("notifierOnTray", TRUE);
+ opt.notifierOnPop = g_plugin.getDword("notifierOnPop", TRUE);
+ opt.popupDuration = g_plugin.getDword("popupDuration", -1);
+ opt.popupBgColor = g_plugin.getDword("popupBgColor", RGB(173, 206, 247));
+ opt.popupTxtColor = g_plugin.getDword("popupTxtColor", RGB(0, 0, 0));
+ opt.OpenUsePrg = g_plugin.getDword("OpenUsePrg", 0);
+ opt.ShowCustomIcon = g_plugin.getDword("ShowCustomIcon", FALSE);
+ opt.UseOnline = g_plugin.getDword("UseOnline", FALSE);
+ opt.AutoLogin = g_plugin.getDword("AutoLogin", TRUE);
+ opt.LogThreads = g_plugin.getDword("LogThreads", FALSE);
DBVARIANT dbv;
- if (db_get_s(NULL, "SkinIcons", "core_status_" MODULENAME "4", &dbv)) {
- db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "0", "plugins\\GmailNotifier.dll,2");
- db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "1", "plugins\\GmailNotifier.dll,2");
- db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "2", "plugins\\GmailNotifier.dll,0");
- db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "4", "plugins\\GmailNotifier.dll,1");
+ if (db_get_s(0, "SkinIcons", "core_status_" MODULENAME "4", &dbv)) {
+ db_set_s(0, "SkinIcons", "core_status_" MODULENAME "0", "plugins\\GmailNotifier.dll,2");
+ db_set_s(0, "SkinIcons", "core_status_" MODULENAME "1", "plugins\\GmailNotifier.dll,2");
+ db_set_s(0, "SkinIcons", "core_status_" MODULENAME "2", "plugins\\GmailNotifier.dll,0");
+ db_set_s(0, "SkinIcons", "core_status_" MODULENAME "4", "plugins\\GmailNotifier.dll,1");
}
else db_free(&dbv);
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 720bc9aa01..e9bc4bab5c 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -84,7 +84,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
{
DBVARIANT dbv;
- if (!db_get_s(NULL, MODULENAME, "OpenUsePrgPath", &dbv)) {
+ if (!g_plugin.getString("OpenUsePrgPath", &dbv)) {
mir_strcpy(str, dbv.pszVal);
db_free(&dbv);
}
@@ -216,20 +216,20 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (opt.circleTime > 0) {
KillTimer(nullptr, hTimer);
hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc);
- db_set_dw(NULL, MODULENAME, "circleTime", opt.circleTime);
+ g_plugin.setDword("circleTime", opt.circleTime);
}
opt.notifierOnTray = IsDlgButtonChecked(hwndDlg, IDC_OPTTRAY);
opt.notifierOnPop = IsDlgButtonChecked(hwndDlg, IDC_OPTPOP);
- db_set_dw(NULL, MODULENAME, "notifierOnTray", opt.notifierOnTray);
- db_set_dw(NULL, MODULENAME, "notifierOnPop", opt.notifierOnPop);
+ g_plugin.setDword("notifierOnTray", opt.notifierOnTray);
+ g_plugin.setDword("notifierOnPop", opt.notifierOnPop);
opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, nullptr, TRUE);
- db_set_dw(NULL, MODULENAME, "popupDuration", opt.popupDuration);
+ g_plugin.setDword("popupDuration", opt.popupDuration);
opt.popupBgColor = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor);
opt.popupTxtColor = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor);
- db_set_dw(NULL, MODULENAME, "popupBgColor", opt.popupBgColor);
- db_set_dw(NULL, MODULENAME, "popupTxtColor", opt.popupTxtColor);
+ g_plugin.setDword("popupBgColor", opt.popupBgColor);
+ g_plugin.setDword("popupTxtColor", opt.popupTxtColor);
if (IsDlgButtonChecked(hwndDlg, IDC_SYSDEF) == BST_CHECKED)
opt.OpenUsePrg = 0;
@@ -240,8 +240,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
GetDlgItemTextA(hwndDlg, IDC_PRG, str, _countof(str));
- db_set_dw(NULL, MODULENAME, "OpenUsePrg", opt.OpenUsePrg);
- db_set_s(NULL, MODULENAME, "OpenUsePrgPath", str);
+ g_plugin.setDword("OpenUsePrg", opt.OpenUsePrg);
+ g_plugin.setString("OpenUsePrgPath", str);
opt.ShowCustomIcon = IsDlgButtonChecked(hwndDlg, IDC_SHOWICON);
opt.UseOnline = IsDlgButtonChecked(hwndDlg, IDC_ONLINE);
@@ -252,10 +252,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else if (IsDlgButtonChecked(hwndDlg, IDC_AUTOLOGIN) == BST_INDETERMINATE)
opt.AutoLogin = 2;
opt.LogThreads = IsDlgButtonChecked(hwndDlg, IDC_LOGTHREADS);
- db_set_dw(NULL, MODULENAME, "ShowCustomIcon", opt.ShowCustomIcon);
- db_set_dw(NULL, MODULENAME, "UseOnline", opt.UseOnline);
- db_set_dw(NULL, MODULENAME, "AutoLogin", opt.AutoLogin);
- db_set_dw(NULL, MODULENAME, "LogThreads", opt.LogThreads);
+ g_plugin.setDword("ShowCustomIcon", opt.ShowCustomIcon);
+ g_plugin.setDword("UseOnline", opt.UseOnline);
+ g_plugin.setDword("AutoLogin", opt.AutoLogin);
+ g_plugin.setDword("LogThreads", opt.LogThreads);
ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE;
for (auto &it : g_accs)
diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 63ab420896..2751aa2f1c 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -40,7 +40,7 @@ BOOL GetBrowser(char *str) else if (opt.OpenUsePrg == 0)
strKey = strDefault;
else {
- if (!db_get_s(NULL, MODULENAME, "OpenUsePrgPath", &dbv)) {
+ if (!g_plugin.getString("OpenUsePrgPath", &dbv)) {
mir_strcpy(str, dbv.pszVal);
db_free(&dbv);
}
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index de1a8553af..2d0bb6771b 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -194,7 +194,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) string sCreateLink(const char * pszSrvPath)
{
char szTemp[30];
- string sLink = DBGetString(NULL, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
+ string sLink = DBGetString(0, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
mir_snprintf(szTemp, "%d.%d.%d.%d", SplitIpAddress(dwLocalIpAddress));
ReplaceAll(sLink, "%LocalIP%", szTemp);
@@ -706,40 +706,40 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara LVCOLUMN cCol = { 0 };
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx1", 126);
+ cCol.cx = g_plugin.getWord("StatWnd_cx1", 126);
cCol.pszText = Translate("Share name");
ListView_InsertColumn(hShareList, 0, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx2", 48);
+ cCol.cx = g_plugin.getWord("StatWnd_cx2", 48);
cCol.pszText = Translate("Max Downloads");
ListView_InsertColumn(hShareList, 1, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx3", 96);
+ cCol.cx = g_plugin.getWord("StatWnd_cx3", 96);
cCol.pszText = Translate("Allowed IP");
ListView_InsertColumn(hShareList, 2, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx4", 104);
+ cCol.cx = g_plugin.getWord("StatWnd_cx4", 104);
cCol.pszText = Translate("Allowed Mask");
ListView_InsertColumn(hShareList, 3, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx5", 252);
+ cCol.cx = g_plugin.getWord("StatWnd_cx5", 252);
cCol.pszText = Translate("Real path");
ListView_InsertColumn(hShareList, 4, &cCol);
cCol.mask = LVCF_TEXT | LVCF_WIDTH;
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx6", 142);
+ cCol.cx = g_plugin.getWord("StatWnd_cx6", 142);
cCol.pszText = Translate("Share name");
ListView_InsertColumn(hUserList, 0, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx7", 111);
+ cCol.cx = g_plugin.getWord("StatWnd_cx7", 111);
cCol.pszText = Translate("User");
ListView_InsertColumn(hUserList, 1, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx8", 100);
+ cCol.cx = g_plugin.getWord("StatWnd_cx8", 100);
cCol.pszText = Translate("Agent");
ListView_InsertColumn(hUserList, 2, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx9", 100);
+ cCol.cx = g_plugin.getWord("StatWnd_cx9", 100);
cCol.pszText = Translate("Completed");
ListView_InsertColumn(hUserList, 3, &cCol);
- cCol.cx = db_get_w(NULL, MODULENAME, "StatWnd_cx10", 100);
+ cCol.cx = g_plugin.getWord("StatWnd_cx10", 100);
cCol.pszText = Translate("Speed");
ListView_InsertColumn(hUserList, 4, &cCol);
- bool b = db_get_b(NULL, MODULENAME, "StatWnd_ShowHidden", 0) != 0;
+ bool b = g_plugin.getByte("StatWnd_ShowHidden", 0) != 0;
CheckDlgButton(hwndDlg, IDC_SHOWHIDDENSHARES, b ? BST_CHECKED : BST_UNCHECKED);
bLastAutoRefress = false;
@@ -932,19 +932,19 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
HWND hUserList = GetDlgItem(hwndDlg, IDC_CURRENT_USERS);
- db_set_w(NULL, MODULENAME, "StatWnd_cx1", (WORD)ListView_GetColumnWidth(hShareList, 0));
- db_set_w(NULL, MODULENAME, "StatWnd_cx2", (WORD)ListView_GetColumnWidth(hShareList, 1));
- db_set_w(NULL, MODULENAME, "StatWnd_cx3", (WORD)ListView_GetColumnWidth(hShareList, 2));
- db_set_w(NULL, MODULENAME, "StatWnd_cx4", (WORD)ListView_GetColumnWidth(hShareList, 3));
- db_set_w(NULL, MODULENAME, "StatWnd_cx5", (WORD)ListView_GetColumnWidth(hShareList, 4));
- db_set_w(NULL, MODULENAME, "StatWnd_cx6", (WORD)ListView_GetColumnWidth(hUserList, 0));
- db_set_w(NULL, MODULENAME, "StatWnd_cx7", (WORD)ListView_GetColumnWidth(hUserList, 1));
- db_set_w(NULL, MODULENAME, "StatWnd_cx8", (WORD)ListView_GetColumnWidth(hUserList, 2));
- db_set_w(NULL, MODULENAME, "StatWnd_cx9", (WORD)ListView_GetColumnWidth(hUserList, 3));
- db_set_w(NULL, MODULENAME, "StatWnd_cx10", (WORD)ListView_GetColumnWidth(hUserList, 4));
+ g_plugin.setWord("StatWnd_cx1", (WORD)ListView_GetColumnWidth(hShareList, 0));
+ g_plugin.setWord("StatWnd_cx2", (WORD)ListView_GetColumnWidth(hShareList, 1));
+ g_plugin.setWord("StatWnd_cx3", (WORD)ListView_GetColumnWidth(hShareList, 2));
+ g_plugin.setWord("StatWnd_cx4", (WORD)ListView_GetColumnWidth(hShareList, 3));
+ g_plugin.setWord("StatWnd_cx5", (WORD)ListView_GetColumnWidth(hShareList, 4));
+ g_plugin.setWord("StatWnd_cx6", (WORD)ListView_GetColumnWidth(hUserList, 0));
+ g_plugin.setWord("StatWnd_cx7", (WORD)ListView_GetColumnWidth(hUserList, 1));
+ g_plugin.setWord("StatWnd_cx8", (WORD)ListView_GetColumnWidth(hUserList, 2));
+ g_plugin.setWord("StatWnd_cx9", (WORD)ListView_GetColumnWidth(hUserList, 3));
+ g_plugin.setWord("StatWnd_cx10", (WORD)ListView_GetColumnWidth(hUserList, 4));
bool b = IsDlgButtonChecked(hwndDlg, IDC_SHOWHIDDENSHARES) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "StatWnd_ShowHidden", b);
+ g_plugin.setByte("StatWnd_ShowHidden", b);
Utils_SaveWindowPosition(hwndDlg, 0, MODULENAME, "StatWnd_");
DestroyWindow(hwndDlg);
@@ -1074,16 +1074,16 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) {
case WM_INITDIALOG:
{
- string sDefExt = DBGetString(NULL, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
+ string sDefExt = DBGetString(0, MODULENAME, "ExternalSrvName", szDefaultExternalSrvName);
SetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, sDefExt.c_str());
- bool b = db_get_b(NULL, MODULENAME, "AddStatisticsMenuItem", 1) != 0;
+ bool b = g_plugin.getByte("AddStatisticsMenuItem", 1) != 0;
CheckDlgButton(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
- b = db_get_b(NULL, MODULENAME, "AddAcceptConMenuItem", 1) != 0;
+ b = g_plugin.getByte("AddAcceptConMenuItem", 1) != 0;
CheckDlgButton(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
- b = db_get_b(NULL, MODULENAME, "WriteLogFile", 0) != 0;
+ b = g_plugin.getByte("WriteLogFile", 0) != 0;
CheckDlgButton(hwndDlg, IDC_WRITE_LOG_FILE, b ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOW_POPUPS, bShowPopups ? BST_CHECKED : BST_UNCHECKED);
@@ -1119,7 +1119,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, nDefaultDownloadLimit, true);
indexCreationMode =
- (eIndexCreationMode)db_get_b(NULL, MODULENAME, "IndexCreationMode", 3);
+ (eIndexCreationMode)g_plugin.getByte("IndexCreationMode", 3);
switch (indexCreationMode) {
case INDEX_CREATION_HTML:
@@ -1203,64 +1203,64 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
char szTemp[500];
if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, _countof(szTemp)))
- db_set_s(NULL, MODULENAME, "ExternalSrvName", szTemp);
+ g_plugin.setString("ExternalSrvName", szTemp);
- bool b = db_get_b(NULL, MODULENAME, "AddStatisticsMenuItem", 1) != 0;
+ bool b = g_plugin.getByte("AddStatisticsMenuItem", 1) != 0;
bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
- db_set_b(NULL, MODULENAME, "AddStatisticsMenuItem", bNew);
+ g_plugin.setByte("AddStatisticsMenuItem", bNew);
MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
}
- b = db_get_b(NULL, MODULENAME, "AddAcceptConMenuItem", 1) != 0;
+ b = g_plugin.getByte("AddAcceptConMenuItem", 1) != 0;
bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED;
if (b != bNew) {
- db_set_b(NULL, MODULENAME, "AddAcceptConMenuItem", bNew);
+ g_plugin.setByte("AddAcceptConMenuItem", bNew);
MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
}
bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "WriteLogFile", bNew);
+ g_plugin.setByte("WriteLogFile", bNew);
bShowPopups = IsDlgButtonChecked(hwndDlg, IDC_SHOW_POPUPS) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "ShowPopups", bShowPopups);
+ g_plugin.setByte("ShowPopups", bShowPopups);
GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, _countof(szTemp));
sUrlAddress = szTemp;
- db_set_s(NULL, MODULENAME, "UrlAddress", sUrlAddress.c_str());
+ g_plugin.setString("UrlAddress", sUrlAddress.c_str());
GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, _countof(szTemp));
sPageKeyword = szTemp;
- db_set_s(NULL, MODULENAME, "PageKeyword", sPageKeyword.c_str());
+ g_plugin.setString("PageKeyword", sPageKeyword.c_str());
dwExternalIpAddress = 0;
BOOL bTranslated = false;
int nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_SPEED, &bTranslated, true);
if (bTranslated) {
nMaxUploadSpeed = nTemp << 10;
- db_set_dw(NULL, MODULENAME, "MaxUploadSpeed", nMaxUploadSpeed);
+ g_plugin.setDword("MaxUploadSpeed", nMaxUploadSpeed);
}
nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_TOTAL, &bTranslated, true);
if (bTranslated) {
nMaxConnectionsTotal = nTemp;
- db_set_dw(NULL, MODULENAME, "MaxConnectionsTotal", nMaxConnectionsTotal);
+ g_plugin.setDword("MaxConnectionsTotal", nMaxConnectionsTotal);
}
nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_PER_USER, &bTranslated, true);
if (bTranslated) {
nMaxConnectionsPerUser = nTemp;
- db_set_dw(NULL, MODULENAME, "MaxConnectionsPerUser", nMaxConnectionsPerUser);
+ g_plugin.setDword("MaxConnectionsPerUser", nMaxConnectionsPerUser);
}
nTemp = GetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, &bTranslated, true);
if (bTranslated) {
nDefaultDownloadLimit = nTemp;
- db_set_dw(NULL, MODULENAME, "DefaultDownloadLimit", nDefaultDownloadLimit);
+ g_plugin.setDword("DefaultDownloadLimit", nDefaultDownloadLimit);
}
bLimitOnlyWhenOnline = IsDlgButtonChecked(hwndDlg, IDC_LIMIT_ONLY_WHEN_ONLINE) == BST_CHECKED;
- db_set_b(NULL, MODULENAME, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline);
+ g_plugin.setByte("LimitOnlyWhenOnline", bLimitOnlyWhenOnline);
if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_HTML) == BST_CHECKED ||
IsDlgButtonChecked(hwndDlg, IDC_INDEX_DETECT) == BST_CHECKED) {
@@ -1283,7 +1283,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP indexCreationMode = INDEX_CREATION_DISABLE;
}
- db_set_b(NULL, MODULENAME, "IndexCreationMode", (BYTE)indexCreationMode);
+ g_plugin.setByte("IndexCreationMode", (BYTE)indexCreationMode);
return TRUE;
}
@@ -1337,7 +1337,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) void CALLBACK MainThreadCallback(void *param)
{
POPUPDATAT *pclData = (POPUPDATAT*)param;
- if (db_get_b(NULL, MODULENAME, "WriteLogFile", 0) != 0)
+ if (g_plugin.getByte("WriteLogFile", 0) != 0)
LogEvent(pclData->lpzContactName, pclData->lpzText);
PUAddPopupT(pclData);
@@ -1430,8 +1430,8 @@ void InitGuiElements() stInitCom.dwICC = ICC_INTERNET_CLASSES;
InitCommonControlsEx(&stInitCom);
- sUrlAddress = DBGetString(NULL, MODULENAME, "UrlAddress", szDefaultUrlAddress);
- sPageKeyword = DBGetString(NULL, MODULENAME, "PageKeyword", szDefaultPageKeyword);
+ sUrlAddress = DBGetString(0, MODULENAME, "UrlAddress", szDefaultUrlAddress);
+ sPageKeyword = DBGetString(0, MODULENAME, "PageKeyword", szDefaultPageKeyword);
hShareNewFileService = CreateServiceFunction(MS_SHARE_NEW_FILE, nShareNewFile);
hShowStatisticsViewService = CreateServiceFunction(MS_SHOW_STATISTICS_VIEW, nShowStatisticsView);
@@ -1445,7 +1445,7 @@ void InitGuiElements() mi.pszService = MS_SHARE_NEW_FILE;
hShareNewFileMenuItem = Menu_AddContactMenuItem(&mi);
- if (db_get_b(NULL, MODULENAME, "AddStatisticsMenuItem", 1) != 0) {
+ if (g_plugin.getByte("AddStatisticsMenuItem", 1) != 0) {
SET_UID(mi, 0x68db84c9, 0xe6b4, 0x4b4f, 0x93, 0x4b, 0xfd, 0x34, 0x2d, 0x83, 0x11, 0xe7);
mi.position = 1000085005;
mi.name.w = LPGENW("Show HTTP server statistics");
@@ -1453,5 +1453,5 @@ void InitGuiElements() hShowStatisticsViewMenuItem = Menu_AddMainMenuItem(&mi);
}
- bShowPopups = db_get_b(NULL, MODULENAME, "ShowPopups", bShowPopups) != 0;
+ bShowPopups = g_plugin.getByte("ShowPopups", bShowPopups) != 0;
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index bc3e9e4d57..c430b0574f 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -644,7 +644,7 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) else return 0; // no changes;
if (!bShutdownInProgress)
- db_set_b(NULL, MODULENAME, "AcceptConnections", hDirectBoundPort != nullptr);
+ g_plugin.setByte("AcceptConnections", hDirectBoundPort != nullptr);
return 0;
}
@@ -701,7 +701,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) nlu.szDescriptiveName.a = Translate("HTTP Server");
hNetlibUser = Netlib_RegisterUser(&nlu);
- if (db_get_b(NULL, MODULENAME, "AcceptConnections", 1))
+ if (g_plugin.getByte("AcceptConnections", 1))
nToggelAcceptConnections(0, 0);
InitGuiElements();
@@ -765,7 +765,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) }
pclFirstNode = nullptr;
- db_set_b(NULL, MODULENAME, "IndexCreationMode", (BYTE)indexCreationMode);
+ g_plugin.setByte("IndexCreationMode", (BYTE)indexCreationMode);
FreeIndexHTMLTemplate();
return 0;
}
@@ -809,13 +809,13 @@ int CMPlugin::Load() if (!bInitMimeHandling())
MessageBox(nullptr, "Failed to read configuration file : " szMimeTypeConfigFile, MSG_BOX_TITEL, MB_OK);
- nMaxUploadSpeed = db_get_dw(NULL, MODULENAME, "MaxUploadSpeed", nMaxUploadSpeed);
- nMaxConnectionsTotal = db_get_dw(NULL, MODULENAME, "MaxConnectionsTotal", nMaxConnectionsTotal);
- nMaxConnectionsPerUser = db_get_dw(NULL, MODULENAME, "MaxConnectionsPerUser", nMaxConnectionsPerUser);
- bLimitOnlyWhenOnline = db_get_b(NULL, MODULENAME, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline) != 0;
- indexCreationMode = (eIndexCreationMode)db_get_b(NULL, MODULENAME, "IndexCreationMode", 2);
+ nMaxUploadSpeed = g_plugin.getDword("MaxUploadSpeed", nMaxUploadSpeed);
+ nMaxConnectionsTotal = g_plugin.getDword("MaxConnectionsTotal", nMaxConnectionsTotal);
+ nMaxConnectionsPerUser = g_plugin.getDword("MaxConnectionsPerUser", nMaxConnectionsPerUser);
+ bLimitOnlyWhenOnline = g_plugin.getByte("LimitOnlyWhenOnline", bLimitOnlyWhenOnline) != 0;
+ indexCreationMode = (eIndexCreationMode)g_plugin.getByte("IndexCreationMode", 2);
- if (db_get_b(NULL, MODULENAME, "AddAcceptConMenuItem", 1)) {
+ if (g_plugin.getByte("AddAcceptConMenuItem", 1)) {
CMenuItem mi(&g_plugin);
SET_UID(mi, 0xf0a68784, 0xc30e, 0x4245, 0xb6, 0x2b, 0xb8, 0x71, 0x7e, 0xe6, 0xe1, 0x73);
mi.flags = CMIF_UNICODE;
@@ -829,7 +829,7 @@ int CMPlugin::Load() if (indexCreationMode == INDEX_CREATION_HTML || indexCreationMode == INDEX_CREATION_DETECT)
if (!LoadIndexHTMLTemplate()) {
indexCreationMode = INDEX_CREATION_DISABLE;
- db_set_b(NULL, MODULENAME, "IndexCreationMode", (BYTE)indexCreationMode);
+ g_plugin.setByte("IndexCreationMode", (BYTE)indexCreationMode);
}
HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index c11b45f9dd..df254cd766 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -45,7 +45,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) TranslateDialogDefault(hDlg);
TranslateMenu(listMenu);
- hContact = ((db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact);
+ hContact = ((db_get_b(0, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact);
if (db_get_b(hContact, LINKLIST_MODULE, LINKLIST_FIRST, 0) == 0) {
// First use of this plugin! Set default size!
db_set_dw(hContact, LINKLIST_MODULE, "LinklistWidth", 400);
@@ -101,7 +101,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) LPTSTR link;
ENLINK *pENLink = (ENLINK*)lParam;
- BYTE mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
+ BYTE mouseEvent = db_get_b(0, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
switch (pENLink->msg) {
case WM_MOUSEMOVE:
@@ -120,7 +120,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) if (wcsstr(link, L"mailto:") != nullptr)
ShellExecute(HWND_TOP, nullptr, link, nullptr, nullptr, SW_SHOWNORMAL);
else {
- bool openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF) != 0xFF;
+ bool openNewWindow = db_get_b(0, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF) != 0xFF;
Utils_OpenUrlW(link, openNewWindow);
}
mir_free(link);
@@ -132,7 +132,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) hSubMenu = GetSubMenu(hPopup, 0);
// Disable Menuoption if "mouse over" events are active
- mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
+ mouseEvent = db_get_b(0, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
if (mouseEvent == 0x01)
EnableMenuItem(hSubMenu, IDM_SHOWMESSAGE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
TranslateMenu(hSubMenu);
@@ -341,9 +341,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_DESTROY:
if (DlgParam != nullptr) {
- hContact = ((db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact);
+ hContact = ((db_get_b(0, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact);
Utils_SaveWindowPosition(hDlg, hContact, LINKLIST_MODULE, "Linklist");
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_SPLITPOS, DlgParam->splitterPosNew);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_SPLITPOS, DlgParam->splitterPosNew);
RemoveList(DlgParam->listStart);
mir_free(DlgParam);
}
@@ -426,7 +426,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- useDefault = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
+ useDefault = db_get_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
if (useDefault == 0x01) {
int mCol = GetMirandaColour(&colourSet);
if (mCol == 0) {
@@ -707,9 +707,9 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l if (((LPNMHDR)lParam)->code == PSN_APPLY) {
// Write Settings to Database
if (IsDlgButtonChecked(hDlg, IDC_CHECK1) == BST_CHECKED)
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
else {
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
colourSet.incoming = SendDlgItemMessage(hDlg, IDC_INCOMING, CPM_GETCOLOUR, 0, 0);
colourSet.outgoing = SendDlgItemMessage(hDlg, IDC_OUTGOING, CPM_GETCOLOUR, 0, 0);
colourSet.background = SendDlgItemMessage(hDlg, IDC_BACKGROUND, CPM_GETCOLOUR, 0, 0);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 65189573a0..56cafca663 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -811,77 +811,77 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, size void GetListOptions(LISTOPTIONS *options)
{
- options->openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
+ options->openNewWindow = db_get_b(0, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
if (options->openNewWindow == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0x00);
options->openNewWindow = 0x00;
}
- options->updateWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
+ options->updateWindow = db_get_b(0, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
if (options->updateWindow == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
options->updateWindow = 0x00;
}
- options->mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
+ options->mouseEvent = db_get_b(0, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
if (options->mouseEvent == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0x00);
options->mouseEvent = 0x00;
}
- options->saveSpecial = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0xFF);
+ options->saveSpecial = db_get_b(0, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0xFF);
if (options->saveSpecial == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00);
options->saveSpecial = 0x00;
}
- options->showDate = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0xFF);
+ options->showDate = db_get_b(0, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0xFF);
if (options->showDate == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0x01);
options->showDate = 0x01;
}
- options->showLine = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0xFF);
+ options->showLine = db_get_b(0, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0xFF);
if (options->showLine == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0x01);
options->showLine = 0x01;
}
- options->showTime = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0xFF);
+ options->showTime = db_get_b(0, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0xFF);
if (options->showTime == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
options->showTime = 0x01;
}
- options->showDirection = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0xFF);
+ options->showDirection = db_get_b(0, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0xFF);
if (options->showDirection == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
options->showDirection = 0x01;
}
- options->showType = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0xFF);
+ options->showType = db_get_b(0, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0xFF);
if (options->showType == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
options->showType = 0x01;
}
@@ -890,15 +890,15 @@ void GetListOptions(LISTOPTIONS *options) void SetListOptions(LISTOPTIONS *options)
{
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, options->openNewWindow);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, options->updateWindow);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, options->mouseEvent);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, options->saveSpecial);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, options->showDate);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, options->showLine);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, options->showTime);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, options->showDirection);
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, options->showType);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, options->openNewWindow);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, options->updateWindow);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, options->mouseEvent);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, options->saveSpecial);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_DATE, options->showDate);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_LINE, options->showLine);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_TIME, options->showTime);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, options->showDirection);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, options->showType);
}
/*
@@ -946,11 +946,11 @@ void GetColour(MYCOLOURSET *colourSet) DWORD colour;
BYTE useDefault;
- useDefault = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
+ useDefault = db_get_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
if (useDefault == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
useDefault = 0x01;
}
@@ -959,51 +959,51 @@ void GetColour(MYCOLOURSET *colourSet) // Use Miranda-IM Default colours
// CHANGED AT MIRANDA 0.4!!!!
// Use SRMM... if it is not there try SRMsg (older Miranda Versions)
- colour = db_get_dw(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMM", "SRMFont1Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
- colour = db_get_dw(NULL, "SRMsg", "Font3Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMsg", "Font3Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
useDefault = 0x00;
}
}
// SRMM
- colour = db_get_dw(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMM", "SRMFont0Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
// SRMsg
- colour = db_get_dw(NULL, "SRMsg", "Font0Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMsg", "Font0Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
useDefault = 0x00;
}
}
// SRMM
- colour = db_get_dw(NULL, "SRMM", "BkgColour", 0xFF000000);
+ colour = db_get_dw(0, "SRMM", "BkgColour", 0xFF000000);
if (colour != 0xFF000000)
colourSet->background = colour;
else
{
// SRMsg
- colour = db_get_dw(NULL, "SRMsg", "BkgColour", 0xFF000000);
+ colour = db_get_dw(0, "SRMsg", "BkgColour", 0xFF000000);
if (colour != 0xFF000000)
colourSet->background = colour;
else
{
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x00);
useDefault = 0x00;
}
}
@@ -1013,25 +1013,25 @@ void GetColour(MYCOLOURSET *colourSet) if (useDefault == 0x00)
{
// Use Plugin user defined or default colours
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->incoming = colour;
else
colourSet->incoming = IN_COL_DEF;
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
colourSet->outgoing = OUT_COL_DEF;
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->background = colour;
else
colourSet->background = BG_COL_DEF;
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->text = colour;
else
@@ -1048,39 +1048,39 @@ void GetDBColour(MYCOLOURSET *colourSet) DWORD colour;
// Use Plugin user defined or default colours
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, IN_COL_DEF);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_IN_COL, IN_COL_DEF);
colourSet->incoming = IN_COL_DEF;
}
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, OUT_COL_DEF);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_OUT_COL, OUT_COL_DEF);
colourSet->outgoing = OUT_COL_DEF;
}
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->background = colour;
else
{
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, BG_COL_DEF);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_BG_COL, BG_COL_DEF);
colourSet->background = BG_COL_DEF;
}
- colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
+ colour = db_get_dw(0, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
if (colour != 0xFF000000)
colourSet->text = colour;
else
{
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, TXT_COL_DEF);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_TXT_COL, TXT_COL_DEF);
colourSet->text = TXT_COL_DEF;
}
}
@@ -1094,12 +1094,12 @@ int GetMirandaColour(MYCOLOURSET *colourSet) // Use Miranda-IM Default colours
// Try SRMM (Miranda 0.4) .... or SRMsg... for older versions
- colour = db_get_dw(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMM", "SRMFont1Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
- colour = db_get_dw(NULL, "SRMsg", "Font3Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMsg", "Font3Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->incoming = colour;
else
@@ -1107,24 +1107,24 @@ int GetMirandaColour(MYCOLOURSET *colourSet) }
- colour = db_get_dw(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMM", "SRMFont0Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
- colour = db_get_dw(NULL, "SRMsg", "Font0Col", 0xFF000000);
+ colour = db_get_dw(0, "SRMsg", "Font0Col", 0xFF000000);
if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
return 1;
}
- colour = db_get_dw(NULL, "SRMM", "BkgColour", 0xFF000000);
+ colour = db_get_dw(0, "SRMM", "BkgColour", 0xFF000000);
if (colour != 0xFF000000)
colourSet->background = colour;
else
{
- colour = db_get_dw(NULL, "SRMsg", "BkgColour", 0xFF000000);
+ colour = db_get_dw(0, "SRMsg", "BkgColour", 0xFF000000);
if (colour != 0xFF000000)
colourSet->background = colour;
else
@@ -1141,21 +1141,21 @@ Write user defined colours to the database */
void SetDBColour(MYCOLOURSET *colourSet)
{
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, colourSet->incoming);
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, colourSet->outgoing);
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, colourSet->background);
- db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, colourSet->text);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_IN_COL, colourSet->incoming);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_OUT_COL, colourSet->outgoing);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_BG_COL, colourSet->background);
+ db_set_dw(0, LINKLIST_MODULE, LINKLIST_TXT_COL, colourSet->text);
}
BYTE GetUpdateSetting(void)
{
BYTE updateWindow;
- updateWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
+ updateWindow = db_get_b(0, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
if (updateWindow == 0xFF)
{
// No DB entry for this Plugin
- db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
+ db_set_b(0, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
return 0;
}
if (updateWindow == 0x00)
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 176a87087e..230f8e4595 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -129,9 +129,9 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke {
int lPolicy;
if (hContact == NULL) // for system history
- lPolicy = db_get_b(NULL, ModuleName, "SweepSHistory", 0);
+ lPolicy = db_get_b(0, ModuleName, "SweepSHistory", 0);
else // for contact history (or "SweepHistory" - default action)
- lPolicy = db_get_b(hContact, ModuleName, "SweepHistory", db_get_b(NULL, ModuleName, "SweepHistory", 0));
+ lPolicy = db_get_b(hContact, ModuleName, "SweepHistory", db_get_b(0, ModuleName, "SweepHistory", 0));
if (lPolicy == 0) return; // nothing to do
@@ -139,7 +139,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (eventsCnt == 0)
return;
- BOOL doDelete, unsafe = db_get_b(NULL, ModuleName, "UnsafeMode", 0);
+ BOOL doDelete, unsafe = db_get_b(0, ModuleName, "UnsafeMode", 0);
BEventData *books, *item, ev = { 0 };
size_t bookcnt, btshift;
@@ -196,8 +196,8 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke void ShutdownAction(void)
{
CriteriaStruct Criteria;
- Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(0, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(0, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(NULL, Criteria, FALSE); // sweep system history, keepunread==0
@@ -215,11 +215,11 @@ int OnWindowEvent(WPARAM, LPARAM lParam) break;
case MSG_WINDOW_EVT_CLOSE:
- if (db_get_b(NULL, ModuleName, "SweepOnClose", 0)) {
+ if (db_get_b(0, ModuleName, "SweepOnClose", 0)) {
CriteriaStruct Criteria;
- Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(0, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(0, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE);
}
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 3cc113a692..2f48385696 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -51,7 +51,7 @@ static int OnIconPressed(WPARAM hContact, LPARAM lParam) {
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if (!(sicd->flags & MBCF_RIGHTBUTTON) && !mir_strcmp(sicd->szModule, ModuleName) && db_get_b(NULL, ModuleName, "ChangeInMW", 0)) {
+ if (!(sicd->flags & MBCF_RIGHTBUTTON) && !mir_strcmp(sicd->szModule, ModuleName) && db_get_b(0, ModuleName, "ChangeInMW", 0)) {
int nh = sicd->dwId;
StatusIconData sid = {};
@@ -72,7 +72,7 @@ static int OnIconPressed(WPARAM hContact, LPARAM lParam) static int OnModulesLoaded(WPARAM, LPARAM)
{
- int sweep = db_get_b(NULL, ModuleName, "SweepHistory", 0);
+ int sweep = db_get_b(0, ModuleName, "SweepHistory", 0);
StatusIconData sid = {};
sid.szModule = ModuleName;
@@ -81,9 +81,9 @@ static int OnModulesLoaded(WPARAM, LPARAM) if (sweep == 0)
sid.szTooltip = LPGEN("Keep all events");
else if (sweep == 1)
- sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)];
+ sid.szTooltip = time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)];
else if (sweep == 2)
- sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)];
+ sid.szTooltip = keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)];
else if (sweep == 3)
sid.szTooltip = LPGEN("Delete all events");
@@ -92,13 +92,13 @@ static int OnModulesLoaded(WPARAM, LPARAM) sid.dwId = 1;
sid.hIcon = LoadIconEx("act1");
- sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)];
+ sid.szTooltip = time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)];
sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid, &g_plugin);
sid.dwId = 2;
sid.hIcon = LoadIconEx("act2");
- sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)];
+ sid.szTooltip = keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)];
sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid, &g_plugin);
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index b3f902dfd0..1c54372f43 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -87,9 +87,9 @@ HANDLE hAllContacts, hSystemHistory; static void ShowAllContactIcons(HWND hwndList)
{
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hAllContacts,
- MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepHistory", 0)));
+ MAKELPARAM(0, db_get_b(0, ModuleName, "SweepHistory", 0)));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory,
- MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepSHistory", 0)));
+ MAKELPARAM(0, db_get_b(0, ModuleName, "SweepSHistory", 0)));
for (auto &hContact : Contacts()) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
@@ -127,27 +127,27 @@ void LoadSettings(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
- SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0), 0);
- SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, db_get_b(0, ModuleName, "StartupShutdownOlder", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, db_get_b(0, ModuleName, "StartupShutdownKeep", 0), 0);
- CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(NULL, ModuleName, "UnsafeMode", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(NULL, ModuleName, "SweepOnClose", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(NULL, ModuleName, "ChangeInMW", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(0, ModuleName, "UnsafeMode", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(0, ModuleName, "SweepOnClose", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(0, ModuleName, "ChangeInMW", 0) ? BST_CHECKED : BST_UNCHECKED);
}
void SaveSettings(HWND hwndDlg)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- db_set_b(NULL, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
- db_set_b(NULL, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
- db_set_b(NULL, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
- db_set_b(NULL, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
- db_set_b(NULL, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
+ db_set_b(0, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
+ db_set_b(0, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
+ db_set_b(0, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
+ db_set_b(0, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
+ db_set_b(0, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
- db_set_b(NULL, ModuleName, "SweepHistory",
+ db_set_b(0, ModuleName, "SweepHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hAllContacts, 0));
- db_set_b(NULL, ModuleName, "SweepSHistory",
+ db_set_b(0, ModuleName, "SweepSHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0));
for (auto &hContact : Contacts()) {
@@ -164,26 +164,26 @@ void SaveSettings(HWND hwndDlg) SetSrmmIcon(UINT_PTR(it));
// set tooltips
- int st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
+ int st = db_get_b(0, ModuleName, "SweepHistory", 0);
StatusIconData sid = {};
sid.szModule = ModuleName;
sid.dwId = 0;
sid.hIcon = LoadIconEx("actG");
if (st == 0) sid.szTooltip = LPGEN("Keep all events");
- else if (st == 1) sid.szTooltip = LPGEN(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
- else if (st == 2) sid.szTooltip = LPGEN(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ else if (st == 1) sid.szTooltip = LPGEN(time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)]);
+ else if (st == 2) sid.szTooltip = LPGEN(keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)]);
else if (st == 3) sid.szTooltip = LPGEN("Delete all events");
Srmm_ModifyIcon(NULL, &sid);
sid.dwId = 1;
sid.hIcon = LoadIconEx("act1");
- sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)];
+ sid.szTooltip = time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)];
Srmm_ModifyIcon(NULL, &sid);
sid.dwId = 2;
sid.hIcon = LoadIconEx("act2");
- sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)];
+ sid.szTooltip = keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)];
Srmm_ModifyIcon(NULL, &sid);
}
diff --git a/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp b/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp index 934b01863f..40e71c5d0c 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_Dlg.cpp @@ -87,11 +87,11 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
case PSN_APPLY: // система просит сохранить настройки плагина
code_Close = code_Close_tmp;
- db_set_dw(0, MODULENAME, "Close", code_Close_tmp);
+ g_plugin.setDword("Close", code_Close_tmp);
code_HideShow = code_HideShow_tmp;
- db_set_dw(0, MODULENAME, "HideShow", code_HideShow_tmp);
+ g_plugin.setDword("HideShow", code_HideShow_tmp);
code_ReadMsg = code_ReadMsg_tmp;
- db_set_dw(0, MODULENAME, "ReadMsg", code_ReadMsg_tmp);
+ g_plugin.setDword("ReadMsg", code_ReadMsg_tmp);
break; //case PSN_APPLY
}
break; //case 0
diff --git a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp index a9438690e2..0bba4387f7 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp @@ -88,9 +88,9 @@ CMPlugin::CMPlugin() : int CMPlugin::Load()
{
// загружаем (из БД) настройки плагина
- code_Close = db_get_dw(0, MODULENAME, "Close", 0);
- code_HideShow = db_get_dw(0, MODULENAME, "HideShow", 0);
- code_ReadMsg = db_get_dw(0, MODULENAME, "ReadMsg", 0);
+ code_Close = g_plugin.getDword("Close", 0);
+ code_HideShow = g_plugin.getDword("HideShow", 0);
+ code_ReadMsg = g_plugin.getDword("ReadMsg", 0);
// регистрация диалога опций
HookEvent(ME_OPT_INITIALISE, initializeOptions);
diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 6e5b146434..5f75aaac66 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -241,8 +241,8 @@ int LoadEvents(HWND hWnd) {
HistoryWindowData *data = (HistoryWindowData *)GetWindowLongPtr(hWnd, DWLP_USER);
int count = db_event_count(data->contact);
- int bLastFirst = db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0);
- int bRTL = db_get_b(NULL, MODULENAME, "EnableRTL", 0);
+ int bLastFirst = g_plugin.getByte("ShowLastPageFirst", 0);
+ int bRTL = g_plugin.getByte("EnableRTL", 0);
bRTL = db_get_b(data->contact, "Tab_SRMsg", "RTL", bRTL);
data->bEnableRTL = bRTL;
data->count = count;
@@ -362,7 +362,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hWnd);
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
{
- int bRTL = db_get_b(NULL, MODULENAME, "EnableRTL", 0);
+ int bRTL = g_plugin.getByte("EnableRTL", 0);
if (bRTL)
SetWindowLongPtr(hWnd, GWL_EXSTYLE, WS_EX_RTLREADING);
@@ -392,7 +392,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara LoadEvents(hWnd);
{
bool bAll = (data->itemsPerPage <= 0) || (data->itemsPerPage >= data->count);
- int bLastFirst = db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0);
+ int bLastFirst = g_plugin.getByte("ShowLastPageFirst", 0);
if (!bLastFirst) {
EnableWindow(GetDlgItem(hWnd, IDC_PREV), FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_NEXT), !bAll);
@@ -611,15 +611,15 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
{
- int count = db_get_dw(NULL, MODULENAME, "EventsToLoad", 0);
+ int count = g_plugin.getDword("EventsToLoad", 0);
EnableWindow(GetDlgItem(hWnd, IDC_EVENTS_COUNT), count > 0);
EnableWindow(GetDlgItem(hWnd, IDC_SHOW_LAST_FIRST), count > 0);
CheckDlgButton(hWnd, IDC_LOAD_ALL, count <= 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_LOAD_NUMBER, count > 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_ENABLE_RTL, db_get_b(NULL, MODULENAME, "EnableRTL", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, db_get_b(NULL, MODULENAME, "ShowLastPageFirst", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, db_get_b(NULL, MODULENAME, "UseWorkerThread", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_ENABLE_RTL, g_plugin.getByte("EnableRTL", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOW_LAST_FIRST, g_plugin.getByte("ShowLastPageFirst", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_LOAD_BACKGROUND, g_plugin.getByte("UseWorkerThread", 0) ? BST_CHECKED : BST_UNCHECKED);
wchar_t buffer[40];
_itow_s(count, buffer, 10);
@@ -664,10 +664,10 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA count = _wtol(buffer);
count = (count < 0) ? 0 : count;
}
- db_set_b(NULL, MODULENAME, "ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST));
- db_set_b(NULL, MODULENAME, "EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL));
- db_set_b(NULL, MODULENAME, "UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND));
- db_set_dw(NULL, MODULENAME, "EventsToLoad", count);
+ g_plugin.setByte("ShowLastPageFirst", IsDlgButtonChecked(hWnd, IDC_SHOW_LAST_FIRST));
+ g_plugin.setByte("EnableRTL", IsDlgButtonChecked(hWnd, IDC_ENABLE_RTL));
+ g_plugin.setByte("UseWorkerThread", IsDlgButtonChecked(hWnd, IDC_LOAD_BACKGROUND));
+ g_plugin.setDword("EventsToLoad", count);
}
}
break;
diff --git a/plugins/IEHistory/src/services.cpp b/plugins/IEHistory/src/services.cpp index 464072b8e3..ec5210e8df 100644 --- a/plugins/IEHistory/src/services.cpp +++ b/plugins/IEHistory/src/services.cpp @@ -34,8 +34,8 @@ INT_PTR ShowContactHistoryService(WPARAM wParam, LPARAM) HWND parent = nullptr; historyDlg = WindowList_Find(hOpenWindowsList, (MCONTACT)wParam); if (historyDlg == nullptr){ - int count = db_get_dw(NULL, MODULENAME, "EventsToLoad", 0); - int loadInBackground = db_get_b(NULL, MODULENAME, "UseWorkerThread", 0); + int count = g_plugin.getDword("EventsToLoad", 0); + int loadInBackground = g_plugin.getByte("UseWorkerThread", 0); HistoryWindowData *data; data = (HistoryWindowData *)malloc(sizeof(HistoryWindowData)); data->contact = (MCONTACT)wParam; diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 8c14599e6c..0c95589461 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -51,29 +51,29 @@ void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) DBVARIANT dbv;
if (colour) {
mir_snprintf(str, "Font%dCol", i);
- *colour = db_get_dw(NULL, CHATFONTMOD, str, 0x000000);
+ *colour = db_get_dw(0, CHATFONTMOD, str, 0x000000);
}
if (lf) {
mir_snprintf(str, "Font%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, CHATFONTMOD, str, 10);
+ lf->lfHeight = (char)db_get_b(0, CHATFONTMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font%dSty", i);
- style = db_get_b(NULL, CHATFONTMOD, str, 0);
+ style = db_get_b(0, CHATFONTMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "Font%dSet", i);
- lf->lfCharSet = db_get_b(NULL, CHATFONTMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(0, CHATFONTMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font%d", i);
- if (db_get_s(NULL, CHATFONTMOD, str, &dbv))
+ if (db_get_s(0, CHATFONTMOD, str, &dbv))
strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE);
else {
strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE);
@@ -115,7 +115,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
- COLORREF bkgColor = db_get_dw(NULL, CHATMOD, "BackgroundLog", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(0, CHATMOD, "BackgroundLog", 0xFFFFFF);
bkgColor = (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
COLORREF inColor = bkgColor, outColor = bkgColor;
if (protoSettings->getChatFlags() & Options::LOG_IMAGE_ENABLED) {
@@ -159,7 +159,7 @@ void ChatHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) void ChatHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
- DWORD iconFlags = db_get_dw(NULL, CHATMOD, CHAT_ICON_FLAGS, 0);
+ DWORD iconFlags = db_get_dw(0, CHATMOD, CHAT_ICON_FLAGS, 0);
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
const char *iconFile = "";
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 8cb6fc1b9e..9160daf897 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -96,34 +96,34 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, CO DBVARIANT dbv;
if (bkgColour) {
mir_snprintf(str, "Back.%s", dbSetting);
- *bkgColour = db_get_dw(NULL, HPPMOD, str, 0xFFFFFF);
+ *bkgColour = db_get_dw(0, HPPMOD, str, 0xFFFFFF);
}
if (colour) {
mir_snprintf(str, "Font.%s.Color", dbSetting);
- *colour = db_get_dw(NULL, HPPMOD, str, 0x000000);
+ *colour = db_get_dw(0, HPPMOD, str, 0x000000);
}
if (lf) {
mir_snprintf(str, "Font.%s.Size", dbSetting);
- lf->lfHeight = (char)db_get_b(NULL, HPPMOD, str, 10);
+ lf->lfHeight = (char)db_get_b(0, HPPMOD, str, 10);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font.%s.Style.Bold", dbSetting);
- style = db_get_b(NULL, HPPMOD, str, 0);
+ style = db_get_b(0, HPPMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
mir_snprintf(str, "Font.%s.Style.Italic", dbSetting);
- style = db_get_b(NULL, HPPMOD, str, 0) << 1;
+ style = db_get_b(0, HPPMOD, str, 0) << 1;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "Font.%s.Charset", dbSetting);
- lf->lfCharSet = db_get_b(NULL, HPPMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(0, HPPMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font.%s.Name", dbSetting);
- if (db_get_s(NULL, HPPMOD, str, &dbv))
+ if (db_get_s(0, HPPMOD, str, &dbv))
strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE);
else {
strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE);
@@ -165,7 +165,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) else {
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
- COLORREF lineColor = db_get_dw(NULL, HPPMOD, "LineColour", 0xFFFFFF);
+ COLORREF lineColor = db_get_dw(0, HPPMOD, "LineColour", 0xFFFFFF);
lineColor = 0;
bkgColor = 0xFFFFFF;
if (protoSettings->getHistoryFlags() & Options::LOG_IMAGE_ENABLED)
@@ -220,7 +220,7 @@ void HistoryHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
- DWORD dwFlags = db_get_b(NULL, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
+ DWORD dwFlags = db_get_b(0, HPPMOD, SRMSGSET_SHOWICONS, 0) ? SMF_LOG_SHOWICONS : 0;
ptrA szRealProto(getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData != nullptr && (eventIdx < event->count || event->count == -1); eventData = eventData->next, eventIdx++) {
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index b787a1017e..c59be8a15d 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -47,29 +47,29 @@ void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) DBVARIANT dbv;
if (colour) {
mir_snprintf(str, "Font%dCol", i);
- *colour = db_get_dw(NULL, MUCCMOD, str, 0x000000);
+ *colour = db_get_dw(0, MUCCMOD, str, 0x000000);
}
if (lf) {
mir_snprintf(str, "Font%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, MUCCMOD, str, 10);
+ lf->lfHeight = (char)db_get_b(0, MUCCMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font%dStyle", i);
- style = db_get_b(NULL, MUCCMOD, str, 0);
+ style = db_get_b(0, MUCCMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "Font%dSet", i);
- lf->lfCharSet = db_get_b(NULL, MUCCMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(0, MUCCMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font%dFace", i);
- if (db_get_s(NULL, MUCCMOD, str, &dbv))
+ if (db_get_s(0, MUCCMOD, str, &dbv))
strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE);
else {
strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE);
@@ -133,7 +133,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
- COLORREF bkgColor = db_get_dw(NULL, MUCCMOD, "BackgroundLog", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(0, MUCCMOD, "BackgroundLog", 0xFFFFFF);
COLORREF inColor, outColor;
bkgColor = (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
inColor = outColor = bkgColor;
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index c910643352..8283b2e474 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -89,29 +89,29 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) DBVARIANT dbv;
if (colour) {
mir_snprintf(str, "SRMFont%dCol", i);
- *colour = db_get_dw(NULL, SRMMMOD, str, 0x000000);
+ *colour = db_get_dw(0, SRMMMOD, str, 0x000000);
}
if (lf) {
mir_snprintf(str, "SRMFont%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, SRMMMOD, str, 10);
+ lf->lfHeight = (char)db_get_b(0, SRMMMOD, str, 10);
lf->lfHeight = abs(lf->lfHeight);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "SRMFont%dSty", i);
- style = db_get_b(NULL, SRMMMOD, str, 0);
+ style = db_get_b(0, SRMMMOD, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "SRMFont%dSet", i);
- lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(0, SRMMMOD, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "SRMFont%d", i);
- if (db_get_s(NULL, SRMMMOD, str, &dbv))
+ if (db_get_s(0, SRMMMOD, str, &dbv))
strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE);
else {
strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE);
@@ -196,10 +196,10 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) ReleaseDC(nullptr, hdc);
str.Append("<html><head>");
str.Append("<style type=\"text/css\">\n");
- COLORREF bkgColor = db_get_dw(NULL, SRMMMOD, "BkgColour", 0xFFFFFF);
- COLORREF inColor = db_get_dw(NULL, SRMMMOD, "IncomingBkgColour", 0xFFFFFF);
- COLORREF outColor = db_get_dw(NULL, SRMMMOD, "OutgoingBkgColour", 0xFFFFFF);
- COLORREF lineColor = db_get_dw(NULL, SRMMMOD, "LineColour", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(0, SRMMMOD, "BkgColour", 0xFFFFFF);
+ COLORREF inColor = db_get_dw(0, SRMMMOD, "IncomingBkgColour", 0xFFFFFF);
+ COLORREF outColor = db_get_dw(0, SRMMMOD, "OutgoingBkgColour", 0xFFFFFF);
+ COLORREF lineColor = db_get_dw(0, SRMMMOD, "LineColour", 0xFFFFFF);
bkgColor = (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
inColor = (((inColor & 0xFF) << 16) | (inColor & 0xFF00) | ((inColor & 0xFF0000) >> 16));
outColor = (((outColor & 0xFF) << 16) | (outColor & 0xFF00) | ((outColor & 0xFF0000) >> 16));
@@ -262,18 +262,18 @@ void ScriverHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event)
{
bool showColon;
- DWORD dwFlags = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, 0) ? SMF_LOG_SHOWTIME : 0;
- dwFlags |= !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, 0) ? SMF_LOG_SHOWNICK : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, 0) ? SMF_LOG_SHOWDATE : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, 0) ? SMF_LOG_SHOWICONS : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCHANGES, 0) ? SMF_LOG_SHOWSTATUSCHANGES : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, 0) ? SMF_LOG_SHOWSECONDS : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, 0) ? SMF_LOG_USERELATIVEDATE : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_USELONGDATE, 0) ? SMF_LOG_USELONGDATE : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, 0) ? SMF_LOG_GROUPMESSAGES : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, 0) ? SMF_LOG_MARKFOLLOWUPS : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, 0) ? SMF_LOG_MSGONNEWLINE : 0;
- dwFlags |= db_get_b(NULL, SRMMMOD, SRMSGSET_DRAWLINES, 0) ? SMF_LOG_DRAWLINES : 0;
+ DWORD dwFlags = db_get_b(0, SRMMMOD, SRMSGSET_SHOWTIME, 0) ? SMF_LOG_SHOWTIME : 0;
+ dwFlags |= !db_get_b(0, SRMMMOD, SRMSGSET_HIDENAMES, 0) ? SMF_LOG_SHOWNICK : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_SHOWDATE, 0) ? SMF_LOG_SHOWDATE : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_SHOWLOGICONS, 0) ? SMF_LOG_SHOWICONS : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_SHOWSTATUSCHANGES, 0) ? SMF_LOG_SHOWSTATUSCHANGES : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_SHOWSECONDS, 0) ? SMF_LOG_SHOWSECONDS : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_USERELATIVEDATE, 0) ? SMF_LOG_USERELATIVEDATE : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_USELONGDATE, 0) ? SMF_LOG_USELONGDATE : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_GROUPMESSAGES, 0) ? SMF_LOG_GROUPMESSAGES : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, 0) ? SMF_LOG_MARKFOLLOWUPS : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, 0) ? SMF_LOG_MSGONNEWLINE : 0;
+ dwFlags |= db_get_b(0, SRMMMOD, SRMSGSET_DRAWLINES, 0) ? SMF_LOG_DRAWLINES : 0;
ptrA szRealProto(getRealProto(event->hContact));
IEVIEWEVENTDATA* eventData = event->eventData;
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index fbd8771138..22540d802d 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -106,8 +106,8 @@ bool TabSRMMHTMLBuilder::isDbEventShown(DWORD dwFlags, DBEVENTINFO *dbei) bool TabSRMMHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
{
- DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
- dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
+ DWORD dwFlags2 = db_get_b(0, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
+ dwFlags2 |= db_get_b(0, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
return isDbEventShown(dwFlags2, dbei);
}
@@ -118,31 +118,31 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) DBVARIANT dbv;
if (colour) {
mir_snprintf(str, "Font%dCol", i);
- *colour = db_get_dw(NULL, TABSRMM_FONTMODULE, str, 0x000000);
+ *colour = db_get_dw(0, TABSRMM_FONTMODULE, str, 0x000000);
}
if (lf) {
HDC hdc = GetDC(nullptr);
mir_snprintf(str, "Font%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, TABSRMM_FONTMODULE, str, 10);
+ lf->lfHeight = (char)db_get_b(0, TABSRMM_FONTMODULE, str, 10);
ReleaseDC(nullptr, hdc);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font%dSty", i);
- style = db_get_b(NULL, TABSRMM_FONTMODULE, str, 0);
+ style = db_get_b(0, TABSRMM_FONTMODULE, str, 0);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "Font%dSet", i);
- lf->lfCharSet = db_get_b(NULL, TABSRMM_FONTMODULE, str, DEFAULT_CHARSET);
+ lf->lfCharSet = db_get_b(0, TABSRMM_FONTMODULE, str, DEFAULT_CHARSET);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, "Font%d", i);
- if (db_get_s(NULL, TABSRMM_FONTMODULE, str, &dbv))
+ if (db_get_s(0, TABSRMM_FONTMODULE, str, &dbv))
strncpy_s(lf->lfFaceName, "Verdana", _TRUNCATE);
else {
strncpy_s(lf->lfFaceName, dbv.pszVal, _TRUNCATE);
@@ -221,16 +221,16 @@ void TabSRMMHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) HDC hdc = GetDC(nullptr);
int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(nullptr, hdc);
- DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
+ DWORD dwFlags = db_get_dw(0, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
str.Append("<html><head><style type=\"text/css\">\n");
COLORREF inColor, outColor;
- COLORREF bkgColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "BkgColour", 0xFFFFFF);
+ COLORREF bkgColor = db_get_dw(0, TABSRMM_FONTMODULE, "BkgColour", 0xFFFFFF);
bkgColor = (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
- COLORREF gridColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "hgrid", 0xFFFFFF);
+ COLORREF gridColor = db_get_dw(0, TABSRMM_FONTMODULE, "hgrid", 0xFFFFFF);
gridColor = (((gridColor & 0xFF) << 16) | (gridColor & 0xFF00) | ((gridColor & 0xFF0000) >> 16));
if (dwFlags & MWF_LOG_INDIVIDUALBKG) {
- inColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "inbg", RGB(224, 224, 224));
- outColor = db_get_dw(NULL, TABSRMM_FONTMODULE, "outbg", RGB(224, 224, 224));
+ inColor = db_get_dw(0, TABSRMM_FONTMODULE, "inbg", RGB(224, 224, 224));
+ outColor = db_get_dw(0, TABSRMM_FONTMODULE, "outbg", RGB(224, 224, 224));
inColor = (((inColor & 0xFF) << 16) | (inColor & 0xFF00) | ((inColor & 0xFF0000) >> 16));
outColor = (((outColor & 0xFF) << 16) | (outColor & 0xFF00) | ((outColor & 0xFF0000) >> 16));
}
@@ -293,13 +293,13 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event {
DWORD today = (DWORD)time(0);
today = today - today % 86400;
- DWORD dwFlags = db_get_dw(NULL, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
- DWORD dwFlags2 = db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
- dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
- dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, "in_out_icons", 0) ? MWF_SHOW_INOUTICONS : 0;
- dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, "emptylinefix", 1) ? MWF_SHOW_EMPTYLINEFIX : 0;
+ DWORD dwFlags = db_get_dw(0, SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT);
+ DWORD dwFlags2 = db_get_b(0, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
+ dwFlags2 |= db_get_b(0, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
+ dwFlags2 |= db_get_b(0, SRMSGMOD_T, "in_out_icons", 0) ? MWF_SHOW_INOUTICONS : 0;
+ dwFlags2 |= db_get_b(0, SRMSGMOD_T, "emptylinefix", 1) ? MWF_SHOW_EMPTYLINEFIX : 0;
dwFlags2 |= MWF_SHOW_MICROLF;
- dwFlags2 |= db_get_b(NULL, SRMSGMOD_T, "followupts", 1) ? MWF_SHOW_MARKFOLLOWUPTS : 0;
+ dwFlags2 |= db_get_b(0, SRMSGMOD_T, "followupts", 1) ? MWF_SHOW_MARKFOLLOWUPTS : 0;
char *szRealProto = getRealProto(event->hContact);
IEVIEWEVENTDATA* eventData = event->eventData;
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index deac722df5..6923074d1e 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -107,9 +107,9 @@ static IconItem iconList[] = VOID fill_filter(void)
{
- bUseMirandaSettings = db_get_b(NULL, MODULENAME, "UseMirandaSettings", 0);
+ bUseMirandaSettings = g_plugin.getByte("UseMirandaSettings", 0);
- currentFilter = bUseMirandaSettings ? db_get_dw(NULL, "Ignore", "Default1", 0) : db_get_dw(NULL, MODULENAME, "Filter", 0x8);
+ currentFilter = bUseMirandaSettings ? db_get_dw(0, "Ignore", "Default1", 0) : g_plugin.getDword("Filter", 0x8);
for (int i = 0; i < _countof(ii); i++) {
if (checkState((ii[i].type)))
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index 78da3941d2..3dc51d64a8 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -84,10 +84,10 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (TreeView_GetCheckState(hTree, tvi.hItem)) flags |= 1 << (tvi.lParam - 1);
tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
}
- db_set_dw(NULL, MODULENAME, "Filter", flags);
+ g_plugin.setDword("Filter", flags);
bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
- db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+ g_plugin.setByte("UseMirandaSettings", bUseMirandaSettings);
fill_filter();
}
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 14f803d84f..a6b5917329 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -485,19 +485,19 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules) itoa(400 + p->iSrcIndex, szSetting, 10);
int iVal = myGetD(NULL, "Protocols", szSetting, 1);
itoa(400 + p->pa->iOrder, szSetting, 10);
- db_set_dw(NULL, "Protocols", szSetting, iVal);
+ db_set_dw(0, "Protocols", szSetting, iVal);
p->pa->bIsVisible = iVal != 0;
itoa(600 + p->iSrcIndex, szSetting, 10);
iVal = myGetD(NULL, "Protocols", szSetting, 1);
itoa(600 + p->pa->iOrder, szSetting, 10);
- db_set_dw(NULL, "Protocols", szSetting, iVal);
+ db_set_dw(0, "Protocols", szSetting, iVal);
p->pa->bIsEnabled = iVal != 0;
if (p->tszSrcName == NULL) {
p->pa->tszAccountName = mir_a2u(p->pa->szModuleName);
itoa(800 + p->pa->iOrder, szSetting, 10);
- db_set_ws(NULL, "Protocols", szSetting, p->pa->tszAccountName);
+ db_set_ws(0, "Protocols", szSetting, p->pa->tszAccountName);
}
if (bImportSysAll)
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index d1a42b5c0a..6aabd7534a 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -72,11 +72,11 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.pszService = MS_IMPORT_CONTACT;
Menu_AddContactMenuItem(&mi);
- if (!db_get_b(NULL, IMPORT_MODULE, IMP_KEY_FR, 0)) {
+ if (!g_plugin.getByte(IMP_KEY_FR, 0)) {
// Only autorun import wizard if at least one protocol is installed
if (Accounts().getCount() > 0) {
CallService(MS_IMPORT_SERVICE, 0, 0);
- db_set_b(NULL, IMPORT_MODULE, IMP_KEY_FR, 1);
+ g_plugin.setByte(IMP_KEY_FR, 1);
}
}
return 0;
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp index 9a517d341c..c56d1b5557 100644 --- a/plugins/Import/src/miranda.cpp +++ b/plugins/Import/src/miranda.cpp @@ -268,7 +268,7 @@ CMirandaAdvOptionsPageDlg::CMirandaAdvOptionsPageDlg() : bool CMirandaAdvOptionsPageDlg::OnInitDialog()
{
- dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(0));
+ dwSinceDate = g_plugin.getDword("ImportSinceTS", time(0));
struct tm *TM = localtime(&dwSinceDate);
struct _SYSTEMTIME ST = { 0 };
@@ -329,7 +329,7 @@ void CMirandaAdvOptionsPageDlg::OnNext() dwSinceDate = mktime(&TM);
- db_set_dw(NULL, IMPORT_MODULE, "ImportSinceTS", dwSinceDate);
+ g_plugin.setDword("ImportSinceTS", dwSinceDate);
}
}
diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 8d99fcd3ab..ab5a45d246 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -76,7 +76,7 @@ void CFinishedPageDlg::OnNext() void CFinishedPageDlg::OnCancel()
{
if (IsDlgButtonChecked(m_hwnd, IDC_DONTLOADPLUGIN))
- db_set_b(NULL, "PluginDisable", "import", 1);
+ db_set_b(0, "PluginDisable", "import", 1);
CWizardPageDlg::OnCancel();
}
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp index 20c7888ba7..86b8c528aa 100644 --- a/plugins/KeyboardNotify/src/flash.cpp +++ b/plugins/KeyboardNotify/src/flash.cpp @@ -88,7 +88,7 @@ void setFlashingSequence(void) FLASHING_SEQUENCE *getCustomSeq(void)
{
- ptrW tszSeq( db_get_wsa(NULL, MODULENAME, fmtDBSettingName("custom%d", wCustomTheme)));
+ ptrW tszSeq( g_plugin.getWStringA(fmtDBSettingName("custom%d", wCustomTheme)));
static FLASHING_SEQUENCE Custom = {0};
Custom = str2FS((tszSeq != 0) ? tszSeq : L"");
@@ -317,8 +317,8 @@ void testSequence(wchar_t *testStr) static void __cdecl TestThread(void *param)
{
FLASHING_SEQUENCE *pTest = (FLASHING_SEQUENCE *)param;
- unsigned int testNum = (unsigned int)db_get_b(NULL, MODULENAME, "testnum", DEF_SETTING_TESTNUM);
- unsigned int testSecs = (unsigned int)db_get_b(NULL, MODULENAME, "testsecs", DEF_SETTING_TESTSECS);
+ unsigned int testNum = (unsigned int)g_plugin.getByte("testnum", DEF_SETTING_TESTNUM);
+ unsigned int testSecs = (unsigned int)g_plugin.getByte("testsecs", DEF_SETTING_TESTSECS);
for (unsigned i=0, dwEndTest=GetTickCount()+testSecs*1000; i < testNum || GetTickCount() < dwEndTest; i++)
for (pTest->index=0; pTest->index < pTest->size; pTest->index++) {
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 35abefc6d4..063a5a9432 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -33,9 +33,9 @@ static DWORD GetMask(MCONTACT hContact) mask=0;
else {
if(db_get_b(hContact, "CList", "Hidden", 0) || db_get_b(hContact, "CList", "NotOnList", 0))
- mask = db_get_dw(NULL, MODULENAME, "Mask1", 0);
+ mask = g_plugin.getDword("Mask1", 0);
else
- mask = db_get_dw(NULL, MODULENAME, "Default1", 0);
+ mask = g_plugin.getDword("Default1", 0);
}
}
return mask;
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index b243cd9c43..a551012d29 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -509,13 +509,13 @@ void StartBlinkAction(char *flashSequence, WORD eventMaxSeconds) void createProcessList(void)
{
- int count = db_get_w(NULL, MODULENAME, "processcount", 0);
+ int count = g_plugin.getWord("processcount", 0);
ProcessList.count = 0;
ProcessList.szFileName = (wchar_t **)mir_alloc(count * sizeof(wchar_t *));
if (ProcessList.szFileName) {
for (int i = 0; i < count; i++)
- ProcessList.szFileName[i] = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("process%d", i));
+ ProcessList.szFileName[i] = g_plugin.getWStringA(fmtDBSettingName("process%d", i));
ProcessList.count = count;
}
@@ -665,36 +665,36 @@ int UnhookWindowsHooks() void LoadSettings(void)
{
- bFlashOnMsg = db_get_b(NULL, MODULENAME, "onmsg", DEF_SETTING_ONMSG);
- bFlashOnURL = db_get_b(NULL, MODULENAME, "onurl", DEF_SETTING_ONURL);
- bFlashOnFile = db_get_b(NULL, MODULENAME, "onfile", DEF_SETTING_ONFILE);
- bFlashOnOther = db_get_b(NULL, MODULENAME, "onother", DEF_SETTING_OTHER);
- bFullScreenMode = db_get_b(NULL, MODULENAME, "fscreenmode", DEF_SETTING_FSCREEN);
- bScreenSaverRunning = db_get_b(NULL, MODULENAME, "ssaverrunning", DEF_SETTING_SSAVER);
- bWorkstationLocked = db_get_b(NULL, MODULENAME, "wstationlocked", DEF_SETTING_LOCKED);
- bProcessesAreRunning = db_get_b(NULL, MODULENAME, "procsrunning", DEF_SETTING_PROCS);
- bWorkstationActive = db_get_b(NULL, MODULENAME, "wstationactive", DEF_SETTING_ACTIVE);
- bFlashIfMsgOpen = db_get_b(NULL, MODULENAME, "ifmsgopen", DEF_SETTING_IFMSGOPEN);
- bFlashIfMsgWinNotTop = db_get_b(NULL, MODULENAME, "ifmsgnottop", DEF_SETTING_IFMSGNOTTOP);
- bFlashIfMsgOlder = db_get_b(NULL, MODULENAME, "ifmsgolder", DEF_SETTING_IFMSGOLDER);
- wSecondsOlder = db_get_w(NULL, MODULENAME, "secsolder", DEF_SETTING_SECSOLDER);
- bFlashUntil = db_get_b(NULL, MODULENAME, "funtil", DEF_SETTING_FLASHUNTIL);
- wBlinksNumber = db_get_w(NULL, MODULENAME, "nblinks", DEF_SETTING_NBLINKS);
- bMirandaOrWindows = db_get_b(NULL, MODULENAME, "mirorwin", DEF_SETTING_MIRORWIN);
- wStatusMap = db_get_w(NULL, MODULENAME, "status", DEF_SETTING_STATUS);
- wReminderCheck = db_get_w(NULL, MODULENAME, "remcheck", DEF_SETTING_CHECKTIME);
- bFlashLed[0] = db_get_b(NULL, MODULENAME, "fnum", DEF_SETTING_FLASHNUM);
- bFlashLed[1] = db_get_b(NULL, MODULENAME, "fcaps", DEF_SETTING_FLASHCAPS);
- bFlashLed[2] = db_get_b(NULL, MODULENAME, "fscroll", DEF_SETTING_FLASHSCROLL);
- bFlashEffect = db_get_b(NULL, MODULENAME, "feffect", DEF_SETTING_FLASHEFFECT);
- bSequenceOrder = db_get_b(NULL, MODULENAME, "order", DEF_SETTING_SEQORDER);
- wCustomTheme = db_get_w(NULL, MODULENAME, "custom", DEF_SETTING_CUSTOMTHEME);
- bTrillianLedsMsg = db_get_b(NULL, MODULENAME, "ledsmsg", DEF_SETTING_LEDSMSG);
- bTrillianLedsURL = db_get_b(NULL, MODULENAME, "ledsurl", DEF_SETTING_LEDSURL);
- bTrillianLedsFile = db_get_b(NULL, MODULENAME, "ledsfile", DEF_SETTING_LEDSFILE);
- bTrillianLedsOther = db_get_b(NULL, MODULENAME, "ledsother", DEF_SETTING_LEDSOTHER);
- wStartDelay = db_get_w(NULL, MODULENAME, "sdelay", DEF_SETTING_STARTDELAY);
- bFlashSpeed = db_get_b(NULL, MODULENAME, "speed", DEF_SETTING_FLASHSPEED);
+ bFlashOnMsg = g_plugin.getByte("onmsg", DEF_SETTING_ONMSG);
+ bFlashOnURL = g_plugin.getByte("onurl", DEF_SETTING_ONURL);
+ bFlashOnFile = g_plugin.getByte("onfile", DEF_SETTING_ONFILE);
+ bFlashOnOther = g_plugin.getByte("onother", DEF_SETTING_OTHER);
+ bFullScreenMode = g_plugin.getByte("fscreenmode", DEF_SETTING_FSCREEN);
+ bScreenSaverRunning = g_plugin.getByte("ssaverrunning", DEF_SETTING_SSAVER);
+ bWorkstationLocked = g_plugin.getByte("wstationlocked", DEF_SETTING_LOCKED);
+ bProcessesAreRunning = g_plugin.getByte("procsrunning", DEF_SETTING_PROCS);
+ bWorkstationActive = g_plugin.getByte("wstationactive", DEF_SETTING_ACTIVE);
+ bFlashIfMsgOpen = g_plugin.getByte("ifmsgopen", DEF_SETTING_IFMSGOPEN);
+ bFlashIfMsgWinNotTop = g_plugin.getByte("ifmsgnottop", DEF_SETTING_IFMSGNOTTOP);
+ bFlashIfMsgOlder = g_plugin.getByte("ifmsgolder", DEF_SETTING_IFMSGOLDER);
+ wSecondsOlder = g_plugin.getWord("secsolder", DEF_SETTING_SECSOLDER);
+ bFlashUntil = g_plugin.getByte("funtil", DEF_SETTING_FLASHUNTIL);
+ wBlinksNumber = g_plugin.getWord("nblinks", DEF_SETTING_NBLINKS);
+ bMirandaOrWindows = g_plugin.getByte("mirorwin", DEF_SETTING_MIRORWIN);
+ wStatusMap = g_plugin.getWord("status", DEF_SETTING_STATUS);
+ wReminderCheck = g_plugin.getWord("remcheck", DEF_SETTING_CHECKTIME);
+ bFlashLed[0] = g_plugin.getByte("fnum", DEF_SETTING_FLASHNUM);
+ bFlashLed[1] = g_plugin.getByte("fcaps", DEF_SETTING_FLASHCAPS);
+ bFlashLed[2] = g_plugin.getByte("fscroll", DEF_SETTING_FLASHSCROLL);
+ bFlashEffect = g_plugin.getByte("feffect", DEF_SETTING_FLASHEFFECT);
+ bSequenceOrder = g_plugin.getByte("order", DEF_SETTING_SEQORDER);
+ wCustomTheme = g_plugin.getWord("custom", DEF_SETTING_CUSTOMTHEME);
+ bTrillianLedsMsg = g_plugin.getByte("ledsmsg", DEF_SETTING_LEDSMSG);
+ bTrillianLedsURL = g_plugin.getByte("ledsurl", DEF_SETTING_LEDSURL);
+ bTrillianLedsFile = g_plugin.getByte("ledsfile", DEF_SETTING_LEDSFILE);
+ bTrillianLedsOther = g_plugin.getByte("ledsother", DEF_SETTING_LEDSOTHER);
+ wStartDelay = g_plugin.getWord("sdelay", DEF_SETTING_STARTDELAY);
+ bFlashSpeed = g_plugin.getByte("speed", DEF_SETTING_FLASHSPEED);
switch (bFlashSpeed) {
case 0: nWaitDelay = 1500; break;
case 1: nWaitDelay = 0750; break;
@@ -704,19 +704,19 @@ void LoadSettings(void) default: nWaitDelay = 0050; break;
}
setFlashingSequence();
- bEmulateKeypresses = db_get_b(NULL, MODULENAME, "keypresses", DEF_SETTING_KEYPRESSES);
- bOverride = db_get_b(NULL, MODULENAME, "override", DEF_SETTING_OVERRIDE);
+ bEmulateKeypresses = g_plugin.getByte("keypresses", DEF_SETTING_KEYPRESSES);
+ bOverride = g_plugin.getByte("override", DEF_SETTING_OVERRIDE);
// Create hidden settings (for test button) if needed
- if (db_get_b(NULL, MODULENAME, "testnum", -1) == -1)
- db_set_b(NULL, MODULENAME, "testnum", DEF_SETTING_TESTNUM);
- if (db_get_b(NULL, MODULENAME, "testsecs", -1) == -1)
- db_set_b(NULL, MODULENAME, "testsecs", DEF_SETTING_TESTSECS);
+ if (g_plugin.getByte("testnum", -1) == -1)
+ g_plugin.setByte("testnum", DEF_SETTING_TESTNUM);
+ if (g_plugin.getByte("testsecs", -1) == -1)
+ g_plugin.setByte("testsecs", DEF_SETTING_TESTSECS);
for (int i = 0; i < ProtoList.protoCount; i++)
if (ProtoList.protoInfo[i].visible) {
unsigned int j;
- ProtoList.protoInfo[i].enabled = db_get_b(NULL, MODULENAME, ProtoList.protoInfo[i].szProto, DEF_SETTING_PROTOCOL);
+ ProtoList.protoInfo[i].enabled = g_plugin.getByte(ProtoList.protoInfo[i].szProto, DEF_SETTING_PROTOCOL);
for (j = 0; j < ProtoList.protoInfo[i].xstatus.count; j++)
- ProtoList.protoInfo[i].xstatus.enabled[j] = db_get_b(NULL, MODULENAME, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), DEF_SETTING_XSTATUS);
+ ProtoList.protoInfo[i].xstatus.enabled[j] = g_plugin.getByte(fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), DEF_SETTING_XSTATUS);
}
bMetaProtoEnabled = db_mc_isEnabled();
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index a7cb0b5128..273d87793c 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -65,10 +65,10 @@ void exportThemes(const wchar_t *filename) fwprintf(fExport, TranslateT("\n; Automatically generated Keyboard Notify Theme file\n\n\n")); wchar_t *szTheme; - for (int i = 0; szTheme = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("theme%d", i)); i++) { + for (int i = 0; szTheme = g_plugin.getWStringA(fmtDBSettingName("theme%d", i)); i++) { fwprintf(fExport, L"[%s]\n", szTheme); mir_free(szTheme); - if (szTheme = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("custom%d", i))) { + if (szTheme = g_plugin.getWStringA(fmtDBSettingName("custom%d", i))) { fwprintf(fExport, L"%s\n\n", szTheme); mir_free(szTheme); } @@ -551,7 +551,7 @@ static INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM, LPAR for (int i = 0; i < ListView_GetItemCount(hList); i++) { lvItem.iItem = i; ListView_GetItem(hList, &lvItem); - db_set_b(NULL, MODULENAME, (char *)lvItem.lParam, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); + g_plugin.setByte((char *)lvItem.lParam, (BYTE)ListView_GetCheckState(hList, lvItem.iItem)); } } @@ -750,21 +750,21 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, MODULENAME, "onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1 : 0)); - - db_set_b(NULL, MODULENAME, "fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1 : 0)); - - db_set_b(NULL, MODULENAME, "ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1 : 0)); - db_set_w(NULL, MODULENAME, "secsolder", (WORD)SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_GETPOS, 0, 0)); + g_plugin.setByte("onmsg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONMESSAGE) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("onurl", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONURL) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("onfile", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONFILE) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("onother", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ONOTHER) == BST_CHECKED ? 1 : 0)); + + g_plugin.setByte("fscreenmode", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_FSCREEN) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ssaverrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SSAVER) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("wstationlocked", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_LOCKED) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("procsrunning", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PGMS) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("wstationactive", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ACTIVE) == BST_CHECKED ? 1 : 0)); + + g_plugin.setByte("ifmsgopen", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ifmsgnottop", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFNOTTOP) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("ifmsgolder", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED ? 1 : 0)); + g_plugin.setWord("secsolder", (WORD)SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_GETPOS, 0, 0)); if (IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED) untilMap |= UNTIL_NBLINKS; @@ -774,9 +774,9 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara untilMap |= UNTIL_EVENTSOPEN; if (IsDlgButtonChecked(hwndDlg, IDC_UNTILCOND) == BST_CHECKED) untilMap |= UNTIL_CONDITIONS; - db_set_b(NULL, MODULENAME, "funtil", untilMap); - db_set_w(NULL, MODULENAME, "nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, MODULENAME, "mirorwin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETCURSEL, 0, 0), 0)); + g_plugin.setByte("funtil", untilMap); + g_plugin.setWord("nblinks", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); + g_plugin.setByte("mirorwin", (BYTE)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_GETCURSEL, 0, 0), 0)); if (IsDlgButtonChecked(hwndDlg, IDC_ONLINE) == BST_CHECKED) statusMap |= MAP_ONLINE; @@ -798,21 +798,21 @@ static INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wPara statusMap |= MAP_OUTTOLUNCH; if (IsDlgButtonChecked(hwndDlg, IDC_OFFLINE) == BST_CHECKED) statusMap |= MAP_OFFLINE; - db_set_w(NULL, MODULENAME, "status", statusMap); + g_plugin.setWord("status", statusMap); - db_set_w(NULL, MODULENAME, "remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0)); + g_plugin.setWord("remcheck", (WORD)SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_GETPOS, 0, 0)); int i = 0; for (int j = 0; j < ProcessListAux.count; j++) if (ProcessListAux.szFileName[j]) - db_set_ws(NULL, MODULENAME, fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); - db_set_w(NULL, MODULENAME, "processcount", (WORD)i); - while (!db_unset(NULL, MODULENAME, fmtDBSettingName("process%d", i++))); + g_plugin.setWString(fmtDBSettingName("process%d", i++), ProcessListAux.szFileName[j]); + g_plugin.setWord("processcount", (WORD)i); + while (!g_plugin.delSetting(fmtDBSettingName("process%d", i++))); if (XstatusListAux) for (i = 0; i < ProtoList.protoCount; i++) for (int j = 0; j < (int)XstatusListAux[i].count; j++) - db_set_b(NULL, MODULENAME, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), (BYTE)XstatusListAux[i].enabled[j]); + g_plugin.setByte(fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), (BYTE)XstatusListAux[i].enabled[j]); LoadSettings(); @@ -863,7 +863,7 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_CUSTOM, bFlashEffect == FLASH_CUSTOM ? BST_CHECKED : BST_UNCHECKED); wchar_t *szTheme; - for (int i = 0; szTheme = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("theme%d", i)); i++) { + for (int i = 0; szTheme = g_plugin.getWStringA(fmtDBSettingName("theme%d", i)); i++) { int index = SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)szTheme); mir_free(szTheme); if (index != CB_ERR && index != CB_ERRSPACE) @@ -941,33 +941,33 @@ static INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wPar case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_b(NULL, MODULENAME, "fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1 : 0)); - db_set_b(NULL, MODULENAME, "fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("fnum", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NUM) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("fcaps", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CAPS) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("fscroll", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCROLL) == BST_CHECKED ? 1 : 0)); if (IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) - db_set_b(NULL, MODULENAME, "feffect", FLASH_INTURN); + g_plugin.setByte("feffect", FLASH_INTURN); else if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) - db_set_b(NULL, MODULENAME, "feffect", FLASH_INSEQUENCE); + g_plugin.setByte("feffect", FLASH_INSEQUENCE); else if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) - db_set_b(NULL, MODULENAME, "feffect", FLASH_CUSTOM); + g_plugin.setByte("feffect", FLASH_CUSTOM); else if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) - db_set_b(NULL, MODULENAME, "feffect", FLASH_TRILLIAN); + g_plugin.setByte("feffect", FLASH_TRILLIAN); else - db_set_b(NULL, MODULENAME, "feffect", FLASH_SAMETIME); - db_set_b(NULL, MODULENAME, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); - db_set_w(NULL, MODULENAME, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0)); + g_plugin.setByte("feffect", FLASH_SAMETIME); + g_plugin.setByte("order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); + g_plugin.setWord("custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0)); - db_set_b(NULL, MODULENAME, "ledsmsg", trillianLedsMsg); - db_set_b(NULL, MODULENAME, "ledsfile", trillianLedsFile); - db_set_b(NULL, MODULENAME, "ledsurl", trillianLedsURL); - db_set_b(NULL, MODULENAME, "ledsother", trillianLedsOther); + g_plugin.setByte("ledsmsg", trillianLedsMsg); + g_plugin.setByte("ledsfile", trillianLedsFile); + g_plugin.setByte("ledsurl", trillianLedsURL); + g_plugin.setByte("ledsother", trillianLedsOther); - db_set_w(NULL, MODULENAME, "sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); + g_plugin.setWord("sdelay", (WORD)SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, MODULENAME, "speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); + g_plugin.setByte("speed", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)); - db_set_b(NULL, MODULENAME, "keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("keypresses", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_KEYPRESSES) == BST_CHECKED ? 1 : 0)); LoadSettings(); @@ -999,11 +999,11 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara SendDlgItemMessage(hwndDlg, IDC_CUSTOMSTRING, EM_LIMITTEXT, MAX_PATH, 0); wchar_t *szTheme; - for (int i = 0; szTheme = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("theme%d", i)); i++) { + for (int i = 0; szTheme = g_plugin.getWStringA(fmtDBSettingName("theme%d", i)); i++) { int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)szTheme); mir_free(szTheme); if (index != CB_ERR && index != CB_ERRSPACE) { - wchar_t *str = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("custom%d", i)); + wchar_t *str = g_plugin.getWStringA(fmtDBSettingName("custom%d", i)); if (str) SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)str); } @@ -1224,7 +1224,7 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - if (szTheme = db_get_wsa(NULL, MODULENAME, fmtDBSettingName("theme%d", wCustomTheme))) { + if (szTheme = g_plugin.getWStringA(fmtDBSettingName("theme%d", wCustomTheme))) { mir_wstrcpy(theme, szTheme); mir_free(szTheme); } @@ -1237,12 +1237,12 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); for (int i = 0; i < count; i++) { SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux); - db_set_ws(NULL, MODULENAME, fmtDBSettingName("theme%d", i), themeAux); + g_plugin.setWString(fmtDBSettingName("theme%d", i), themeAux); wchar_t *str = (wchar_t *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); if (str) - db_set_ws(NULL, MODULENAME, fmtDBSettingName("custom%d", i), str); + g_plugin.setWString(fmtDBSettingName("custom%d", i), str); else - db_set_ws(NULL, MODULENAME, fmtDBSettingName("custom%d", i), L""); + g_plugin.setWString(fmtDBSettingName("custom%d", i), L""); if (!mir_wstrcmp(theme, themeAux)) wCustomTheme = i; @@ -1251,14 +1251,14 @@ static INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wPara SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)i, (LPARAM)themeAux); SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)i, (LPARAM)i); } - for (int i = count; !db_unset(NULL, MODULENAME, fmtDBSettingName("theme%d", i)); i++) - db_unset(NULL, MODULENAME, fmtDBSettingName("custom%d", i)); + for (int i = count; !g_plugin.delSetting(fmtDBSettingName("theme%d", i)); i++) + g_plugin.delSetting(fmtDBSettingName("custom%d", i)); - db_set_w(NULL, MODULENAME, "custom", wCustomTheme); + g_plugin.setWord("custom", wCustomTheme); // Still updating here the the Flashing tab's controls SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - db_set_b(NULL, MODULENAME, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); + g_plugin.setByte("override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); return TRUE; } // switch code diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 1388406bca..187b2b4cf1 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -385,7 +385,7 @@ bool ListeningToEnabled(char *proto, bool ignoreGlobal) char setting[256];
mir_snprintf(setting, "%sEnabled", proto);
- return db_get_b(NULL, MODULENAME, setting, false) != 0;
+ return g_plugin.getByte(setting, false) != 0;
}
INT_PTR ListeningToEnabled(WPARAM wParam, LPARAM)
@@ -572,7 +572,7 @@ void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = nullptr) mir_free(fr[1]);
}
}
- else if (db_get_b(0, MODULENAME, "UseStatusMessage", 1) && ProtoServiceExists(proto, PS_SETAWAYMSG)) {
+ else if (g_plugin.getByte("UseStatusMessage", 1) && ProtoServiceExists(proto, PS_SETAWAYMSG)) {
int status = Proto_GetStatus(proto);
if (lti == nullptr)
CallProtoService(proto, PS_SETAWAYMSG, status, 0);
@@ -599,7 +599,7 @@ INT_PTR EnableListeningTo(char *proto, bool enabled) char setting[256];
mir_snprintf(setting, "%sEnabled", proto);
- db_set_b(NULL, MODULENAME, setting, enabled);
+ g_plugin.setByte(setting, enabled);
// Modify menu info
ProtocolInfo *info = GetProtoInfo(proto);
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 253580bc73..dfb8951922 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -314,7 +314,7 @@ void Click(HWND hWnd,BOOL execute) deletePopupsHandles((&(getEl(pid->id))->pq),TRUE);
if(settingNewest && (pid->id > settingNewestID) ){
- db_set_dw(NULL, MODULENAME, "LNNewestID", settingNewestID=pid->id);
+ g_plugin.setDword("LNNewestID", settingNewestID=pid->id);
}
if(execute && settingCommand[0] ) {
char tmpcommand[2*MAX_SETTING_STR];
@@ -694,7 +694,7 @@ void checkthread(void*) // remember newest id depending on options set
if (settingNewest&&settingEvenNonClicked && (noteID > settingNewestID))
- db_set_dw(NULL, MODULENAME, "LNNewestID", settingNewestID = noteID);
+ g_plugin.setDword("LNNewestID", settingNewestID = noteID);
//if(((!settingOnceOnly||(settingOnceOnly&&settingNonClickedOnly))&&existElem(noteID))||(settingNewest&&settingNewestID>=noteID))
//continue;
@@ -963,66 +963,66 @@ static void lookupLotusDefaultSettings(HWND hwndDlg) // get variables values stored in db.
static void LoadSettings()
{
- settingInterval = (INT)db_get_dw(NULL, MODULENAME, "LNInterval", 15);
- settingInterval1 = (INT)db_get_dw(NULL, MODULENAME, "LNInterval1", 0);
- settingKeepConnection = db_get_b(NULL, MODULENAME, "LNKeepConnection", 1);
+ settingInterval = (INT)g_plugin.getDword("LNInterval", 15);
+ settingInterval1 = (INT)g_plugin.getDword("LNInterval1", 0);
+ settingKeepConnection = g_plugin.getByte("LNKeepConnection", 1);
DBVARIANT dbv;
- if (!db_get_s(NULL, MODULENAME, "LNDatabase", &dbv)) {
+ if (!g_plugin.getString("LNDatabase", &dbv)) {
strncpy_s(settingDatabase, _countof(settingDatabase), dbv.pszVal, _countof(settingDatabase));
db_free(&dbv);
}
- if (!db_get_s(NULL, MODULENAME, "LNServer", &dbv)) {
+ if (!g_plugin.getString("LNServer", &dbv)) {
strncpy_s(settingServer, _countof(settingServer), dbv.pszVal, _countof(settingServer));
db_free(&dbv);
}
- if (!db_get_s(NULL, MODULENAME, "LNServerSec", &dbv)) {
+ if (!g_plugin.getString("LNServerSec", &dbv)) {
strncpy_s(settingServerSec, _countof(settingServerSec), dbv.pszVal, _countof(settingServerSec));
db_free(&dbv);
}
- if (!db_get_s(NULL, MODULENAME, "LNPassword", &dbv)) {
+ if (!g_plugin.getString("LNPassword", &dbv)) {
strncpy_s(settingPassword, _countof(settingPassword), dbv.pszVal, _countof(settingPassword));
db_free(&dbv);
}
- if (!db_get_s(NULL, MODULENAME, "LNCommand", &dbv, DBVT_ASCIIZ)) {
+ if (!g_plugin.getString("LNCommand", &dbv)) {
strncpy_s(settingCommand, _countof(settingCommand), dbv.pszVal, _countof(settingCommand));
db_free(&dbv);
}
- if (!db_get_s(NULL, MODULENAME, "LNParameters", &dbv, DBVT_ASCIIZ)) {
+ if (!g_plugin.getString("LNParameters", &dbv)) {
strncpy_s(settingParameters, _countof(settingParameters), dbv.pszVal, _countof(settingParameters));
db_free(&dbv);
}
- if (!db_get_ws(NULL, MODULENAME, "LNFilterSender", &dbv)) {
+ if (!g_plugin.getWString("LNFilterSender", &dbv)) {
wcsncpy_s(settingFilterSender, dbv.pwszVal, _TRUNCATE);
db_free(&dbv);
}
- if (!db_get_ws(NULL, MODULENAME, "LNFilterSubject", &dbv)) {
+ if (!g_plugin.getWString("LNFilterSubject", &dbv)) {
wcsncpy_s(settingFilterSubject, dbv.pwszVal, _TRUNCATE);
db_free(&dbv);
}
- if (!db_get_ws(NULL, MODULENAME, "LNFilterTo", &dbv)) {
+ if (!g_plugin.getWString("LNFilterTo", &dbv)) {
wcsncpy_s(settingFilterTo, dbv.pwszVal, _TRUNCATE);
db_free(&dbv);
}
- settingOnceOnly = db_get_b(NULL, MODULENAME, "LNOnceOnly", 0);
+ settingOnceOnly = g_plugin.getByte("LNOnceOnly", 0);
- settingNonClickedOnly = db_get_b(NULL, MODULENAME, "LNNonClickedOnly", 1);
- settingShowError = db_get_b(NULL, MODULENAME, "LNShowError", 1);
- settingSetColours = db_get_b(NULL, MODULENAME, "LNSetColours", 0);
- settingBgColor = (COLORREF)db_get_dw(NULL, MODULENAME, "LNBgColor", (DWORD)0xFFFFFF);
- settingFgColor = (COLORREF)db_get_dw(NULL, MODULENAME, "LNFgColor", (DWORD)0x000000);
- settingNewest = db_get_b(NULL, MODULENAME, "LNNewest", 0);
- settingEvenNonClicked = db_get_b(NULL, MODULENAME, "LNEvenNonClicked", 0);
- settingNewestID = (DWORD)db_get_dw(NULL, MODULENAME, "LNNewestID", 0);
- settingIniAnswer = db_get_b(NULL, MODULENAME, "LNIniAnswer", 0);
- settingIniCheck = db_get_b(NULL, MODULENAME, "LNIniCheck", 0);
+ settingNonClickedOnly = g_plugin.getByte("LNNonClickedOnly", 1);
+ settingShowError = g_plugin.getByte("LNShowError", 1);
+ settingSetColours = g_plugin.getByte("LNSetColours", 0);
+ settingBgColor = (COLORREF)g_plugin.getDword("LNBgColor", (DWORD)0xFFFFFF);
+ settingFgColor = (COLORREF)g_plugin.getDword("LNFgColor", (DWORD)0x000000);
+ settingNewest = g_plugin.getByte("LNNewest", 0);
+ settingEvenNonClicked = g_plugin.getByte("LNEvenNonClicked", 0);
+ settingNewestID = (DWORD)g_plugin.getDword("LNNewestID", 0);
+ settingIniAnswer = g_plugin.getByte("LNIniAnswer", 0);
+ settingIniCheck = g_plugin.getByte("LNIniCheck", 0);
for (int i = 0; i < STATUS_COUNT; i++) {
char buff[128];
mir_snprintf(buff, "LNStatus%d", i);
- settingStatus[i] = (db_get_b(0, MODULENAME, buff, 0) == 1);
+ settingStatus[i] = (g_plugin.getByte(buff, 0) == 1);
}
//lookupLotusDefaultSettings();
}
@@ -1031,30 +1031,30 @@ static void SaveSettings(HWND hwndDlg) {
char buff[128];
GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
- db_set_s(NULL, MODULENAME, "LNServer", settingServer);
- db_set_s(NULL, MODULENAME, "LNServerSec", settingServerSec);
- db_set_s(NULL, MODULENAME, "LNPassword", settingPassword);
- db_set_s(NULL, MODULENAME, "LNDatabase", settingDatabase);
- db_set_dw(NULL, MODULENAME, "LNInterval", settingInterval);
- db_set_dw(NULL, MODULENAME, "LNInterval1", settingInterval1);
- db_set_b(NULL, MODULENAME, "LNKeepConnection", settingKeepConnection);
- db_set_s(NULL, MODULENAME, "LNCommand", settingCommand);
- db_set_s(NULL, MODULENAME, "LNParameters", settingParameters);
- db_set_b(NULL, MODULENAME, "LNOnceOnly", settingOnceOnly);
- db_set_b(NULL, MODULENAME, "LNNonClickedOnly", settingNonClickedOnly);
- db_set_b(NULL, MODULENAME, "LNShowError", settingShowError);
- db_set_b(NULL, MODULENAME, "LNSetColours", settingSetColours);
- db_set_dw(NULL, MODULENAME, "LNBgColor", (DWORD)settingBgColor);
- db_set_dw(NULL, MODULENAME, "LNFgColor", (DWORD)settingFgColor);
- db_set_b(NULL, MODULENAME, "LNNewest", settingNewest);
- db_set_b(NULL, MODULENAME, "LNEvenNonClicked", settingEvenNonClicked);
- db_set_b(NULL, MODULENAME, "LNIniCheck", settingIniCheck);
- db_set_b(NULL, MODULENAME, "LNIniAnswer", settingIniAnswer);
+ g_plugin.setString("LNServer", settingServer);
+ g_plugin.setString("LNServerSec", settingServerSec);
+ g_plugin.setString("LNPassword", settingPassword);
+ g_plugin.setString("LNDatabase", settingDatabase);
+ g_plugin.setDword("LNInterval", settingInterval);
+ g_plugin.setDword("LNInterval1", settingInterval1);
+ g_plugin.setByte("LNKeepConnection", settingKeepConnection);
+ g_plugin.setString("LNCommand", settingCommand);
+ g_plugin.setString("LNParameters", settingParameters);
+ g_plugin.setByte("LNOnceOnly", settingOnceOnly);
+ g_plugin.setByte("LNNonClickedOnly", settingNonClickedOnly);
+ g_plugin.setByte("LNShowError", settingShowError);
+ g_plugin.setByte("LNSetColours", settingSetColours);
+ g_plugin.setDword("LNBgColor", (DWORD)settingBgColor);
+ g_plugin.setDword("LNFgColor", (DWORD)settingFgColor);
+ g_plugin.setByte("LNNewest", settingNewest);
+ g_plugin.setByte("LNEvenNonClicked", settingEvenNonClicked);
+ g_plugin.setByte("LNIniCheck", settingIniCheck);
+ g_plugin.setByte("LNIniAnswer", settingIniAnswer);
for (int i = 0; i < STATUS_COUNT; i++) {
mir_snprintf(buff, "LNStatus%d", i);
settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE);
- db_set_b(0, MODULENAME, buff, settingStatus[i] ? 1 : 0);
+ g_plugin.setByte(buff, settingStatus[i] ? 1 : 0);
}
settingFilterSender[0] = 0;
@@ -1064,7 +1064,7 @@ static void SaveSettings(HWND hwndDlg) wcscat_s(settingFilterSender, _countof(settingFilterSender), text);
wcscat_s(settingFilterSender, _countof(settingFilterSender), TEXT(";"));
}
- db_set_ws(NULL, MODULENAME, "LNFilterSender", settingFilterSender);
+ g_plugin.setWString("LNFilterSender", settingFilterSender);
settingFilterSubject[0] = 0;
for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCOUNT, 0, 0); i++) {
@@ -1073,7 +1073,7 @@ static void SaveSettings(HWND hwndDlg) wcscat_s(settingFilterSubject, _countof(settingFilterSubject), text);
wcscat_s(settingFilterSubject, _countof(settingFilterSubject), TEXT(";"));
}
- db_set_ws(NULL, MODULENAME, "LNFilterSubject", settingFilterSubject);
+ g_plugin.setWString("LNFilterSubject", settingFilterSubject);
settingFilterTo[0] = 0;
for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCOUNT, 0, 0); i++) {
@@ -1082,7 +1082,7 @@ static void SaveSettings(HWND hwndDlg) wcscat_s(settingFilterTo, _countof(settingFilterTo), text);
wcscat_s(settingFilterTo, _countof(settingFilterTo), TEXT(";"));
}
- db_set_ws(NULL, MODULENAME, "LNFilterTo", settingFilterTo);
+ g_plugin.setWString("LNFilterTo", settingFilterTo);
}
//callback function to speak with user interactions in options page
diff --git a/plugins/MagneticWindows/src/Options.cpp b/plugins/MagneticWindows/src/Options.cpp index 5af8e262f5..9718587a6d 100644 --- a/plugins/MagneticWindows/src/Options.cpp +++ b/plugins/MagneticWindows/src/Options.cpp @@ -64,9 +64,9 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP Options.SnapWidth = SendDlgItemMessage(hwndDlg, IDC_SLIDER_SNAPWIDTH, TBM_GETPOS, 0, 0); Options.ScriverWorkAround = (IsDlgButtonChecked(hwndDlg, IDC_CHK_SCRIVERWORKAROUND) == TRUE); - db_set_b(NULL, MODULENAME, "DoSnap", Options.DoSnap); - db_set_b(NULL, MODULENAME, "SnapWidth", Options.SnapWidth); - db_set_b(NULL, MODULENAME, "ScriverWorkAround", Options.ScriverWorkAround); + g_plugin.setByte("DoSnap", Options.DoSnap); + g_plugin.setByte("SnapWidth", Options.SnapWidth); + g_plugin.setByte("ScriverWorkAround", Options.ScriverWorkAround); break; } } @@ -89,7 +89,7 @@ int InitOptions(WPARAM wParam, LPARAM) void LoadOptions() { - Options.DoSnap = db_get_b(NULL, MODULENAME, "DoSnap", 1) != 0; - Options.SnapWidth = db_get_b(NULL, MODULENAME, "SnapWidth", cDefaultSnapWidth); - Options.ScriverWorkAround = db_get_b(NULL, MODULENAME, "ScriverWorkAround", 0) != 0; + Options.DoSnap = g_plugin.getByte("DoSnap", 1) != 0; + Options.SnapWidth = g_plugin.getByte("SnapWidth", cDefaultSnapWidth); + Options.ScriverWorkAround = g_plugin.getByte("ScriverWorkAround", 0) != 0; } diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index ab07749d10..c06be5f329 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -560,7 +560,7 @@ static INT_PTR onCopyID(WPARAM hContact, LPARAM) wchar_t szID[256], buffer[256];
GetID(hContact, szProto, szID, _countof(szID));
- if (db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_CIDN) {
+ if (g_plugin.getDword("flags", vf_default) & VF_CIDN) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (!pa->bOldProto)
mir_snwprintf(buffer, L"%s: %s", pa->tszAccountName, szID);
@@ -578,7 +578,7 @@ static INT_PTR onCopyID(WPARAM hContact, LPARAM) static INT_PTR onCopyStatusMsg(WPARAM hContact, LPARAM)
{
- DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default);
+ DWORD flags = g_plugin.getDword("flags", vf_default);
LPSTR module = GetContactProto(hContact);
if (!module)
@@ -704,7 +704,7 @@ static int isIgnored(MCONTACT hContact, int type) static INT_PTR onIgnore(WPARAM wparam, LPARAM lparam)
{
- if (db_get_b(NULL, MODULENAME, "ignorehide", 0) && (lparam == IGNOREEVENT_ALL))
+ if (g_plugin.getByte("ignorehide", 0) && (lparam == IGNOREEVENT_ALL))
db_set_b((MCONTACT)wparam, "CList", "Hidden", (isIgnored((MCONTACT)wparam, lparam) ? (byte)0 : (byte)1));
CallService(isIgnored((MCONTACT)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam);
@@ -739,7 +739,7 @@ static void ModifySubmenuItem(HGENMENU hItem, int checked, int hidden) // called when the contact-menu is built
static int BuildMenu(WPARAM wparam, LPARAM)
{
- DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default);
+ DWORD flags = g_plugin.getDword("flags", vf_default);
int j = 0, all = 0, hide = 0;
BOOL bIsOnline = FALSE, bShowAll = CTRL_IS_PRESSED;
MCONTACT hContact = (MCONTACT)wparam;
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 313ee51702..13512fff96 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -28,7 +28,7 @@ static const checkboxes[] = { INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default);
+ DWORD flags = g_plugin.getDword("flags", vf_default);
wchar_t buffer[64] = { 0 };
int i;
@@ -68,7 +68,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) for (auto &it : checkboxes)
mod_flags |= IsDlgButtonChecked(hdlg, it.idc) ? it.flag : 0;
- db_set_dw(NULL, MODULENAME, "flags", mod_flags);
+ g_plugin.setDword("flags", mod_flags);
return 1;
}
break;
diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index b316f3222b..03714b8c71 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -102,32 +102,32 @@ INT_PTR CALLBACK DlgProcOpts_Tab1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY){
//SaveOptions from tab1 mirfoxData to miranda database
mirfoxMiranda.getMirfoxData().leftClickSendMode = (MFENUM_SEND_MESSAGE_MODE)( 1 + (WORD)SendDlgItemMessage(hwndDlg, IDC1_COMBO1, CB_GETCURSEL, 0, 0));
- db_set_b(0, MODULENAME, "leftClickSendMode", (int)mirfoxMiranda.getMirfoxData().leftClickSendMode);
+ g_plugin.setByte("leftClickSendMode", (int)mirfoxMiranda.getMirfoxData().leftClickSendMode);
mirfoxMiranda.getMirfoxData().rightClickSendMode = (MFENUM_SEND_MESSAGE_MODE)( 1 + (WORD)SendDlgItemMessage(hwndDlg, IDC1_COMBO2, CB_GETCURSEL, 0, 0));
- db_set_b(0, MODULENAME, "rightClickSendMode", (int)mirfoxMiranda.getMirfoxData().rightClickSendMode);
+ g_plugin.setByte("rightClickSendMode", (int)mirfoxMiranda.getMirfoxData().rightClickSendMode);
mirfoxMiranda.getMirfoxData().middleClickSendMode = (MFENUM_SEND_MESSAGE_MODE)( 1 + (WORD)SendDlgItemMessage(hwndDlg, IDC1_COMBO3, CB_GETCURSEL, 0, 0));
- db_set_b(0, MODULENAME, "middleClickSendMode", (int)mirfoxMiranda.getMirfoxData().middleClickSendMode);
+ g_plugin.setByte("middleClickSendMode", (int)mirfoxMiranda.getMirfoxData().middleClickSendMode);
if (IsDlgButtonChecked(hwndDlg, IDC1_CHECK1) == BST_CHECKED){
mirfoxMiranda.getMirfoxData().setClientsProfilesFilterCheckbox(true);
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 1);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", 1);
} else {
mirfoxMiranda.getMirfoxData().setClientsProfilesFilterCheckbox(false);
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 2);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", 2);
}
if (IsDlgButtonChecked(hwndDlg, IDC1_CHECK2) == BST_CHECKED){
if (mirfoxMiranda.getMirfoxData().getAddAccountToContactNameCheckbox() != true){
mirfoxMiranda.getMirfoxData().setAddAccountToContactNameCheckbox(true);
- db_set_b(0, MODULENAME, "addAccountToContactNameCheckbox", 1);
+ g_plugin.setByte("addAccountToContactNameCheckbox", 1);
mirfoxMiranda.getMirfoxData().updateAllMirandaContactsNames(mirfoxMiranda.getSharedMemoryUtils());
}
} else {
if (mirfoxMiranda.getMirfoxData().getAddAccountToContactNameCheckbox() != false){
mirfoxMiranda.getMirfoxData().setAddAccountToContactNameCheckbox(false);
- db_set_b(0, MODULENAME, "addAccountToContactNameCheckbox", 2);
+ g_plugin.setByte("addAccountToContactNameCheckbox", 2);
mirfoxMiranda.getMirfoxData().updateAllMirandaContactsNames(mirfoxMiranda.getSharedMemoryUtils());
}
}
@@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM MFLogger* logger = MFLogger::getInstance();
logger->log_p(L"Options. Save clientsProfilesFilterString: [%s]", mirfoxMiranda.getMirfoxData().getClientsProfilesFilterStringPtr()->c_str());
- db_set_ws(0, MODULENAME, "clientsProfilesFilterString", mirfoxMiranda.getMirfoxData().getClientsProfilesFilterStringPtr()->c_str());
+ g_plugin.setWString("clientsProfilesFilterString", mirfoxMiranda.getMirfoxData().getClientsProfilesFilterStringPtr()->c_str());
//TODO fire actualization visableTo field at CSM record
@@ -641,9 +641,9 @@ INT_PTR CALLBACK DlgProcOpts_Tab3(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += accountId;
if (accountState == MFENUM_MIRANDAACCOUNT_STATE_OFF){
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 2);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 2);
} else {
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 1);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 1);
}
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 585a6bbdca..8e69fd7c72 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -351,7 +351,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) }
// show and focus window
- if (db_get_b(0, MODULENAME, "doNotFocusWhenOpenMW", 0) == 1){
+ if (g_plugin.getByte("doNotFocusWhenOpenMW", 0) == 1){
delete param;
return 0;
}
@@ -467,7 +467,7 @@ void MirandaUtils::translateOldDBNames() { //settings "clientsProfilesFilterCheckbox", "clientsProfilesFilterString"
int opt1KeyValue = db_get_b(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterCheckbox", 0);
if (opt1KeyValue != 0){
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", opt1KeyValue);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", opt1KeyValue);
db_unset(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterCheckbox");
logger->log(L"TranslateOldDBNames: 'clientsProfilesFilterCheckbox' db entry found and moved");
} else {
@@ -479,7 +479,7 @@ void MirandaUtils::translateOldDBNames() { INT_PTR opt2Result = db_get_s(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterString", &opt2Dbv, DBVT_WCHAR);
if (opt2Result == 0){ //success
std::wstring clientsProfilesFilterString = opt2Dbv.pwszVal;
- db_set_ws(0, MODULENAME, "clientsProfilesFilterString", clientsProfilesFilterString.c_str());
+ g_plugin.setWString("clientsProfilesFilterString", clientsProfilesFilterString.c_str());
db_unset(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterString");
logger->log(L"TranslateOldDBNames: 'clientsProfilesFilterString' db entry found and moved");
db_free(&opt2Dbv);
@@ -493,7 +493,7 @@ void MirandaUtils::translateOldDBNames() { mirandaAccountDBKey += pa->szModuleName;
int keyValue = db_get_b(0, OLD_PLUGIN_DB_ID, mirandaAccountDBKey.c_str(), 0);
if (keyValue != 0){
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), keyValue);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), keyValue);
db_unset(0, OLD_PLUGIN_DB_ID, mirandaAccountDBKey.c_str());
logger->log(L"TranslateOldDBNames: ACCOUNT db entry found and moved");
}
diff --git a/plugins/MirFox/src/MirfoxData.cpp b/plugins/MirFox/src/MirfoxData.cpp index 835f3d8c07..4f9611435d 100644 --- a/plugins/MirFox/src/MirfoxData.cpp +++ b/plugins/MirFox/src/MirfoxData.cpp @@ -268,7 +268,7 @@ void MirfoxData::refreshAccount_Add(SharedMemoryUtils& sharedMemoryUtils, char* MFENUM_MIRANDAACCOUNT_STATE getOrCreateAccountStateInDB(char* szModuleName);
std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += szModuleName;
- int keyValue = db_get_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 0);
+ int keyValue = g_plugin.getByte(mirandaAccountDBKey.c_str(), 0);
if (keyValue == 1 || keyValue == 2){
//setting exist
if (keyValue == 1){
@@ -280,10 +280,10 @@ void MirfoxData::refreshAccount_Add(SharedMemoryUtils& sharedMemoryUtils, char* //setting does not exist, or is invalid -> save default setting (1 - ON)
if (getAccountDefaultState(mirandaAccountItemPtr) == 1){ //on = 1
mirandaAccountItemPtr->accountState = MFENUM_MIRANDAACCOUNT_STATE_ON; //1
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 1);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 1);
} else { //off = 2
mirandaAccountItemPtr->accountState = MFENUM_MIRANDAACCOUNT_STATE_OFF; //2
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 2);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 2);
}
}
*/
@@ -337,7 +337,7 @@ void MirfoxData::refreshAccount_Delete(SharedMemoryUtils& sharedMemoryUtils, cha std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += szModuleName;
- db_unset(0, MODULENAME, mirandaAccountDBKey.c_str());
+ g_plugin.delSetting(mirandaAccountDBKey.c_str());
//del proto from SM
sharedMemoryUtils.refreshMsm_Delete('A', deletedId);
@@ -524,7 +524,7 @@ MirfoxData::createOrGetAccountStateFromDB(MirandaAccount* mirandaAccount){ std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += mirandaAccount->szModuleName;
- int keyValue = db_get_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 0);
+ int keyValue = g_plugin.getByte(mirandaAccountDBKey.c_str(), 0);
if (keyValue == 1 || keyValue == 2){
//setting exist
if (keyValue == 1){
@@ -535,10 +535,10 @@ MirfoxData::createOrGetAccountStateFromDB(MirandaAccount* mirandaAccount){ } else {
//setting does not exist, or is invalid -> save default setting (1 - ON)
if (getAccountDefaultState(mirandaAccount) == 1){ //on = 1
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 1);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 1);
return MFENUM_MIRANDAACCOUNT_STATE_ON; //1
} else { //off = 2
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 2);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 2);
return MFENUM_MIRANDAACCOUNT_STATE_OFF; //2
}
}
@@ -658,7 +658,7 @@ void MirfoxData::initializeOptions() {
//addAccountToContactNameCheckbox
- int opt2KeyValue = db_get_b(0, MODULENAME, "addAccountToContactNameCheckbox", 0);
+ int opt2KeyValue = g_plugin.getByte("addAccountToContactNameCheckbox", 0);
if (opt2KeyValue == 1 || opt2KeyValue == 2){
//setting exist
if (opt2KeyValue == 1){
@@ -669,12 +669,12 @@ void MirfoxData::initializeOptions() } else {
//setting does not exist, or is invalid -> save default setting (2 - false)
setAddAccountToContactNameCheckbox(false); //2
- db_set_b(0, MODULENAME, "addAccountToContactNameCheckbox", 2);
+ g_plugin.setByte("addAccountToContactNameCheckbox", 2);
}
//clientsProfilesFilterCheckbox
- int opt1KeyValue = db_get_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 0);
+ int opt1KeyValue = g_plugin.getByte("clientsProfilesFilterCheckbox", 0);
if (opt1KeyValue == 1 || opt1KeyValue == 2){
//setting exist
if (opt1KeyValue == 1){
@@ -685,53 +685,48 @@ void MirfoxData::initializeOptions() } else {
//setting does not exist, or is invalid -> save default setting (2 - false)
setClientsProfilesFilterCheckbox(false); //2
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 2);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", 2);
}
-
- //clientsProfilesFilterString
- DBVARIANT opt2Dbv = {0};
- INT_PTR opt2Result = db_get_s(0, MODULENAME, "clientsProfilesFilterString", &opt2Dbv, DBVT_WCHAR);
- if (opt2Result == 0){ //success
+ // clientsProfilesFilterString
+ ptrW opt2Result(g_plugin.getWStringA("clientsProfilesFilterString"));
+ if (opt2Result != nullptr) { // success
//option exists in DB, get value
- (* getClientsProfilesFilterStringPtr()) = opt2Dbv.pwszVal;
+ (* getClientsProfilesFilterStringPtr()) = opt2Result;
} else {
//option not exists in DB, set default value
(* getClientsProfilesFilterStringPtr()) = L"";
- db_set_ws(0, MODULENAME, "clientsProfilesFilterString", getClientsProfilesFilterStringPtr()->c_str());
+ g_plugin.setWString("clientsProfilesFilterString", getClientsProfilesFilterStringPtr()->c_str());
}
- db_free(&opt2Dbv);
-
-
- int opt3KeyValue = db_get_b(0, MODULENAME, "leftClickSendMode", 0);
+ int opt3KeyValue = g_plugin.getByte("leftClickSendMode", 0);
if (opt3KeyValue == MFENUM_SMM_ONLY_SEND || opt3KeyValue == MFENUM_SMM_SEND_AND_SHOW_MW || opt3KeyValue == MFENUM_SMM_ONLY_SHOW_MW){
//setting exist
leftClickSendMode = (MFENUM_SEND_MESSAGE_MODE)opt3KeyValue;
} else {
//setting does not exist, or is invalid -> save default setting (MFENUM_SMM_ONLY_SEND)
leftClickSendMode = MFENUM_SMM_ONLY_SEND;
- db_set_b(0, MODULENAME, "leftClickSendMode", MFENUM_SMM_ONLY_SEND);
+ g_plugin.setByte("leftClickSendMode", MFENUM_SMM_ONLY_SEND);
}
- int opt4KeyValue = db_get_b(0, MODULENAME, "rightClickSendMode", 0);
+ int opt4KeyValue = g_plugin.getByte("rightClickSendMode", 0);
if (opt4KeyValue == MFENUM_SMM_ONLY_SEND || opt4KeyValue == MFENUM_SMM_SEND_AND_SHOW_MW || opt4KeyValue == MFENUM_SMM_ONLY_SHOW_MW){
//setting exist
rightClickSendMode = (MFENUM_SEND_MESSAGE_MODE)opt4KeyValue;
} else {
//setting does not exist, or is invalid -> save default setting (MFENUM_SMM_SEND_AND_SHOW_MW)
rightClickSendMode = MFENUM_SMM_SEND_AND_SHOW_MW;
- db_set_b(0, MODULENAME, "rightClickSendMode", MFENUM_SMM_SEND_AND_SHOW_MW);
+ g_plugin.setByte("rightClickSendMode", MFENUM_SMM_SEND_AND_SHOW_MW);
}
- int opt5KeyValue = db_get_b(0, MODULENAME, "middleClickSendMode", 0);
+ int opt5KeyValue = g_plugin.getByte("middleClickSendMode", 0);
if (opt5KeyValue == MFENUM_SMM_ONLY_SEND || opt5KeyValue == MFENUM_SMM_SEND_AND_SHOW_MW || opt5KeyValue == MFENUM_SMM_ONLY_SHOW_MW){
//setting exist
middleClickSendMode = (MFENUM_SEND_MESSAGE_MODE)opt5KeyValue;
} else {
//setting does not exist, or is invalid -> save default setting (must be MFENUM_SMM_ONLY_SEND due to Firefox bug and crash)
middleClickSendMode = MFENUM_SMM_ONLY_SEND;
- db_set_b(0, MODULENAME, "middleClickSendMode", MFENUM_SMM_ONLY_SEND);
+ g_plugin.setByte("middleClickSendMode", MFENUM_SMM_ONLY_SEND);
}
diff --git a/plugins/MirLua/src/script.cpp b/plugins/MirLua/src/script.cpp index 2337a6737d..79f30e5399 100644 --- a/plugins/MirLua/src/script.cpp +++ b/plugins/MirLua/src/script.cpp @@ -56,17 +56,17 @@ bool CMLuaScript::IsBinary() const bool CMLuaScript::IsEnabled() const
{
- return db_get_b(NULL, MODULENAME, _T2A(scriptName), 1);
+ return g_plugin.getByte(_T2A(scriptName), 1);
}
void CMLuaScript::Enable()
{
- db_unset(NULL, MODULENAME, _T2A(scriptName));
+ g_plugin.delSetting(_T2A(scriptName));
}
void CMLuaScript::Disable()
{
- db_set_b(NULL, MODULENAME, _T2A(scriptName), 0);
+ g_plugin.setByte(_T2A(scriptName), 0);
}
ScriptStatus CMLuaScript::GetStatus() const
diff --git a/plugins/MirLua/src/utils.cpp b/plugins/MirLua/src/utils.cpp index d4a4578cd9..1292a25f50 100644 --- a/plugins/MirLua/src/utils.cpp +++ b/plugins/MirLua/src/utils.cpp @@ -21,7 +21,7 @@ void ShowNotification(const char *caption, const char *message, int flags, MCONT if (Miranda_IsTerminated()) return; - if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) + if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATA ppd = { 0 }; ppd.lchContact = hContact; @@ -44,7 +44,7 @@ void ObsoleteMethod(lua_State *L, const char *message) char text[512]; mir_snprintf(text, "%s is obsolete. %s", ar.name, message); Log(text); - if (db_get_b(NULL, MODULENAME, "PopupOnObsolete", 0)) + if (g_plugin.getByte("PopupOnObsolete", 0)) ShowNotification(MODULENAME, text, MB_OK | MB_ICONWARNING, NULL); } @@ -52,7 +52,7 @@ void ReportError(lua_State *L) { const char *message = lua_tostring(L, -1); Log(message); - if (db_get_b(NULL, MODULENAME, "PopupOnError", 0)) + if (g_plugin.getByte("PopupOnError", 0)) ShowNotification(MODULENAME, message, MB_OK | MB_ICONERROR); } diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp index d291e7269d..c6ff084d8b 100644 --- a/plugins/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/src/dllmain.cpp @@ -39,8 +39,8 @@ int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
- if (options.bHaveSecureIM && !db_get_b(0, MODULENAME, "sim_warned", 0)) {
- db_set_b(0, MODULENAME, "sim_warned", 1);
+ if (options.bHaveSecureIM && !g_plugin.getByte("sim_warned", 0)) {
+ g_plugin.setByte("sim_warned", 1);
options.default_policy = OTRL_POLICY_MANUAL_MOD;
SaveOptions();
MessageBox(nullptr, TranslateW(LANG_OTR_SECUREIM_TEXT), TranslateW(LANG_OTR_SECUREIM_TITLE), 0x30);
@@ -67,10 +67,10 @@ int CMPlugin::Load() Proto_RegisterModule(PROTOTYPE_ENCRYPTION, MODULENAME);
// remove us as a filter to all contacts - fix filter type problem
- if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) {
+ if(g_plugin.getByte("FilterOrderFix", 0) != 2) {
for (auto &hContact : Contacts())
Proto_RemoveFromContact(hContact, MODULENAME);
- db_set_b(0, MODULENAME, "FilterOrderFix", 2);
+ g_plugin.setByte("FilterOrderFix", 2);
}
// create our services
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 415fbc58d4..ecb07d9061 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -54,7 +54,7 @@ void LoadFilenames() void LoadOptions() { - options.default_policy = db_get_w(0, MODULENAME, "DefaultPolicy", OTRL_POLICY_OPPORTUNISTIC); + options.default_policy = g_plugin.getWord("DefaultPolicy", OTRL_POLICY_OPPORTUNISTIC); // deal with changed flags in proto.h and new interpretation of 'manual' mode (see common.h) switch(options.default_policy) { case OTRL_POLICY_MANUAL: @@ -69,13 +69,13 @@ void LoadOptions() options.default_policy = OTRL_POLICY_OPPORTUNISTIC; break; } - options.err_method = (ErrorDisplay)db_get_w(0, MODULENAME, "ErrorDisplay", ED_POP); - options.prefix_messages = (db_get_b(0, MODULENAME, "PrefixMessages", 0) == 1); - options.msg_inline = (db_get_b(0, MODULENAME, "MsgInline", 0) == 1); - options.msg_popup = (db_get_b(0, MODULENAME, "MsgPopup", 1) == 1); - options.delete_history = (db_get_b(0, MODULENAME, "NoHistory", 0) == 1); - options.delete_systeminfo = (db_get_b(0, MODULENAME, "NoSystemHistory", 0) == 1); - options.autoshow_verify = (db_get_b(0, MODULENAME, "AutoShowVerify", 1) == 1); + options.err_method = (ErrorDisplay)g_plugin.getWord("ErrorDisplay", ED_POP); + options.prefix_messages = (g_plugin.getByte("PrefixMessages", 0) == 1); + options.msg_inline = (g_plugin.getByte("MsgInline", 0) == 1); + options.msg_popup = (g_plugin.getByte("MsgPopup", 1) == 1); + options.delete_history = (g_plugin.getByte("NoHistory", 0) == 1); + options.delete_systeminfo = (g_plugin.getByte("NoSystemHistory", 0) == 1); + options.autoshow_verify = (g_plugin.getByte("AutoShowVerify", 1) == 1); DBVARIANT dbv; if (!db_get_utf(0, MODULENAME, "Prefix", &dbv)) { @@ -84,8 +84,8 @@ void LoadOptions() } else mir_strncpy(options.prefix, OPTIONS_DEFAULT_PREFIX, OPTIONS_PREFIXLEN); - options.end_offline = (db_get_b(0, MODULENAME, "EndOffline", 1) == 1); - options.end_window_close = (db_get_b(0, MODULENAME, "EndWindowClose", 0) == 1); + options.end_offline = (g_plugin.getByte("EndOffline", 1) == 1); + options.end_window_close = (g_plugin.getByte("EndWindowClose", 0) == 1); options.bHavePopups = 0 != ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_SHOWMESSAGE); options.bHaveSecureIM = 0 != ServiceExists("SecureIM/IsContactSecured"); @@ -95,20 +95,20 @@ void LoadOptions() void SaveOptions() { - db_set_w(0, MODULENAME, "DefaultPolicy", options.default_policy); - db_set_w(0, MODULENAME, "ErrorDisplay", (int)options.err_method); - db_set_b(0, MODULENAME, "PrefixMessages", options.prefix_messages ? 1 : 0); - db_set_b(0, MODULENAME, "MsgInline", options.msg_inline ? 1 : 0); - db_set_b(0, MODULENAME, "MsgPopup", options.msg_popup ? 1 : 0); + g_plugin.setWord("DefaultPolicy", options.default_policy); + g_plugin.setWord("ErrorDisplay", (int)options.err_method); + g_plugin.setByte("PrefixMessages", options.prefix_messages ? 1 : 0); + g_plugin.setByte("MsgInline", options.msg_inline ? 1 : 0); + g_plugin.setByte("MsgPopup", options.msg_popup ? 1 : 0); - db_set_b(0, MODULENAME, "NoHistory", options.delete_history ? 1 : 0); - db_set_b(0, MODULENAME, "NoSystemHistory", options.delete_systeminfo ? 1 : 0); - db_set_b(0, MODULENAME, "AutoShowVerify", options.autoshow_verify ? 1 : 0); + g_plugin.setByte("NoHistory", options.delete_history ? 1 : 0); + g_plugin.setByte("NoSystemHistory", options.delete_systeminfo ? 1 : 0); + g_plugin.setByte("AutoShowVerify", options.autoshow_verify ? 1 : 0); db_set_utf(0, MODULENAME, "Prefix", options.prefix); - db_set_b(0, MODULENAME, "EndOffline", options.end_offline ? 1 : 0); - db_set_b(0, MODULENAME, "EndWindowClose", options.end_window_close ? 1 : 0); + g_plugin.setByte("EndOffline", options.end_offline ? 1 : 0); + g_plugin.setByte("EndWindowClose", options.end_window_close ? 1 : 0); } extern "C" void set_context_contact(void *, ConnContext *context) diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 41cc3e307d..4d7bc37348 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -711,7 +711,7 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact, bool bEnable) // Don't send to protocols that are offline // Don't send to users who are not visible and // Don't send to users who are not on the visible list when you are in invisible mode. - if (!db_get_b(hContact, "SRMsg", "SupportTyping", db_get_b(NULL, "SRMsg", "DefaultTyping", 1))) + if (!db_get_b(hContact, "SRMsg", "SupportTyping", db_get_b(0, "SRMsg", "DefaultTyping", 1))) return; char *szProto = GetContactProto(hContact); @@ -732,7 +732,7 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact, bool bEnable) if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) return; if (db_get_b(hContact, "CList", "NotOnList", 0) - && !db_get_b(NULL, "SRMsg", "UnknownTyping", 1)) + && !db_get_b(0, "SRMsg", "UnknownTyping", 1)) return; // End user check CallService(MS_PROTO_SELFISTYPING, hContact, bEnable ? PROTOTYPE_SELFTYPING_ON : PROTOTYPE_SELFTYPING_OFF); diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 2efd773872..9416e4ef57 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -32,78 +32,78 @@ void CConfig::Shutdown() void CConfig::LoadSettings()
{
- m_abBoolSettings[SKIP_DRIVER_ERROR] = db_get_dw(NULL, "MirandaG15", "SkipDriverError", 0) != 0;
-
- m_abBoolSettings[SCREENSAVER_LOCK] = db_get_dw(NULL, "MirandaG15", "ScreensaverLock", 1) != 0;
- m_abBoolSettings[NOTIFY_SHOWPROTO] = db_get_dw(NULL, "MirandaG15", "NotifyShowProto", 0) != 0;
- m_abBoolSettings[NOTIFY_NICKCUTOFF] = db_get_dw(NULL, "MirandaG15", "NotifyNickCutoff", 0) != 0;
- m_abBoolSettings[NOTIFY_CHANNELCUTOFF] = db_get_dw(NULL, "MirandaG15", "NotifyChannelCutoff", 0) != 0;
-
- m_abBoolSettings[TRANSITIONS] = db_get_dw(NULL, "MirandaG15", "Transitions", 0) != 0;
- m_abBoolSettings[TIMESTAMP_SECONDS] = db_get_dw(NULL, "MirandaG15", "TimestampSeconds", 0) != 0;
- m_abBoolSettings[SESSION_TIMESTAMPS] = db_get_dw(NULL, "MirandaG15", "SessionTimestamps", 0) != 0;
- m_abBoolSettings[NOTIFY_TIMESTAMPS] = db_get_dw(NULL, "MirandaG15", "NotifyTimestamps", 0) != 0;
-
- m_abBoolSettings[CONTROL_BACKLIGHTS] = db_get_dw(NULL, "MirandaG15", "ControlBacklights", 0) != 0;
- m_abBoolSettings[HOOK_VOLUMEWHEEL] = db_get_dw(NULL, "MirandaG15", "HookVolumeWheel", 0) != 0;
-
- m_abBoolSettings[CLIST_SELECTION] = db_get_dw(NULL, "MirandaG15", "CListSelection", 1) != 0;
- m_abBoolSettings[CLIST_COLUMNS] = db_get_dw(NULL, "MirandaG15", "CListColumns", 0) != 0;
- m_abBoolSettings[CLIST_HIDEOFFLINE] = db_get_dw(NULL, "MirandaG15", "CListHideOffline", 1) != 0;
- m_abBoolSettings[CLIST_USEIGNORE] = db_get_dw(NULL, "MirandaG15", "CListUseIgnore", 1) != 0;
- m_abBoolSettings[CLIST_USEGROUPS] = db_get_dw(NULL, "MirandaG15", "CListUseGroups", 1) != 0;
- m_abBoolSettings[CLIST_SHOWPROTO] = db_get_dw(NULL, "MirandaG15", "CListShowProto", 1) != 0;
- m_abBoolSettings[CLIST_DRAWLINES] = db_get_dw(NULL, "MirandaG15", "CListDrawLines", 1) != 0;
- m_abBoolSettings[CLIST_COUNTERS] = db_get_dw(NULL, "MirandaG15", "CListCounters", 1) != 0;
- m_abBoolSettings[CLIST_POSITION] = db_get_dw(NULL, "MirandaG15", "CListPosition", 0) != 0;
-
- m_abBoolSettings[NOTIFY_IRC_MESSAGES] = db_get_dw(NULL, "MirandaG15", "NotifyIRCMessages", 1) != 0;
- m_abBoolSettings[NOTIFY_IRC_USERS] = db_get_dw(NULL, "MirandaG15", "NotifyIRCUsers", 0) != 0;
- m_abBoolSettings[NOTIFY_IRC_EMOTES] = db_get_dw(NULL, "MirandaG15", "NotifyIRCEmotes", 0) != 0;
- m_abBoolSettings[NOTIFY_IRC_NOTICES] = db_get_dw(NULL, "MirandaG15", "NotifyIRCNotices", 1) != 0;
- m_abBoolSettings[NOTIFY_IRC_CHANNEL] = db_get_dw(NULL, "MirandaG15", "NotifyIRCChannel", 0) != 0;
- m_abBoolSettings[NOTIFY_IRC_STATUS] = db_get_dw(NULL, "MirandaG15", "NotifyIRCStatus", 0) != 0;
-
- m_abBoolSettings[NOTIFY_PROTO_STATUS] = db_get_dw(NULL, "MirandaG15", "NotifyProtoStatus", 0) != 0;
- m_abBoolSettings[NOTIFY_PROTO_SIGNON] = db_get_dw(NULL, "MirandaG15", "NotifyProtoSignOn", 1) != 0;
- m_abBoolSettings[NOTIFY_PROTO_SIGNOFF] = db_get_dw(NULL, "MirandaG15", "NotifyProtoSignOff", 1) != 0;
- m_abBoolSettings[NOTIFY_MESSAGES] = db_get_dw(NULL, "MirandaG15", "NotifyMessages", 1) != 0;
- m_abBoolSettings[NOTIFY_SIGNON] = db_get_dw(NULL, "MirandaG15", "NotifySignOn", 1) != 0;
- m_abBoolSettings[NOTIFY_SIGNOFF] = db_get_dw(NULL, "MirandaG15", "NotifySignOff", 1) != 0;
- m_abBoolSettings[NOTIFY_STATUS] = db_get_dw(NULL, "MirandaG15", "NotifyStatus", 0) != 0;
- m_abBoolSettings[NOTIFY_SKIP_MESSAGES] = db_get_dw(NULL, "MirandaG15", "NotifySkipMessages", 1) != 0;
- m_abBoolSettings[NOTIFY_SKIP_SIGNON] = db_get_dw(NULL, "MirandaG15", "NotifySkipSignOn", 0) != 0;
- m_abBoolSettings[NOTIFY_SKIP_SIGNOFF] = db_get_dw(NULL, "MirandaG15", "NotifySkipSignOff", 0) != 0;
- m_abBoolSettings[NOTIFY_SKIP_STATUS] = db_get_dw(NULL, "MirandaG15", "NotifySkipStatus", 1) != 0;
- m_abBoolSettings[NOTIFY_NO_SKIP_REPLY] = db_get_dw(NULL, "MirandaG15", "NotifyNoSkipReply", 1) != 0;
- m_abBoolSettings[NOTIFY_URL] = db_get_dw(NULL, "MirandaG15", "NotifyURL", 1) != 0;
- m_abBoolSettings[NOTIFY_FILE] = db_get_dw(NULL, "MirandaG15", "NotifyFile", 1) != 0;
- m_abBoolSettings[NOTIFY_CONTACTS] = db_get_dw(NULL, "MirandaG15", "NotifyContacts", 1) != 0;
-
- m_abBoolSettings[SESSION_SCROLL_MAXIMIZED] = db_get_dw(NULL, "MirandaG15", "SessionScrollMaximized", 1) != 0;
- m_abBoolSettings[SESSION_REPLY_MAXIMIZED] = db_get_dw(NULL, "MirandaG15", "SessionReplyMaximized", 1) != 0;
- m_abBoolSettings[SESSION_LOADDB] = db_get_dw(NULL, "MirandaG15", "SessionLoadDB", 0) != 0;
- m_abBoolSettings[SESSION_MARKREAD] = db_get_dw(NULL, "MirandaG15", "SessionMarkRead", 1) != 0;
- m_abBoolSettings[SESSION_SENDRETURN] = db_get_dw(NULL, "MirandaG15", "SessionSendReturn", 0) != 0;
- m_abBoolSettings[SESSION_SHOWTYPING] = db_get_dw(NULL, "MirandaG15", "SessionShowTyping", 1) != 0;
- m_abBoolSettings[SESSION_SENDTYPING] = db_get_dw(NULL, "MirandaG15", "SessionSendTyping", 1) != 0;
- m_abBoolSettings[SESSION_SYMBOLS] = db_get_dw(NULL, "MirandaG15", "SessionSymbols", 0) != 0;
- m_abBoolSettings[SESSION_CLOSE] = db_get_dw(NULL, "MirandaG15", "SessionClose", 1) != 0;
-
- m_abBoolSettings[SHOW_LABELS] = db_get_dw(NULL, "MirandaG15", "ShowLabels", 1) != 0;
- m_abBoolSettings[MAXIMIZED_TITLE] = db_get_dw(NULL, "MirandaG15", "MaximizedTitle", 0) != 0;
- m_abBoolSettings[MAXIMIZED_LABELS] = db_get_dw(NULL, "MirandaG15", "MaximizedLabels", 1) != 0;
-
- m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET] = db_get_dw(NULL, "MirandaG15", "NotifyChannelCutoffOffset", 10);
- m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET] = db_get_dw(NULL, "MirandaG15", "NotifyNickCutoffOffset", 10);
- m_aiIntSettings[NOTIFY_DURATION] = db_get_dw(NULL, "MirandaG15", "NotifyDuration", 4);
- m_aiIntSettings[NOTIFY_LOGSIZE] = db_get_dw(NULL, "MirandaG15", "NotifyLogSize", 10);
- m_aiIntSettings[SESSION_LOGSIZE] = db_get_dw(NULL, "MirandaG15", "SessionLogSize", 10);
- m_aiIntSettings[SESSION_AUTOSCROLL] = db_get_dw(NULL, "MirandaG15", "SessionAutoScroll", SESSION_AUTOSCROLL_FIRST);
- m_aiIntSettings[SESSION_CLOSETIMER] = db_get_dw(NULL, "MirandaG15", "SessionCloseTimer", 15);
- m_aiIntSettings[NOTIFY_TITLE] = db_get_dw(NULL, "MirandaG15", "NotifyTitle", NOTIFY_TITLE_NAME);
- m_aiIntSettings[CLIST_GA] = db_get_dw(NULL, "MirandaG15", "CListGA", CLIST_GA_NONE);
- m_aiIntSettings[DEVICE] = db_get_dw(NULL, "MirandaG15", "Device", 0);
+ m_abBoolSettings[SKIP_DRIVER_ERROR] = db_get_dw(0, "MirandaG15", "SkipDriverError", 0) != 0;
+
+ m_abBoolSettings[SCREENSAVER_LOCK] = db_get_dw(0, "MirandaG15", "ScreensaverLock", 1) != 0;
+ m_abBoolSettings[NOTIFY_SHOWPROTO] = db_get_dw(0, "MirandaG15", "NotifyShowProto", 0) != 0;
+ m_abBoolSettings[NOTIFY_NICKCUTOFF] = db_get_dw(0, "MirandaG15", "NotifyNickCutoff", 0) != 0;
+ m_abBoolSettings[NOTIFY_CHANNELCUTOFF] = db_get_dw(0, "MirandaG15", "NotifyChannelCutoff", 0) != 0;
+
+ m_abBoolSettings[TRANSITIONS] = db_get_dw(0, "MirandaG15", "Transitions", 0) != 0;
+ m_abBoolSettings[TIMESTAMP_SECONDS] = db_get_dw(0, "MirandaG15", "TimestampSeconds", 0) != 0;
+ m_abBoolSettings[SESSION_TIMESTAMPS] = db_get_dw(0, "MirandaG15", "SessionTimestamps", 0) != 0;
+ m_abBoolSettings[NOTIFY_TIMESTAMPS] = db_get_dw(0, "MirandaG15", "NotifyTimestamps", 0) != 0;
+
+ m_abBoolSettings[CONTROL_BACKLIGHTS] = db_get_dw(0, "MirandaG15", "ControlBacklights", 0) != 0;
+ m_abBoolSettings[HOOK_VOLUMEWHEEL] = db_get_dw(0, "MirandaG15", "HookVolumeWheel", 0) != 0;
+
+ m_abBoolSettings[CLIST_SELECTION] = db_get_dw(0, "MirandaG15", "CListSelection", 1) != 0;
+ m_abBoolSettings[CLIST_COLUMNS] = db_get_dw(0, "MirandaG15", "CListColumns", 0) != 0;
+ m_abBoolSettings[CLIST_HIDEOFFLINE] = db_get_dw(0, "MirandaG15", "CListHideOffline", 1) != 0;
+ m_abBoolSettings[CLIST_USEIGNORE] = db_get_dw(0, "MirandaG15", "CListUseIgnore", 1) != 0;
+ m_abBoolSettings[CLIST_USEGROUPS] = db_get_dw(0, "MirandaG15", "CListUseGroups", 1) != 0;
+ m_abBoolSettings[CLIST_SHOWPROTO] = db_get_dw(0, "MirandaG15", "CListShowProto", 1) != 0;
+ m_abBoolSettings[CLIST_DRAWLINES] = db_get_dw(0, "MirandaG15", "CListDrawLines", 1) != 0;
+ m_abBoolSettings[CLIST_COUNTERS] = db_get_dw(0, "MirandaG15", "CListCounters", 1) != 0;
+ m_abBoolSettings[CLIST_POSITION] = db_get_dw(0, "MirandaG15", "CListPosition", 0) != 0;
+
+ m_abBoolSettings[NOTIFY_IRC_MESSAGES] = db_get_dw(0, "MirandaG15", "NotifyIRCMessages", 1) != 0;
+ m_abBoolSettings[NOTIFY_IRC_USERS] = db_get_dw(0, "MirandaG15", "NotifyIRCUsers", 0) != 0;
+ m_abBoolSettings[NOTIFY_IRC_EMOTES] = db_get_dw(0, "MirandaG15", "NotifyIRCEmotes", 0) != 0;
+ m_abBoolSettings[NOTIFY_IRC_NOTICES] = db_get_dw(0, "MirandaG15", "NotifyIRCNotices", 1) != 0;
+ m_abBoolSettings[NOTIFY_IRC_CHANNEL] = db_get_dw(0, "MirandaG15", "NotifyIRCChannel", 0) != 0;
+ m_abBoolSettings[NOTIFY_IRC_STATUS] = db_get_dw(0, "MirandaG15", "NotifyIRCStatus", 0) != 0;
+
+ m_abBoolSettings[NOTIFY_PROTO_STATUS] = db_get_dw(0, "MirandaG15", "NotifyProtoStatus", 0) != 0;
+ m_abBoolSettings[NOTIFY_PROTO_SIGNON] = db_get_dw(0, "MirandaG15", "NotifyProtoSignOn", 1) != 0;
+ m_abBoolSettings[NOTIFY_PROTO_SIGNOFF] = db_get_dw(0, "MirandaG15", "NotifyProtoSignOff", 1) != 0;
+ m_abBoolSettings[NOTIFY_MESSAGES] = db_get_dw(0, "MirandaG15", "NotifyMessages", 1) != 0;
+ m_abBoolSettings[NOTIFY_SIGNON] = db_get_dw(0, "MirandaG15", "NotifySignOn", 1) != 0;
+ m_abBoolSettings[NOTIFY_SIGNOFF] = db_get_dw(0, "MirandaG15", "NotifySignOff", 1) != 0;
+ m_abBoolSettings[NOTIFY_STATUS] = db_get_dw(0, "MirandaG15", "NotifyStatus", 0) != 0;
+ m_abBoolSettings[NOTIFY_SKIP_MESSAGES] = db_get_dw(0, "MirandaG15", "NotifySkipMessages", 1) != 0;
+ m_abBoolSettings[NOTIFY_SKIP_SIGNON] = db_get_dw(0, "MirandaG15", "NotifySkipSignOn", 0) != 0;
+ m_abBoolSettings[NOTIFY_SKIP_SIGNOFF] = db_get_dw(0, "MirandaG15", "NotifySkipSignOff", 0) != 0;
+ m_abBoolSettings[NOTIFY_SKIP_STATUS] = db_get_dw(0, "MirandaG15", "NotifySkipStatus", 1) != 0;
+ m_abBoolSettings[NOTIFY_NO_SKIP_REPLY] = db_get_dw(0, "MirandaG15", "NotifyNoSkipReply", 1) != 0;
+ m_abBoolSettings[NOTIFY_URL] = db_get_dw(0, "MirandaG15", "NotifyURL", 1) != 0;
+ m_abBoolSettings[NOTIFY_FILE] = db_get_dw(0, "MirandaG15", "NotifyFile", 1) != 0;
+ m_abBoolSettings[NOTIFY_CONTACTS] = db_get_dw(0, "MirandaG15", "NotifyContacts", 1) != 0;
+
+ m_abBoolSettings[SESSION_SCROLL_MAXIMIZED] = db_get_dw(0, "MirandaG15", "SessionScrollMaximized", 1) != 0;
+ m_abBoolSettings[SESSION_REPLY_MAXIMIZED] = db_get_dw(0, "MirandaG15", "SessionReplyMaximized", 1) != 0;
+ m_abBoolSettings[SESSION_LOADDB] = db_get_dw(0, "MirandaG15", "SessionLoadDB", 0) != 0;
+ m_abBoolSettings[SESSION_MARKREAD] = db_get_dw(0, "MirandaG15", "SessionMarkRead", 1) != 0;
+ m_abBoolSettings[SESSION_SENDRETURN] = db_get_dw(0, "MirandaG15", "SessionSendReturn", 0) != 0;
+ m_abBoolSettings[SESSION_SHOWTYPING] = db_get_dw(0, "MirandaG15", "SessionShowTyping", 1) != 0;
+ m_abBoolSettings[SESSION_SENDTYPING] = db_get_dw(0, "MirandaG15", "SessionSendTyping", 1) != 0;
+ m_abBoolSettings[SESSION_SYMBOLS] = db_get_dw(0, "MirandaG15", "SessionSymbols", 0) != 0;
+ m_abBoolSettings[SESSION_CLOSE] = db_get_dw(0, "MirandaG15", "SessionClose", 1) != 0;
+
+ m_abBoolSettings[SHOW_LABELS] = db_get_dw(0, "MirandaG15", "ShowLabels", 1) != 0;
+ m_abBoolSettings[MAXIMIZED_TITLE] = db_get_dw(0, "MirandaG15", "MaximizedTitle", 0) != 0;
+ m_abBoolSettings[MAXIMIZED_LABELS] = db_get_dw(0, "MirandaG15", "MaximizedLabels", 1) != 0;
+
+ m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET] = db_get_dw(0, "MirandaG15", "NotifyChannelCutoffOffset", 10);
+ m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET] = db_get_dw(0, "MirandaG15", "NotifyNickCutoffOffset", 10);
+ m_aiIntSettings[NOTIFY_DURATION] = db_get_dw(0, "MirandaG15", "NotifyDuration", 4);
+ m_aiIntSettings[NOTIFY_LOGSIZE] = db_get_dw(0, "MirandaG15", "NotifyLogSize", 10);
+ m_aiIntSettings[SESSION_LOGSIZE] = db_get_dw(0, "MirandaG15", "SessionLogSize", 10);
+ m_aiIntSettings[SESSION_AUTOSCROLL] = db_get_dw(0, "MirandaG15", "SessionAutoScroll", SESSION_AUTOSCROLL_FIRST);
+ m_aiIntSettings[SESSION_CLOSETIMER] = db_get_dw(0, "MirandaG15", "SessionCloseTimer", 15);
+ m_aiIntSettings[NOTIFY_TITLE] = db_get_dw(0, "MirandaG15", "NotifyTitle", NOTIFY_TITLE_NAME);
+ m_aiIntSettings[CLIST_GA] = db_get_dw(0, "MirandaG15", "CListGA", CLIST_GA_NONE);
+ m_aiIntSettings[DEVICE] = db_get_dw(0, "MirandaG15", "Device", 0);
for (int i = 0; i < FONT_SETTINGS; i++)
LoadFontSettings(i);
@@ -122,86 +122,86 @@ void CConfig::LoadSettings() pProtoFilter->strName = toTstring(pa->szModuleName);
strSetting = L"ProtoFilter_" + pProtoFilter->strName;
- pProtoFilter->bNotificationFilter = db_get_dw(NULL, "MirandaG15", toNarrowString(strSetting).c_str(), 1) != 0;
+ pProtoFilter->bNotificationFilter = db_get_dw(0, "MirandaG15", toNarrowString(strSetting).c_str(), 1) != 0;
strSetting = L"ProtoCListFilter_" + pProtoFilter->strName;
- pProtoFilter->bContactlistFilter = db_get_dw(NULL, "MirandaG15", toNarrowString(strSetting).c_str(), 1) != 0;
+ pProtoFilter->bContactlistFilter = db_get_dw(0, "MirandaG15", toNarrowString(strSetting).c_str(), 1) != 0;
m_ProtoList.push_back(pProtoFilter);
}
}
void CConfig::SaveSettings()
{
- db_set_dw(NULL, "MirandaG15", "SkipDriverError", m_abBoolSettings[SKIP_DRIVER_ERROR]);
-
- db_set_dw(NULL, "MirandaG15", "ScreensaverLock", m_abBoolSettings[SCREENSAVER_LOCK]);
- db_set_dw(NULL, "MirandaG15", "NotifyShowProto", m_abBoolSettings[NOTIFY_SHOWPROTO]);
- db_set_dw(NULL, "MirandaG15", "NotifyChannelCutoff", m_abBoolSettings[NOTIFY_CHANNELCUTOFF]);
- db_set_dw(NULL, "MirandaG15", "NotifyNickCutoff", m_abBoolSettings[NOTIFY_NICKCUTOFF]);
- db_set_dw(NULL, "MirandaG15", "Transitions", m_abBoolSettings[TRANSITIONS]);
- db_set_dw(NULL, "MirandaG15", "TimestampSeconds", m_abBoolSettings[TIMESTAMP_SECONDS]);
- db_set_dw(NULL, "MirandaG15", "SessionTimestamps", m_abBoolSettings[SESSION_TIMESTAMPS]);
- db_set_dw(NULL, "MirandaG15", "NotifyTimestamps", m_abBoolSettings[NOTIFY_TIMESTAMPS]);
-
- db_set_dw(NULL, "MirandaG15", "ControlBacklights", m_abBoolSettings[CONTROL_BACKLIGHTS]);
- db_set_dw(NULL, "MirandaG15", "HookVolumeWheel", m_abBoolSettings[HOOK_VOLUMEWHEEL]);
-
- db_set_dw(NULL, "MirandaG15", "CListSelection", m_abBoolSettings[CLIST_SELECTION]);
- db_set_dw(NULL, "MirandaG15", "CListColumns", m_abBoolSettings[CLIST_COLUMNS]);
- db_set_dw(NULL, "MirandaG15", "CListHideOffline", m_abBoolSettings[CLIST_HIDEOFFLINE]);
- db_set_dw(NULL, "MirandaG15", "CListUseIgnore", m_abBoolSettings[CLIST_USEIGNORE]);
- db_set_dw(NULL, "MirandaG15", "CListUseGroups", m_abBoolSettings[CLIST_USEGROUPS]);
- db_set_dw(NULL, "MirandaG15", "CListShowProto", m_abBoolSettings[CLIST_SHOWPROTO]);
- db_set_dw(NULL, "MirandaG15", "CListDrawLines", m_abBoolSettings[CLIST_DRAWLINES]);
- db_set_dw(NULL, "MirandaG15", "CListCounters", m_abBoolSettings[CLIST_COUNTERS]);
- db_set_dw(NULL, "MirandaG15", "CListPosition", m_abBoolSettings[CLIST_POSITION]);
-
- db_set_dw(NULL, "MirandaG15", "NotifyIRCMessages", m_abBoolSettings[NOTIFY_IRC_MESSAGES]);
- db_set_dw(NULL, "MirandaG15", "NotifyIRCUsers", m_abBoolSettings[NOTIFY_IRC_USERS]);
- db_set_dw(NULL, "MirandaG15", "NotifyIRCEmotes", m_abBoolSettings[NOTIFY_IRC_EMOTES]);
- db_set_dw(NULL, "MirandaG15", "NotifyIRCNotices", m_abBoolSettings[NOTIFY_IRC_NOTICES]);
- db_set_dw(NULL, "MirandaG15", "NotifyIRCChannel", m_abBoolSettings[NOTIFY_IRC_CHANNEL]);
- db_set_dw(NULL, "MirandaG15", "NotifyIRCStatus", m_abBoolSettings[NOTIFY_IRC_STATUS]);
-
- db_set_dw(NULL, "MirandaG15", "NotifyProtoStatus", m_abBoolSettings[NOTIFY_PROTO_STATUS]);
- db_set_dw(NULL, "MirandaG15", "NotifyProtoSignOn", m_abBoolSettings[NOTIFY_PROTO_SIGNON]);
- db_set_dw(NULL, "MirandaG15", "NotifyProtoSignOff", m_abBoolSettings[NOTIFY_PROTO_SIGNOFF]);
- db_set_dw(NULL, "MirandaG15", "NotifyMessages", m_abBoolSettings[NOTIFY_MESSAGES]);
- db_set_dw(NULL, "MirandaG15", "NotifySignOn", m_abBoolSettings[NOTIFY_SIGNON]);
- db_set_dw(NULL, "MirandaG15", "NotifySignOff", m_abBoolSettings[NOTIFY_SIGNOFF]);
- db_set_dw(NULL, "MirandaG15", "NotifyStatus", m_abBoolSettings[NOTIFY_STATUS]);
- db_set_dw(NULL, "MirandaG15", "NotifySkipMessages", m_abBoolSettings[NOTIFY_SKIP_MESSAGES]);
- db_set_dw(NULL, "MirandaG15", "NotifySkipSignOn", m_abBoolSettings[NOTIFY_SKIP_SIGNON]);
- db_set_dw(NULL, "MirandaG15", "NotifySkipSignOff", m_abBoolSettings[NOTIFY_SKIP_SIGNOFF]);
- db_set_dw(NULL, "MirandaG15", "NotifySkipStatus", m_abBoolSettings[NOTIFY_SKIP_STATUS]);
- db_set_dw(NULL, "MirandaG15", "NotifyNoSkipReply", m_abBoolSettings[NOTIFY_NO_SKIP_REPLY]);
- db_set_dw(NULL, "MirandaG15", "NotifyURL", m_abBoolSettings[NOTIFY_URL]);
- db_set_dw(NULL, "MirandaG15", "NotifyFile", m_abBoolSettings[NOTIFY_FILE]);
- db_set_dw(NULL, "MirandaG15", "NotifyContacts", m_abBoolSettings[NOTIFY_CONTACTS]);
-
- db_set_dw(NULL, "MirandaG15", "SessionScrollMaximized", m_abBoolSettings[SESSION_SCROLL_MAXIMIZED]);
- db_set_dw(NULL, "MirandaG15", "SessionReplyMaximized", m_abBoolSettings[SESSION_REPLY_MAXIMIZED]);
- db_set_dw(NULL, "MirandaG15", "SessionShowTyping", m_abBoolSettings[SESSION_SHOWTYPING]);
- db_set_dw(NULL, "MirandaG15", "SessionSendTyping", m_abBoolSettings[SESSION_SENDTYPING]);
- db_set_dw(NULL, "MirandaG15", "SessionLoadDB", m_abBoolSettings[SESSION_LOADDB]);
- db_set_dw(NULL, "MirandaG15", "SessionSendReturn", m_abBoolSettings[SESSION_SENDRETURN]);
- db_set_dw(NULL, "MirandaG15", "SessionMarkRead", m_abBoolSettings[SESSION_MARKREAD]);
- db_set_dw(NULL, "MirandaG15", "SessionSymbols", m_abBoolSettings[SESSION_SYMBOLS]);
- db_set_dw(NULL, "MirandaG15", "SessionClose", m_abBoolSettings[SESSION_CLOSE]);
-
- db_set_dw(NULL, "MirandaG15", "ShowLabels", m_abBoolSettings[SHOW_LABELS]);
- db_set_dw(NULL, "MirandaG15", "MaximizedTitle", m_abBoolSettings[MAXIMIZED_TITLE]);
- db_set_dw(NULL, "MirandaG15", "MaximizedLabels", m_abBoolSettings[MAXIMIZED_LABELS]);
-
- db_set_dw(NULL, "MirandaG15", "NotifyChannelCutoffOffset", m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET]);
- db_set_dw(NULL, "MirandaG15", "NotifyNickCutoffOffset", m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET]);
- db_set_dw(NULL, "MirandaG15", "NotifyDuration", m_aiIntSettings[NOTIFY_DURATION]);
- db_set_dw(NULL, "MirandaG15", "NotifyLogSize", m_aiIntSettings[NOTIFY_LOGSIZE]);
- db_set_dw(NULL, "MirandaG15", "SessionLogSize", m_aiIntSettings[SESSION_LOGSIZE]);
- db_set_dw(NULL, "MirandaG15", "NotifyTitle", m_aiIntSettings[NOTIFY_TITLE]);
- db_set_dw(NULL, "MirandaG15", "SessionAutoScroll", m_aiIntSettings[SESSION_AUTOSCROLL]);
- db_set_dw(NULL, "MirandaG15", "SessionCloseTimer", m_aiIntSettings[SESSION_CLOSETIMER]);
- db_set_dw(NULL, "MirandaG15", "CListGA", m_aiIntSettings[CLIST_GA]);
- db_set_dw(NULL, "MirandaG15", "Device", m_aiIntSettings[DEVICE]);
+ db_set_dw(0, "MirandaG15", "SkipDriverError", m_abBoolSettings[SKIP_DRIVER_ERROR]);
+
+ db_set_dw(0, "MirandaG15", "ScreensaverLock", m_abBoolSettings[SCREENSAVER_LOCK]);
+ db_set_dw(0, "MirandaG15", "NotifyShowProto", m_abBoolSettings[NOTIFY_SHOWPROTO]);
+ db_set_dw(0, "MirandaG15", "NotifyChannelCutoff", m_abBoolSettings[NOTIFY_CHANNELCUTOFF]);
+ db_set_dw(0, "MirandaG15", "NotifyNickCutoff", m_abBoolSettings[NOTIFY_NICKCUTOFF]);
+ db_set_dw(0, "MirandaG15", "Transitions", m_abBoolSettings[TRANSITIONS]);
+ db_set_dw(0, "MirandaG15", "TimestampSeconds", m_abBoolSettings[TIMESTAMP_SECONDS]);
+ db_set_dw(0, "MirandaG15", "SessionTimestamps", m_abBoolSettings[SESSION_TIMESTAMPS]);
+ db_set_dw(0, "MirandaG15", "NotifyTimestamps", m_abBoolSettings[NOTIFY_TIMESTAMPS]);
+
+ db_set_dw(0, "MirandaG15", "ControlBacklights", m_abBoolSettings[CONTROL_BACKLIGHTS]);
+ db_set_dw(0, "MirandaG15", "HookVolumeWheel", m_abBoolSettings[HOOK_VOLUMEWHEEL]);
+
+ db_set_dw(0, "MirandaG15", "CListSelection", m_abBoolSettings[CLIST_SELECTION]);
+ db_set_dw(0, "MirandaG15", "CListColumns", m_abBoolSettings[CLIST_COLUMNS]);
+ db_set_dw(0, "MirandaG15", "CListHideOffline", m_abBoolSettings[CLIST_HIDEOFFLINE]);
+ db_set_dw(0, "MirandaG15", "CListUseIgnore", m_abBoolSettings[CLIST_USEIGNORE]);
+ db_set_dw(0, "MirandaG15", "CListUseGroups", m_abBoolSettings[CLIST_USEGROUPS]);
+ db_set_dw(0, "MirandaG15", "CListShowProto", m_abBoolSettings[CLIST_SHOWPROTO]);
+ db_set_dw(0, "MirandaG15", "CListDrawLines", m_abBoolSettings[CLIST_DRAWLINES]);
+ db_set_dw(0, "MirandaG15", "CListCounters", m_abBoolSettings[CLIST_COUNTERS]);
+ db_set_dw(0, "MirandaG15", "CListPosition", m_abBoolSettings[CLIST_POSITION]);
+
+ db_set_dw(0, "MirandaG15", "NotifyIRCMessages", m_abBoolSettings[NOTIFY_IRC_MESSAGES]);
+ db_set_dw(0, "MirandaG15", "NotifyIRCUsers", m_abBoolSettings[NOTIFY_IRC_USERS]);
+ db_set_dw(0, "MirandaG15", "NotifyIRCEmotes", m_abBoolSettings[NOTIFY_IRC_EMOTES]);
+ db_set_dw(0, "MirandaG15", "NotifyIRCNotices", m_abBoolSettings[NOTIFY_IRC_NOTICES]);
+ db_set_dw(0, "MirandaG15", "NotifyIRCChannel", m_abBoolSettings[NOTIFY_IRC_CHANNEL]);
+ db_set_dw(0, "MirandaG15", "NotifyIRCStatus", m_abBoolSettings[NOTIFY_IRC_STATUS]);
+
+ db_set_dw(0, "MirandaG15", "NotifyProtoStatus", m_abBoolSettings[NOTIFY_PROTO_STATUS]);
+ db_set_dw(0, "MirandaG15", "NotifyProtoSignOn", m_abBoolSettings[NOTIFY_PROTO_SIGNON]);
+ db_set_dw(0, "MirandaG15", "NotifyProtoSignOff", m_abBoolSettings[NOTIFY_PROTO_SIGNOFF]);
+ db_set_dw(0, "MirandaG15", "NotifyMessages", m_abBoolSettings[NOTIFY_MESSAGES]);
+ db_set_dw(0, "MirandaG15", "NotifySignOn", m_abBoolSettings[NOTIFY_SIGNON]);
+ db_set_dw(0, "MirandaG15", "NotifySignOff", m_abBoolSettings[NOTIFY_SIGNOFF]);
+ db_set_dw(0, "MirandaG15", "NotifyStatus", m_abBoolSettings[NOTIFY_STATUS]);
+ db_set_dw(0, "MirandaG15", "NotifySkipMessages", m_abBoolSettings[NOTIFY_SKIP_MESSAGES]);
+ db_set_dw(0, "MirandaG15", "NotifySkipSignOn", m_abBoolSettings[NOTIFY_SKIP_SIGNON]);
+ db_set_dw(0, "MirandaG15", "NotifySkipSignOff", m_abBoolSettings[NOTIFY_SKIP_SIGNOFF]);
+ db_set_dw(0, "MirandaG15", "NotifySkipStatus", m_abBoolSettings[NOTIFY_SKIP_STATUS]);
+ db_set_dw(0, "MirandaG15", "NotifyNoSkipReply", m_abBoolSettings[NOTIFY_NO_SKIP_REPLY]);
+ db_set_dw(0, "MirandaG15", "NotifyURL", m_abBoolSettings[NOTIFY_URL]);
+ db_set_dw(0, "MirandaG15", "NotifyFile", m_abBoolSettings[NOTIFY_FILE]);
+ db_set_dw(0, "MirandaG15", "NotifyContacts", m_abBoolSettings[NOTIFY_CONTACTS]);
+
+ db_set_dw(0, "MirandaG15", "SessionScrollMaximized", m_abBoolSettings[SESSION_SCROLL_MAXIMIZED]);
+ db_set_dw(0, "MirandaG15", "SessionReplyMaximized", m_abBoolSettings[SESSION_REPLY_MAXIMIZED]);
+ db_set_dw(0, "MirandaG15", "SessionShowTyping", m_abBoolSettings[SESSION_SHOWTYPING]);
+ db_set_dw(0, "MirandaG15", "SessionSendTyping", m_abBoolSettings[SESSION_SENDTYPING]);
+ db_set_dw(0, "MirandaG15", "SessionLoadDB", m_abBoolSettings[SESSION_LOADDB]);
+ db_set_dw(0, "MirandaG15", "SessionSendReturn", m_abBoolSettings[SESSION_SENDRETURN]);
+ db_set_dw(0, "MirandaG15", "SessionMarkRead", m_abBoolSettings[SESSION_MARKREAD]);
+ db_set_dw(0, "MirandaG15", "SessionSymbols", m_abBoolSettings[SESSION_SYMBOLS]);
+ db_set_dw(0, "MirandaG15", "SessionClose", m_abBoolSettings[SESSION_CLOSE]);
+
+ db_set_dw(0, "MirandaG15", "ShowLabels", m_abBoolSettings[SHOW_LABELS]);
+ db_set_dw(0, "MirandaG15", "MaximizedTitle", m_abBoolSettings[MAXIMIZED_TITLE]);
+ db_set_dw(0, "MirandaG15", "MaximizedLabels", m_abBoolSettings[MAXIMIZED_LABELS]);
+
+ db_set_dw(0, "MirandaG15", "NotifyChannelCutoffOffset", m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET]);
+ db_set_dw(0, "MirandaG15", "NotifyNickCutoffOffset", m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET]);
+ db_set_dw(0, "MirandaG15", "NotifyDuration", m_aiIntSettings[NOTIFY_DURATION]);
+ db_set_dw(0, "MirandaG15", "NotifyLogSize", m_aiIntSettings[NOTIFY_LOGSIZE]);
+ db_set_dw(0, "MirandaG15", "SessionLogSize", m_aiIntSettings[SESSION_LOGSIZE]);
+ db_set_dw(0, "MirandaG15", "NotifyTitle", m_aiIntSettings[NOTIFY_TITLE]);
+ db_set_dw(0, "MirandaG15", "SessionAutoScroll", m_aiIntSettings[SESSION_AUTOSCROLL]);
+ db_set_dw(0, "MirandaG15", "SessionCloseTimer", m_aiIntSettings[SESSION_CLOSETIMER]);
+ db_set_dw(0, "MirandaG15", "CListGA", m_aiIntSettings[CLIST_GA]);
+ db_set_dw(0, "MirandaG15", "Device", m_aiIntSettings[DEVICE]);
// Save font settings
for (int i = 0; i < FONT_SETTINGS; i++)
@@ -212,9 +212,9 @@ void CConfig::SaveSettings() tstring strSetting = L"";
while (iter != m_ProtoList.end()) {
strSetting = L"ProtoFilter_" + (*iter)->strName;
- db_set_dw(NULL, "MirandaG15", toNarrowString(strSetting).c_str(), (*iter)->bNotificationFilter);
+ db_set_dw(0, "MirandaG15", toNarrowString(strSetting).c_str(), (*iter)->bNotificationFilter);
strSetting = L"ProtoCListFilter_" + (*iter)->strName;
- db_set_dw(NULL, "MirandaG15", toNarrowString(strSetting).c_str(), (*iter)->bContactlistFilter);
+ db_set_dw(0, "MirandaG15", toNarrowString(strSetting).c_str(), (*iter)->bContactlistFilter);
iter++;
}
@@ -282,7 +282,7 @@ void CConfig::SaveFontSettings(int iFont) // Height
mir_snprintf(szSetting, "Font%dHeight", iFont);
- db_set_b(NULL, "MirandaG15", szSetting, m_logfont[iFont].lfHeight);
+ db_set_b(0, "MirandaG15", szSetting, m_logfont[iFont].lfHeight);
// Style
int style = 0;
@@ -291,15 +291,15 @@ void CConfig::SaveFontSettings(int iFont) if (m_logfont[iFont].lfItalic)
style |= FONTF_ITALIC;
mir_snprintf(szSetting, "Font%dStyle", iFont);
- db_set_b(NULL, "MirandaG15", szSetting, style);
+ db_set_b(0, "MirandaG15", szSetting, style);
// Charset
mir_snprintf(szSetting, "Font%dCharset", iFont);
- db_set_b(NULL, "MirandaG15", szSetting, m_logfont[iFont].lfCharSet);
+ db_set_b(0, "MirandaG15", szSetting, m_logfont[iFont].lfCharSet);
// Name
mir_snprintf(szSetting, "Font%dName", iFont);
- db_set_ws(NULL, "MirandaG15", szSetting, m_logfont[iFont].lfFaceName);
+ db_set_ws(0, "MirandaG15", szSetting, m_logfont[iFont].lfFaceName);
UpdateFontSettings(iFont);
}
@@ -318,15 +318,15 @@ void CConfig::LoadFontSettings(int iFont) m_logfont[iFont].lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
// Height
mir_snprintf(szSetting, "Font%dHeight", iFont);
- m_logfont[iFont].lfHeight = (char)db_get_b(NULL, "MirandaG15", szSetting, -MulDiv(6, 96, 72));
+ m_logfont[iFont].lfHeight = (char)db_get_b(0, "MirandaG15", szSetting, -MulDiv(6, 96, 72));
// Style
mir_snprintf(szSetting, "Font%dStyle", iFont);
- int style = db_get_b(NULL, "MirandaG15", szSetting, 0);
+ int style = db_get_b(0, "MirandaG15", szSetting, 0);
m_logfont[iFont].lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
m_logfont[iFont].lfItalic = style & FONTF_ITALIC ? 1 : 0;
// Charset
mir_snprintf(szSetting, "Font%dCharset", iFont);
- m_logfont[iFont].lfCharSet = db_get_b(NULL, "MirandaG15", szSetting, DEFAULT_CHARSET);
+ m_logfont[iFont].lfCharSet = db_get_b(0, "MirandaG15", szSetting, DEFAULT_CHARSET);
// Name
mir_snprintf(szSetting, "Font%dName", iFont);
DBVARIANT dbv;
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 43126f5f0e..5b48ed6975 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -511,13 +511,13 @@ bool CContactList::CompareEntries(CListEntry<CContactListEntry*, CContactListGro //************************************************************************
void CContactList::RefreshList()
{
- if ((db_get_b(NULL, "MetaContacts", "Enabled", 1) != 0) != m_bUseMetaContacts ||
+ if ((db_get_b(0, "MetaContacts", "Enabled", 1) != 0) != m_bUseMetaContacts ||
CConfig::GetBoolSetting(CLIST_USEGROUPS) != m_bUseGroups) {
InitializeGroupObjects();
Clear();
}
m_bUseGroups = CConfig::GetBoolSetting(CLIST_USEGROUPS);
- m_bUseMetaContacts = db_get_b(NULL, "MetaContacts", "Enabled", 1) != 0;
+ m_bUseMetaContacts = db_get_b(0, "MetaContacts", "Enabled", 1) != 0;
CListEntry<CContactListEntry*, CContactListGroup*> *pContactEntry = nullptr;
MCONTACT hContact = db_find_first();
@@ -951,7 +951,7 @@ void CContactList::InitializeGroupObjects() for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
tstring strGroup = GetContactGroupPath(hContact);
char *szProto = GetContactProto(hContact);
- if (szProto && db_get_b(NULL, META_PROTO, "Enabled", 1) && !mir_strcmpi(szProto, META_PROTO)) {
+ if (szProto && db_get_b(0, META_PROTO, "Enabled", 1) && !mir_strcmpi(szProto, META_PROTO)) {
tstring strName = CAppletManager::GetContactDisplayname(hContact);
tstring strPath = L"";
if (CConfig::GetBoolSetting(CLIST_USEGROUPS))
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index ee0cd78a91..1db3743488 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -208,12 +208,12 @@ void LoadConfig() mir_snprintf(szNameFG, "FG%d", indx);
mir_snprintf(szNameBG, "BG%d", indx);
mir_snprintf(szNameTO, "TO%d", indx);
- options.FG[indx] = db_get_dw(NULL, MODULENAME, szNameFG, optionsDefault.FG[indx]);
- options.BG[indx] = db_get_dw(NULL, MODULENAME, szNameBG, optionsDefault.BG[indx]);
- options.Timeout[indx] = db_get_dw(NULL, MODULENAME, szNameTO, (DWORD)optionsDefault.Timeout[indx]);
+ options.FG[indx] = g_plugin.getDword(szNameFG, optionsDefault.FG[indx]);
+ options.BG[indx] = g_plugin.getDword(szNameBG, optionsDefault.BG[indx]);
+ options.Timeout[indx] = g_plugin.getDword(szNameTO, (DWORD)optionsDefault.Timeout[indx]);
}
- options.Sound = db_get_b(NULL, MODULENAME, "Sound", (DWORD)optionsDefault.Sound);
+ options.Sound = g_plugin.getByte("Sound", (DWORD)optionsDefault.Sound);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp index 672385c66c..1c42fc6734 100644 --- a/plugins/MsgPopup/src/options.cpp +++ b/plugins/MsgPopup/src/options.cpp @@ -103,11 +103,11 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l mir_snprintf(szNameBG, "BG%d", indx);
mir_snprintf(szNameTO, "TO%d", indx);
- DBWriteContactSettingDwordDef(NULL, MODULENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]);
- DBWriteContactSettingDwordDef(NULL, MODULENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]);
- DBWriteContactSettingDwordDef(NULL, MODULENAME, szNameTO, options.Timeout[indx], (DWORD)optionsDefault.Timeout[indx]);
+ DBWriteContactSettingDwordDef(0, MODULENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]);
+ DBWriteContactSettingDwordDef(0, MODULENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]);
+ DBWriteContactSettingDwordDef(0, MODULENAME, szNameTO, options.Timeout[indx], (DWORD)optionsDefault.Timeout[indx]);
}
- DBWriteContactSettingDwordDef(NULL, MODULENAME, "Sound", options.Sound, optionsDefault.Sound);
+ DBWriteContactSettingDwordDef(0, MODULENAME, "Sound", options.Sound, optionsDefault.Sound);
break;
}
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 418fa7ac58..c59068655c 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -179,8 +179,8 @@ int CLStreamRTFInfo::nOptimalReadLen = 3300; int CLStreamRTFInfo::nWriteHeader(char *pszTarget, int nLen)
{
- COLORREF cMyText = db_get_dw(NULL, "SRMsg", "Font3Col", RGB(64, 0, 128));
- COLORREF cYourText = db_get_dw(NULL, "SRMsg", "Font0Col", RGB(240, 0, 0));
+ COLORREF cMyText = db_get_dw(0, "SRMsg", "Font3Col", RGB(64, 0, 128));
+ COLORREF cYourText = db_get_dw(0, "SRMsg", "Font0Col", RGB(240, 0, 0));
char szRtfHeader[400];
int nSrcLen = mir_snprintf(szRtfHeader,
@@ -724,13 +724,13 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL) CHARFORMAT ncf = { 0 };
ncf.cbSize = sizeof(CHARFORMAT);
ncf.dwMask = CFM_BOLD | CFM_FACE | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE;
- ncf.dwEffects = db_get_dw(NULL, MODULENAME, szFileViewDB "TEffects", 0);
- ncf.yHeight = db_get_dw(NULL, MODULENAME, szFileViewDB "THeight", 165);
- wcsncpy_s(ncf.szFaceName, _DBGetStringW(NULL, MODULENAME, szFileViewDB "TFace", L"Courier New").c_str(), _TRUNCATE);
+ ncf.dwEffects = g_plugin.getDword(szFileViewDB "TEffects", 0);
+ ncf.yHeight = g_plugin.getDword(szFileViewDB "THeight", 165);
+ wcsncpy_s(ncf.szFaceName, _DBGetStringW(0, MODULENAME, szFileViewDB "TFace", L"Courier New").c_str(), _TRUNCATE);
if (!bUseSyntaxHL) {
ncf.dwMask |= CFM_COLOR;
- ncf.crTextColor = db_get_dw(NULL, MODULENAME, szFileViewDB "TColor", 0);
+ ncf.crTextColor = g_plugin.getDword(szFileViewDB "TColor", 0);
}
SendMessage(hRichEdit, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&ncf);
@@ -762,15 +762,15 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, InsertMenu(hSysMenu, 0, MF_STRING | MF_BYPOSITION, ID_FV_SAVE_AS_RTF, LPGENW("Save as RTF"));
InsertMenu(hSysMenu, 0, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr);
- BYTE bUseCC = (BYTE)db_get_b(NULL, MODULENAME, szFileViewDB "UseCC", 0);
+ BYTE bUseCC = (BYTE)g_plugin.getByte(szFileViewDB "UseCC", 0);
InsertMenu(hSysMenu, 0, MF_STRING | MF_BYPOSITION | (bUseCC ? MF_CHECKED : 0), ID_FV_COLOR, LPGENW("Color..."));
if (bUseCC)
- SendMessage(hRichEdit, EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, MODULENAME, szFileViewDB "CustomC", RGB(255, 255, 255)));
+ SendMessage(hRichEdit, EM_SETBKGNDCOLOR, 0, g_plugin.getDword(szFileViewDB "CustomC", RGB(255, 255, 255)));
InsertMenu(hSysMenu, 0, MF_STRING | MF_BYPOSITION, ID_FV_FONT, LPGENW("Font..."));
- bool bUseSyntaxHL = db_get_b(NULL, MODULENAME, szFileViewDB "UseSyntaxHL", 1) != 0;
+ bool bUseSyntaxHL = g_plugin.getByte(szFileViewDB "UseSyntaxHL", 1) != 0;
InsertMenu(hSysMenu, 0, MF_STRING | MF_BYPOSITION | (bUseSyntaxHL ? MF_CHECKED : 0), ID_FV_SYNTAX_HL, LPGENW("Syntax highlight"));
SetRichEditFont(hRichEdit, bUseSyntaxHL);
@@ -836,18 +836,18 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, LOGFONT lf = { 0 };
lf.lfHeight = 14L;
- DWORD dwEffects = db_get_dw(NULL, MODULENAME, szFileViewDB "TEffects", 0);
+ DWORD dwEffects = g_plugin.getDword(szFileViewDB "TEffects", 0);
lf.lfWeight = (dwEffects & CFE_BOLD) ? FW_BOLD : 0;
lf.lfUnderline = (dwEffects & CFE_UNDERLINE) != 0;
lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0;
lf.lfItalic = (dwEffects & CFE_ITALIC) != 0;
- wcsncpy_s(lf.lfFaceName, _DBGetStringW(NULL, MODULENAME, szFileViewDB "TFace", L"Courier New").c_str(), _TRUNCATE);
+ wcsncpy_s(lf.lfFaceName, _DBGetStringW(0, MODULENAME, szFileViewDB "TFace", L"Courier New").c_str(), _TRUNCATE);
CHOOSEFONT cf = { 0 };
cf.lStructSize = sizeof(cf);
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
- cf.rgbColors = db_get_dw(NULL, MODULENAME, szFileViewDB "TColor", 0);
+ cf.rgbColors = g_plugin.getDword(szFileViewDB "TColor", 0);
cf.Flags = CF_EFFECTS | CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
if (ChooseFont(&cf)) {
@@ -856,28 +856,28 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, (lf.lfStrikeOut ? CFE_STRIKEOUT : 0) |
(lf.lfUnderline ? CFE_UNDERLINE : 0);
- db_set_dw(NULL, MODULENAME, szFileViewDB "TEffects", dwEffects);
- db_set_dw(NULL, MODULENAME, szFileViewDB "THeight", cf.iPointSize * 2);
- db_set_dw(NULL, MODULENAME, szFileViewDB "TColor", cf.rgbColors);
- db_set_ws(NULL, MODULENAME, szFileViewDB "TFace", lf.lfFaceName);
+ g_plugin.setDword(szFileViewDB "TEffects", dwEffects);
+ g_plugin.setDword(szFileViewDB "THeight", cf.iPointSize * 2);
+ g_plugin.setDword(szFileViewDB "TColor", cf.rgbColors);
+ g_plugin.setWString(szFileViewDB "TFace", lf.lfFaceName);
SetRichEditFont(hRichEdit, bUseSyntaxHL);
}
return TRUE;
}
if ((wParam & 0xFFF0) == ID_FV_COLOR) {
- BYTE bUseCC = !db_get_b(NULL, MODULENAME, szFileViewDB "UseCC", 0);
+ BYTE bUseCC = !g_plugin.getByte(szFileViewDB "UseCC", 0);
if (bUseCC) {
CHOOSECOLOR cc = { 0 };
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hwndDlg;
- cc.rgbResult = db_get_dw(NULL, MODULENAME, szFileViewDB "CustomC", RGB(255, 255, 255));
+ cc.rgbResult = g_plugin.getDword(szFileViewDB "CustomC", RGB(255, 255, 255));
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
static COLORREF MyCustColors[16] = { 0xFFFFFFFF };
cc.lpCustColors = MyCustColors;
if (ChooseColor(&cc)) {
SendMessage(hRichEdit, EM_SETBKGNDCOLOR, 0, cc.rgbResult);
- db_set_dw(NULL, MODULENAME, szFileViewDB "CustomC", cc.rgbResult);
+ g_plugin.setDword(szFileViewDB "CustomC", cc.rgbResult);
}
else {
CommDlgExtendedError();
@@ -887,7 +887,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, else SendMessage(hRichEdit, EM_SETBKGNDCOLOR, TRUE, 0);
CheckMenuItem(hSysMenu, ID_FV_COLOR, MF_BYCOMMAND | (bUseCC ? MF_CHECKED : 0));
- db_set_b(NULL, MODULENAME, szFileViewDB "UseCC", bUseCC);
+ g_plugin.setByte(szFileViewDB "UseCC", bUseCC);
return TRUE;
}
@@ -899,7 +899,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, bUseSyntaxHL = !bUseSyntaxHL;
CheckMenuItem(hSysMenu, ID_FV_SYNTAX_HL, MF_BYCOMMAND | (bUseSyntaxHL ? MF_CHECKED : 0));
- db_set_b(NULL, MODULENAME, szFileViewDB "UseSyntaxHL", bUseSyntaxHL);
+ g_plugin.setByte(szFileViewDB "UseSyntaxHL", bUseSyntaxHL);
if (bUseSyntaxHL)
bLoadFile(hwndDlg, pclDlg);
diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index b4738b3193..5337cb88e0 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -144,12 +144,12 @@ int CMPlugin::Load() if (nMaxLineWidth > 0 && nMaxLineWidth < 5)
nMaxLineWidth = 5;
- g_sExportDir = _DBGetStringW(NULL, MODULENAME, "ExportDir", L"%dbpath%\\MsgExport\\");
- g_sDefaultFile = _DBGetStringW(NULL, MODULENAME, "DefaultFile", L"%nick%.txt");
+ g_sExportDir = _DBGetStringW(0, MODULENAME, "ExportDir", L"%dbpath%\\MsgExport\\");
+ g_sDefaultFile = _DBGetStringW(0, MODULENAME, "DefaultFile", L"%nick%.txt");
- g_sTimeFormat = _DBGetStringW(NULL, MODULENAME, "TimeFormat", L"d s");
+ g_sTimeFormat = _DBGetStringW(0, MODULENAME, "TimeFormat", L"d s");
- sFileViewerPrg = _DBGetStringW(NULL, MODULENAME, "FileViewerPrg", L"");
+ sFileViewerPrg = _DBGetStringW(0, MODULENAME, "FileViewerPrg", L"");
g_bUseIntViewer = getBool("UseInternalViewer", true);
g_bUseJson = getBool("UseJson", false);
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index cf207b9613..0215b02ff4 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -873,7 +873,7 @@ public: sItem.lParam = (LPARAM)pa->szModuleName;
listProtos.InsertItem(&sItem);
- listProtos.SetCheckState(sItem.iItem, db_get_b(NULL, MODULENAME, szTemp, 1));
+ listProtos.SetCheckState(sItem.iItem, g_plugin.getByte(szTemp, 1));
sItem.iItem++;
}
@@ -888,7 +888,7 @@ public: g_enRenameAction = eDAAutomatic;
else if (chkFcNothing.GetState() == BST_CHECKED)
g_enRenameAction = eDANothing;
- db_set_b(NULL, MODULENAME, "RenameAction", (BYTE)g_enRenameAction);
+ g_plugin.setByte("RenameAction", (BYTE)g_enRenameAction);
if (chkFdPrompt.GetState() == BST_CHECKED)
g_enDeleteAction = eDAPromptUser;
@@ -896,7 +896,7 @@ public: g_enDeleteAction = eDAAutomatic;
else if (chkFdNothing.GetState() == BST_CHECKED)
g_enDeleteAction = eDANothing;
- db_set_b(NULL, MODULENAME, "DeleteAction", (BYTE)g_enDeleteAction);
+ g_plugin.setByte("DeleteAction", (BYTE)g_enDeleteAction);
int nCount = listProtos.GetItemCount();
for (int nCur = 0; nCur < nCount; nCur++) {
@@ -907,9 +907,9 @@ public: char szTemp[200];
mir_snprintf(szTemp, "DisableProt_%s", (char*)sItem.lParam);
if (listProtos.GetCheckState(nCur))
- db_unset(NULL, MODULENAME, szTemp); // default is Enabled !!
+ g_plugin.delSetting(szTemp); // default is Enabled !!
else
- db_set_b(NULL, MODULENAME, szTemp, 0);
+ g_plugin.setByte(szTemp, 0);
}
}
return true;
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index bb74f6d96c..3ae4ac9ec4 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1017,7 +1017,7 @@ bool bIsExportEnabled(MCONTACT hContact) const char *szProto = GetContactProto(hContact);
char szTemp[500];
mir_snprintf(szTemp, "DisableProt_%s", szProto);
- if (!db_get_b(NULL, MODULENAME, szTemp, 1))
+ if (!g_plugin.getByte(szTemp, 1))
return false;
return true;
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index 1e2d693278..6038f89487 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -442,7 +442,7 @@ void ProtocolArray::SetNicks(const wchar_t *nick) mir_wstrncpy(default_nick, nick, _countof(default_nick));
- db_set_ws(0, MODULENAME, SETTING_DEFAULT_NICK, nick);
+ g_plugin.setWString(SETTING_DEFAULT_NICK, nick);
for (int i = 0; i < buffer_len; i++)
buffer[i]->SetNick(default_nick);
@@ -462,11 +462,11 @@ void ProtocolArray::SetStatusMsgs(const wchar_t *message) void ProtocolArray::SetStatusMsgs(int status, const wchar_t *message)
{
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status, "Msg"), message);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(status, "Msg"), message);
// Save default also
- if (!db_get_b(NULL, "SRAway", StatusModeToDbSetting(status, "UsePrev"), 0))
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status, "Default"), message);
+ if (!db_get_b(0, "SRAway", StatusModeToDbSetting(status, "UsePrev"), 0))
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(status, "Default"), message);
for (int i = 0; i < buffer_len; i++)
if (buffer[i]->status == status)
@@ -475,7 +475,7 @@ void ProtocolArray::SetStatusMsgs(int status, const wchar_t *message) void ProtocolArray::GetDefaultNick()
{
- ptrW tszNick(db_get_wsa(0, MODULENAME, SETTING_DEFAULT_NICK));
+ ptrW tszNick(g_plugin.getWStringA(SETTING_DEFAULT_NICK));
if (tszNick)
mir_wstrncpy(default_nick, tszNick, _countof(default_nick));
else
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index cc39049339..cfe97cb2d8 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -291,7 +291,7 @@ int CreateFrame() Frame.height = 100;
frame_id = g_plugin.addFrame(&Frame);
- if (db_get_b(NULL, "MyDetails", "ForceHideFrame", 0)) {
+ if (db_get_b(0, "MyDetails", "ForceHideFrame", 0)) {
int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
if (flags & F_VISIBLE)
CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0);
@@ -299,7 +299,7 @@ int CreateFrame() db_unset(NULL, "MyDetails", "ForceHideFrame");
}
- if (db_get_b(NULL, "MyDetails", "ForceShowFrame", 0)) {
+ if (db_get_b(0, "MyDetails", "ForceShowFrame", 0)) {
int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
if (!(flags & F_VISIBLE))
CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0);
@@ -345,7 +345,7 @@ int CreateFrame() hMenuShowHideFrame = Menu_AddMainMenuItem(&mi);
Menu_ConfigureItem(hMenuShowHideFrame, MCI_OPT_EXECPARAM, -0x7FFFFFFF);
- if (db_get_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 1) == 1) {
+ if (g_plugin.getByte(SETTING_FRAME_VISIBLE, 1) == 1) {
ShowWindow(hwnd_container, SW_SHOW);
FixMainMenu();
}
@@ -391,7 +391,7 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP return TRUE;
case WM_CLOSE:
- db_set_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 0);
+ g_plugin.setByte(SETTING_FRAME_VISIBLE, 0);
ShowWindow(hwnd, SW_HIDE);
FixMainMenu();
return TRUE;
@@ -1544,7 +1544,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar data->get_status_messages = false;
data->showing_menu = false;
- data->protocol_number = db_get_w(NULL, "MyDetails", "ProtocolNumber", 0);
+ data->protocol_number = db_get_w(0, "MyDetails", "ProtocolNumber", 0);
if (data->protocol_number >= protocols->GetSize())
data->protocol_number = 0;
@@ -2191,7 +2191,7 @@ INT_PTR ShowHideFrameFunc(WPARAM, LPARAM) SendMessage(hwnd_container, WM_CLOSE, 0, 0);
else {
ShowWindow(hwnd_container, SW_SHOW);
- db_set_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 1);
+ g_plugin.setByte(SETTING_FRAME_VISIBLE, 1);
}
FixMainMenu();
@@ -2209,7 +2209,7 @@ INT_PTR ShowFrameFunc(WPARAM, LPARAM) else {
if (!MyDetailsFrameVisible()) {
ShowWindow(hwnd_container, SW_SHOW);
- db_set_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 1);
+ g_plugin.setByte(SETTING_FRAME_VISIBLE, 1);
FixMainMenu();
}
@@ -2301,7 +2301,7 @@ void SetStatusMessageRefreshTime(HWND hwnd) {
KillTimer(hwnd, ID_STATUSMESSAGE_TIMER);
- opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12);
+ opts.refresh_status_message_timer = db_get_w(0, "MyDetails", "RefreshStatusMessageTimer", 12);
if (opts.refresh_status_message_timer > 0)
SetTimer(hwnd, ID_STATUSMESSAGE_TIMER, opts.refresh_status_message_timer * 1000, nullptr);
}
@@ -2317,7 +2317,7 @@ INT_PTR PluginCommand_ShowNextProtocol(WPARAM, LPARAM) if (data->protocol_number >= protocols->GetSize())
data->protocol_number = 0;
- db_set_w(NULL, "MyDetails", "ProtocolNumber", data->protocol_number);
+ db_set_w(0, "MyDetails", "ProtocolNumber", data->protocol_number);
data->recalc_rectangles = true;
@@ -2339,7 +2339,7 @@ INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM, LPARAM) if (data->protocol_number < 0)
data->protocol_number = protocols->GetSize() - 1;
- db_set_w(NULL, "MyDetails", "ProtocolNumber", data->protocol_number);
+ db_set_w(0, "MyDetails", "ProtocolNumber", data->protocol_number);
data->recalc_rectangles = true;
@@ -2373,7 +2373,7 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM, LPARAM lParam) MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
data->protocol_number = proto_num;
- db_set_w(NULL, "MyDetails", "ProtocolNumber", data->protocol_number);
+ db_set_w(0, "MyDetails", "ProtocolNumber", data->protocol_number);
data->recalc_rectangles = true;
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index 77b7c0dfb4..f4d123bbc9 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -63,8 +63,8 @@ void LoadOptions() LoadOpts(pageControls, _countof(pageControls), MODULENAME);
// This is created here to assert that this key always exists
- opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12);
- db_set_w(NULL, "MyDetails", "RefreshStatusMessageTimer", opts.refresh_status_message_timer);
+ opts.refresh_status_message_timer = db_get_w(0, "MyDetails", "RefreshStatusMessageTimer", 12);
+ db_set_w(0, "MyDetails", "RefreshStatusMessageTimer", opts.refresh_status_message_timer);
SetCycleTime();
RefreshFrameAndCalcRects();
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index 83b54b4c3c..9b543bf53a 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -455,7 +455,7 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam) INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam, LPARAM)
{
- db_set_b(NULL, "MyDetails", "CicleThroughtProtocols", (BYTE)wParam);
+ db_set_b(0, "MyDetails", "CicleThroughtProtocols", (BYTE)wParam);
LoadOptions();
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index e6daa9821e..66050a51b1 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -491,7 +491,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) }
else if (!mir_wstrcmp(ai->argv.w[0], VAR_MYNICK)) {
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_MYNICKPERPROTO) && VarParseData.szProto)
- Result = db_get_s(NULL, VarParseData.szProto, "Nick", (wchar_t*)nullptr);
+ Result = db_get_s(0, VarParseData.szProto, "Nick", (wchar_t*)nullptr);
if (Result == nullptr)
Result = Clist_GetContactDisplayName(0);
@@ -710,18 +710,18 @@ int CMPlugin::Load() InitCommonControls();
InitOptions(); // must be called before we hook CallService
- if (db_get_b(NULL, MODULENAME, DB_SETTINGSVER, 0) < 1) { // change all %nas_message% variables to %extratext% if it wasn't done before
- TCString Str = db_get_s(NULL, MODULENAME, "PopupsFormat", L"");
+ if (g_plugin.getByte(DB_SETTINGSVER, 0) < 1) { // change all %nas_message% variables to %extratext% if it wasn't done before
+ TCString Str = db_get_s(0, MODULENAME, "PopupsFormat", L"");
if (Str.GetLen())
- db_set_ws(NULL, MODULENAME, "PopupsFormat", Str.Replace(L"nas_message", L"extratext"));
+ g_plugin.setWString("PopupsFormat", Str.Replace(L"nas_message", L"extratext"));
- Str = db_get_s(NULL, MODULENAME, "ReplyPrefix", L"");
+ Str = db_get_s(0, MODULENAME, "ReplyPrefix", L"");
if (Str.GetLen())
- db_set_ws(NULL, MODULENAME, "ReplyPrefix", Str.Replace(L"nas_message", L"extratext"));
+ g_plugin.setWString("ReplyPrefix", Str.Replace(L"nas_message", L"extratext"));
}
- if (db_get_b(NULL, MODULENAME, DB_SETTINGSVER, 0) < 2) { // disable autoreply for not-on-list contacts, as such contact may be a spam bot
- db_set_b(NULL, MODULENAME, ContactStatusToDBSetting(0, DB_ENABLEREPLY, 0, INVALID_CONTACT_ID), 0);
- db_set_b(NULL, MODULENAME, DB_SETTINGSVER, 2);
+ if (g_plugin.getByte(DB_SETTINGSVER, 0) < 2) { // disable autoreply for not-on-list contacts, as such contact may be a spam bot
+ g_plugin.setByte(ContactStatusToDBSetting(0, DB_ENABLEREPLY, 0, INVALID_CONTACT_ID), 0);
+ g_plugin.setByte(DB_SETTINGSVER, 2);
}
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index ab4d62c937..dbabd5a025 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -88,7 +88,7 @@ void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg) }
else { // change message of all protocols
for (auto &pa : Accounts()) {
- if (!db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) {
+ if (!db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) {
if (Msg == nullptr)
CurMsg = GetDynamicStatMsg(INVALID_CONTACT_ID, pa->szModuleName);
@@ -119,8 +119,8 @@ void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg) for (int i = 0; i < _countof(StatusDbSettings); i++) {
if (iMode == StatusDbSettings[i].Status) {
- db_set_ws(NULL, "SRAway", CString(StatusDbSettings[i].Setting) + "Msg", CurMsg);
- db_set_ws(NULL, "SRAway", CString(StatusDbSettings[i].Setting) + "Default", CurMsg); // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
+ db_set_ws(0, "SRAway", CString(StatusDbSettings[i].Setting) + "Msg", CurMsg);
+ db_set_ws(0, "SRAway", CString(StatusDbSettings[i].Setting) + "Default", CurMsg); // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
break;
}
}
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index 93bd19c804..27015af169 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -143,7 +143,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix {
if (sDBSetting != nullptr) {
_ASSERT(GetDefValue());
- return db_get_s(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
+ return db_get_s(0, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, *(TCString*)GetDefValue());
}
return *(TCString*)GetDefValue();
}
@@ -151,7 +151,7 @@ TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix)
{
if (sDBSetting != nullptr && !m_bReadOnly) {
- db_set_ws(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
+ db_set_ws(0, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
}
}
@@ -271,11 +271,11 @@ int TreeReadEnum(const char *szSetting, void *lParam) int Len = pData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
if (!strncmp(szSetting, pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- short ParentID = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, pData->sModule,
+ short ParentID = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(0, pData->sModule,
pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
- short Order = db_get_w(NULL, pData->sModule,
+ short Order = db_get_w(0, pData->sModule,
pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
- char Flags = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, pData->sModule,
+ char Flags = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(0, pData->sModule,
pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
if (ParentID >= 0 && Order >= 0) {
CString tmp(pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + CString(szSetting + Len));
@@ -285,8 +285,8 @@ int TreeReadEnum(const char *szSetting, void *lParam) pItem.ParentID = ParentID;
pItem.Flags = Flags;
pItem.hItem = nullptr;
- pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
- pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr : db_get_s(NULL, pData->sModule, tmp, (wchar_t*)nullptr);
+ pItem.Title = db_get_s(0, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
+ pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == nullptr) ? nullptr : db_get_s(0, pData->sModule, tmp, (wchar_t*)nullptr);
}
}
return 0;
@@ -326,16 +326,16 @@ void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi CString StrID;
_itoa(m_value[i].ID, StrID.GetBuffer(64), 10);
StrID.ReleaseBuffer();
- db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_TITLE + StrID, m_value[i].Title);
+ db_set_ws(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_TITLE + StrID, m_value[i].Title);
if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL))
- db_set_w(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_PARENT + StrID, m_value[i].ParentID);
+ db_set_w(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_PARENT + StrID, m_value[i].ParentID);
- db_set_w(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_ORDER + StrID, i);
+ db_set_w(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_ORDER + StrID, i);
if (!(TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) || TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)
- db_set_b(NULL, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags);
+ db_set_b(0, sModule, *sDBSettingPrefix + sDBSetting + TREEITEM_DBSTR_FLAGS + StrID, m_value[i].Flags);
if (User_Str1_DBName != nullptr && m_value[i].User_Str1 != nullptr)
- db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1);
+ db_set_ws(0, sModule, *sDBSettingPrefix + sDBSetting + User_Str1_DBName + StrID, m_value[i].User_Str1);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
@@ -650,7 +650,7 @@ int ListReadEnum(const char *szSetting, void *lParam) int Len = pData->sDBSettingPrefix.GetLen() + pData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
if (!strncmp(szSetting, pData->sDBSettingPrefix + pData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- pData->ListCtrl->m_value.SetAtGrow(ID).Text = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
+ pData->ListCtrl->m_value.SetAtGrow(ID).Text = db_get_s(0, pData->sModule, *pData->sDBSettingPrefix + szSetting, L"");
}
return 0;
}
@@ -689,7 +689,7 @@ void COptItem_ListCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefi CString StrID;
_itoa(i, StrID.GetBuffer(64), 10);
StrID.ReleaseBuffer();
- db_set_ws(NULL, sModule, *sDBSettingPrefix + sDBSetting + LISTITEM_DBSTR_TEXT + StrID, m_value[i].Text);
+ db_set_ws(0, sModule, *sDBSettingPrefix + sDBSetting + LISTITEM_DBSTR_TEXT + StrID, m_value[i].Text);
}
COptItem::MemToDB(sModule, sDBSettingPrefix);
}
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 3c570cfe51..2d85ad477c 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -68,7 +68,7 @@ CProtoState::CStatus& CProtoState::CStatus::operator=(int Status) int bStatusModified = false;
for (int i = 0; i < m_grandParent->GetSize(); i++) {
CProtoState &State = (*m_grandParent)[i];
- if (!db_get_b(NULL, State.GetProto(), "LockMainStatus", 0)) { // if the protocol isn't locked
+ if (!db_get_b(0, State.GetProto(), "LockMainStatus", 0)) { // if the protocol isn't locked
if (State.m_status != Status) {
State.m_status.m_status = Status; // "Status.Status" - changing Status directly to prevent recursive calls to the function
State.m_awaySince.Reset();
@@ -164,12 +164,12 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) g_ProtoStates[szProto].TempMsg.Unset();
CString DBSetting(ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS));
if (Message != nullptr)
- db_set_ws(NULL, MODULENAME, DBSetting, Message);
+ g_plugin.setWString(DBSetting, Message);
else {
if (!szProto)
- db_set_ws(NULL, MODULENAME, DBSetting, CProtoSettings(nullptr, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary
+ g_plugin.setWString(DBSetting, CProtoSettings(nullptr, Status).GetMsgFormat(GMF_LASTORDEFAULT)); // global message can't be NULL; we can use an empty string instead if it's really necessary
else
- db_unset(NULL, MODULENAME, DBSetting);
+ g_plugin.delSetting(DBSetting);
}
}
@@ -263,7 +263,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) }
}
if (Flags & GMF_PERSONAL && Message == nullptr) // try getting personal message (it overrides global)
- Message = db_get_s(NULL, MODULENAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr);
+ Message = db_get_s(0, MODULENAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr);
if (Flags & GMF_PROTOORGLOBAL && Message == nullptr) {
Message = CProtoSettings().GetMsgFormat(GMF_PERSONAL | (Flags & GMF_TEMPORARY), pOrder);
@@ -276,7 +276,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) TreeCtrl->DBToMem(CString(MODULENAME));
Message = nullptr;
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_USELASTMSG)) { // if using last message by default...
- Message = db_get_s(NULL, MODULENAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); // try per-protocol message first
+ Message = db_get_s(0, MODULENAME, ProtoStatusToDBSetting(DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPROTOMSGS), (wchar_t*)nullptr); // try per-protocol message first
if (Message.IsEmpty()) {
Message = nullptr; // to be sure it's NULL, not "" - as we're checking 'Message == NULL' later
int RecentGroupID = GetRecentGroupID(Status);
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index 27da4917e4..fa1e083f7b 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -326,19 +326,19 @@ public: CAutoreply& operator=(const int m_value)
{
CString Setting(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY);
- if (db_get_b(NULL, MODULENAME, Setting, VAL_USEDEFAULT) == m_value)
+ if (g_plugin.getByte(Setting, VAL_USEDEFAULT) == m_value)
return *this;
if (m_value != VAL_USEDEFAULT)
- db_set_b(NULL, MODULENAME, Setting, m_value != 0);
+ g_plugin.setByte(Setting, m_value != 0);
else
- db_unset(NULL, MODULENAME, Setting);
+ g_plugin.delSetting(Setting);
return *this;
}
operator int()
{
- return db_get_b(NULL, MODULENAME, Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY,
+ return g_plugin.getByte(Parent->szProto ? Parent->ProtoStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPROTOSETTINGS) : DB_ENABLEREPLY,
Parent->szProto ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);
}
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index acf2df40ab..5a6f29d5f6 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -520,12 +520,12 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA MinContactSplitterX = rcMsgDlg.right - rc.left + 1;
// [try] getting dialog position
- int DlgPosX = db_get_dw(NULL, MODULENAME, SAM_DB_DLGPOSX, -1);
- int DlgPosY = db_get_dw(NULL, MODULENAME, SAM_DB_DLGPOSY, -1);
- int DlgSizeX = db_get_dw(NULL, MODULENAME, SAM_DB_DLGSIZEX, -1);
- int DlgSizeY = db_get_dw(NULL, MODULENAME, SAM_DB_DLGSIZEY, -1);
- int MsgSplitterX = db_get_dw(NULL, MODULENAME, SAM_DB_MSGSPLITTERPOS, -1);
- int ContactSplitterX = db_get_dw(NULL, MODULENAME, SAM_DB_CONTACTSPLITTERPOS, -1);
+ int DlgPosX = g_plugin.getDword(SAM_DB_DLGPOSX, -1);
+ int DlgPosY = g_plugin.getDword(SAM_DB_DLGPOSY, -1);
+ int DlgSizeX = g_plugin.getDword(SAM_DB_DLGSIZEX, -1);
+ int DlgSizeY = g_plugin.getDword(SAM_DB_DLGSIZEY, -1);
+ int MsgSplitterX = g_plugin.getDword(SAM_DB_MSGSPLITTERPOS, -1);
+ int ContactSplitterX = g_plugin.getDword(SAM_DB_CONTACTSPLITTERPOS, -1);
if (DlgPosX >= 0 && DlgPosY >= 0 && DlgSizeX > 0 && DlgSizeY > 0 && MsgSplitterX > 0 && ContactSplitterX > 0) {
RECT rcWorkArea, rcIntersect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0);
@@ -939,12 +939,12 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA {
RECT rcRect;
GetWindowRect(hwndDlg, &rcRect);
- db_set_dw(NULL, MODULENAME, SAM_DB_DLGPOSX, rcRect.left);
- db_set_dw(NULL, MODULENAME, SAM_DB_DLGPOSY, rcRect.top);
- db_set_dw(NULL, MODULENAME, SAM_DB_DLGSIZEX, rcRect.right - rcRect.left);
- db_set_dw(NULL, MODULENAME, SAM_DB_DLGSIZEY, rcRect.bottom - rcRect.top);
- db_set_dw(NULL, MODULENAME, SAM_DB_MSGSPLITTERPOS, g_MsgSplitterX);
- db_set_dw(NULL, MODULENAME, SAM_DB_CONTACTSPLITTERPOS, g_ContactSplitterX);
+ g_plugin.setDword(SAM_DB_DLGPOSX, rcRect.left);
+ g_plugin.setDword(SAM_DB_DLGPOSY, rcRect.top);
+ g_plugin.setDword(SAM_DB_DLGSIZEX, rcRect.right - rcRect.left);
+ g_plugin.setDword(SAM_DB_DLGSIZEY, rcRect.bottom - rcRect.top);
+ g_plugin.setDword(SAM_DB_MSGSPLITTERPOS, g_MsgSplitterX);
+ g_plugin.setDword(SAM_DB_CONTACTSPLITTERPOS, g_ContactSplitterX);
g_SetAwayMsgPage.PageToMemToDB();
}
break;
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index fb0ab7083d..cd862bd444 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -662,11 +662,11 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) char dbSetting[64];
mir_snprintf(dbSetting, "%s_enabled", szProto);
// this proto is not set for status message notifications
- if (db_get_b(NULL, MODULE, dbSetting, 1) == 0)
+ if (db_get_b(0, MODULE, dbSetting, 1) == 0)
goto skip_notify;
mir_snprintf(dbSetting, "%d", IDC_CHK_STATUS_MESSAGE);
// status message change notifications are disabled
- if (db_get_b(NULL, MODULE, dbSetting, 1) == 0)
+ if (db_get_b(0, MODULE, dbSetting, 1) == 0)
goto skip_notify;
if (SkipHiddenContact(hContact))
@@ -840,7 +840,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) BYTE hlpDisableSound = db_get_b(0, MODULE, szSetting, 0);
if (hlpDisableSound != opt.SoundAutoDisabled) {
- BYTE hlpUseSound = db_get_b(NULL, "Skin", "UseSound", 1);
+ BYTE hlpUseSound = db_get_b(0, "Skin", "UseSound", 1);
opt.SoundAutoDisabled = hlpDisableSound;
if (hlpDisableSound) {
@@ -868,8 +868,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Online"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"global.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40072tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40072tx", COLOR_TX_DEFAULT);
//Offline
index = Index(ID_STATUS_OFFLINE);
@@ -880,8 +880,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Offline"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"offline.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40071tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40071tx", COLOR_TX_DEFAULT);
//Invisible
index = Index(ID_STATUS_INVISIBLE);
@@ -892,8 +892,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Invisible"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"invisible.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40078tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40078tx", COLOR_TX_DEFAULT);
//Free for chat
index = Index(ID_STATUS_FREECHAT);
@@ -904,8 +904,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Free for chat"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"free4chat.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40077tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40077tx", COLOR_TX_DEFAULT);
//Away
index = Index(ID_STATUS_AWAY);
@@ -916,8 +916,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Away"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"away.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40073tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40073tx", COLOR_TX_DEFAULT);
//NA
index = Index(ID_STATUS_NA);
@@ -928,8 +928,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Not available"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"na.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40075tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40075tx", COLOR_TX_DEFAULT);
//Occupied
index = Index(ID_STATUS_OCCUPIED);
@@ -940,8 +940,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Occupied"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"occupied.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40076tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40076tx", COLOR_TX_DEFAULT);
//Do not disturb
index = Index(ID_STATUS_DND);
@@ -952,8 +952,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Do not disturb"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"dnd.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40074tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40074tx", COLOR_TX_DEFAULT);
//Out to lunch
index = Index(ID_STATUS_OUTTOLUNCH);
@@ -964,8 +964,8 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: Out to lunch"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"lunch.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40080tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40080tx", COLOR_TX_DEFAULT);
//On the phone
index = Index(ID_STATUS_ONTHEPHONE);
@@ -976,18 +976,18 @@ void InitStatusList() mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME);
mir_wstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENW("User: On the phone"), MAX_SKINSOUNDDESC);
mir_wstrncpy(StatusList[index].lpzSkinSoundFile, L"phone.wav", MAX_PATH);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40079tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40079tx", COLOR_TX_DEFAULT);
//Extra status
index = Index(ID_STATUS_EXTRASTATUS);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40081tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40081bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40081tx", COLOR_TX_DEFAULT);
//Status message
index = Index(ID_STATUS_STATUSMSG);
- StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40082bg", COLOR_BG_AVAILDEFAULT);
- StatusList[index].colorText = db_get_dw(NULL, MODULE, "40082tx", COLOR_TX_DEFAULT);
+ StatusList[index].colorBack = db_get_dw(0, MODULE, "40082bg", COLOR_BG_AVAILDEFAULT);
+ StatusList[index].colorText = db_get_dw(0, MODULE, "40082tx", COLOR_TX_DEFAULT);
//From offline
index = ID_STATUS_FROMOFFLINE;
@@ -1052,7 +1052,7 @@ int ProtoAck(WPARAM, LPARAM lParam) char *szProto = (char *)ack->szModule;
if (newStatus == ID_STATUS_OFFLINE) {
//The protocol switched to offline. Disable the popups for this protocol
- db_set_b(NULL, MODULE, szProto, 0);
+ db_set_b(0, MODULE, szProto, 0);
}
else if (oldStatus < ID_STATUS_ONLINE && newStatus >= ID_STATUS_ONLINE) {
//The protocol changed from a disconnected status to a connected status.
@@ -1131,7 +1131,7 @@ static int ModulesLoaded(WPARAM, LPARAM) for (auto &pa : Accounts())
if (pa->IsEnabled())
- db_set_b(NULL, MODULE, pa->szModuleName, 0);
+ db_set_b(0, MODULE, pa->szModuleName, 0);
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 4eca8ddb62..381b0ebb5c 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -285,7 +285,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) {
char status[8];
mir_snprintf(status, "%d", i);
- db_set_b(NULL, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
+ db_set_b(0, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i));
}
opt.FromOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_FROMOFFLINE);
@@ -475,7 +475,7 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "s%d", i);
- CheckDlgButton(hwndDlg, (i + 2000), db_get_b(NULL, MODULE, str, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 2000), db_get_b(0, MODULE, str, 0) ? BST_CHECKED : BST_UNCHECKED);
}
return TRUE;
@@ -489,13 +489,13 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "p%d", i);
- db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
+ db_set_b(0, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
char str[8];
mir_snprintf(str, "s%d", i);
- db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i + 2000));
+ db_set_b(0, MODULE, str, IsDlgButtonChecked(hwndDlg, i + 2000));
}
SaveOptions();
@@ -722,7 +722,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", pa->szModuleName);
- ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULE, dbSetting, TRUE));
+ ListView_SetCheckState(hList, lvItem.iItem, db_get_b(0, MODULE, dbSetting, TRUE));
lvItem.iItem++;
}
}
@@ -830,7 +830,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", (char *)lvItem.lParam);
- db_set_b(NULL, MODULE, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
+ db_set_b(0, MODULE, dbSetting, (BYTE)ListView_GetCheckState(hList, lvItem.iItem));
}
}
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index f0dbbbf704..ca0a7a694f 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -21,7 +21,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae if (!globals.gpg_valid) return pxNotConfigured; - wchar_t *bin_path = UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L""); + wchar_t *bin_path = UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L""); { if (!boost::filesystem::exists(bin_path)) { mir_free(bin_path); @@ -42,7 +42,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae env.push_back(L"LC_ALL=English"); env.push_back(L"LANG=C"); argv.push_back(bin_path); - wchar_t *home_dir = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *home_dir = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); if (mir_wstrlen(home_dir)) //this check are required for first run gpg binary validation { argv.push_back(L"--homedir"); @@ -156,7 +156,7 @@ pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, pxResult *res if (!globals.gpg_valid) return pxNotConfigured; - wchar_t *bin_path = UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L""); + wchar_t *bin_path = UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L""); { if (!boost::filesystem::exists(bin_path)) { mir_free(bin_path); @@ -177,7 +177,7 @@ pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, pxResult *res env.push_back(L"LC_ALL=English"); argv.push_back(bin_path); argv.push_back(L"--homedir"); - wchar_t *home_dir = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *home_dir = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); argv.push_back(home_dir); mir_free(home_dir); argv.push_back(L"--display-charset"); diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 194e7f6f94..8b074c96e7 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -70,34 +70,34 @@ void InitIconLib(); void init_vars() { - globals.bAppendTags = db_get_b(NULL, MODULENAME, "bAppendTags", 0) != 0; - globals.bStripTags = db_get_b(NULL, MODULENAME, "bStripTags", 0) != 0; - globals.inopentag = UniGetContactSettingUtf(NULL, MODULENAME, "szInOpenTag", L"<GPGdec>"); - globals.inclosetag = UniGetContactSettingUtf(NULL, MODULENAME, "szInCloseTag", L"</GPGdec>"); - globals.outopentag = UniGetContactSettingUtf(NULL, MODULENAME, "szOutOpenTag", L"<GPGenc>"); - globals.outclosetag = UniGetContactSettingUtf(NULL, MODULENAME, "szOutCloseTag", L"</GPGenc>"); - globals.bDebugLog = db_get_b(NULL, MODULENAME, "bDebugLog", 0) != 0; - globals.bAutoExchange = db_get_b(NULL, MODULENAME, "bAutoExchange", 0) != 0; - globals.bSameAction = db_get_b(NULL, MODULENAME, "bSameAction", 0) != 0; - globals.password = UniGetContactSettingUtf(NULL, MODULENAME, "szKeyPassword", L""); + globals.bAppendTags = g_plugin.getByte("bAppendTags", 0) != 0; + globals.bStripTags = g_plugin.getByte("bStripTags", 0) != 0; + globals.inopentag = UniGetContactSettingUtf(0, MODULENAME, "szInOpenTag", L"<GPGdec>"); + globals.inclosetag = UniGetContactSettingUtf(0, MODULENAME, "szInCloseTag", L"</GPGdec>"); + globals.outopentag = UniGetContactSettingUtf(0, MODULENAME, "szOutOpenTag", L"<GPGenc>"); + globals.outclosetag = UniGetContactSettingUtf(0, MODULENAME, "szOutCloseTag", L"</GPGenc>"); + globals.bDebugLog = g_plugin.getByte("bDebugLog", 0) != 0; + globals.bAutoExchange = g_plugin.getByte("bAutoExchange", 0) != 0; + globals.bSameAction = g_plugin.getByte("bSameAction", 0) != 0; + globals.password = UniGetContactSettingUtf(0, MODULENAME, "szKeyPassword", L""); globals.debuglog.init(); - globals.bJabberAPI = db_get_b(NULL, MODULENAME, "bJabberAPI", true) != 0; - globals.bPresenceSigning = db_get_b(NULL, MODULENAME, "bPresenceSigning", 0) != 0; - globals.bFileTransfers = db_get_b(NULL, MODULENAME, "bFileTransfers", 0) != 0; - globals.firstrun_rect.left = db_get_dw(NULL, MODULENAME, "FirstrunWindowX", 0); - globals.firstrun_rect.top = db_get_dw(NULL, MODULENAME, "FirstrunWindowY", 0); - globals.key_password_rect.left = db_get_dw(NULL, MODULENAME, "PasswordWindowX", 0); - globals.key_password_rect.top = db_get_dw(NULL, MODULENAME, "PasswordWindowY", 0); - globals.key_gen_rect.left = db_get_dw(NULL, MODULENAME, "KeyGenWindowX", 0); - globals.key_gen_rect.top = db_get_dw(NULL, MODULENAME, "KeyGenWindowY", 0); - globals.load_key_rect.left = db_get_dw(NULL, MODULENAME, "LoadKeyWindowX", 0); - globals.load_key_rect.top = db_get_dw(NULL, MODULENAME, "LoadKeyWindowY", 0); - globals.import_key_rect.left = db_get_dw(NULL, MODULENAME, "ImportKeyWindowX", 0); - globals.import_key_rect.top = db_get_dw(NULL, MODULENAME, "ImportKeyWindowY", 0); - globals.new_key_rect.left = db_get_dw(NULL, MODULENAME, "NewKeyWindowX", 0); - globals.new_key_rect.top = db_get_dw(NULL, MODULENAME, "NewKeyWindowY", 0); - globals.load_existing_key_rect.left = db_get_dw(NULL, MODULENAME, "LoadExistingKeyWindowX", 0); - globals.load_existing_key_rect.top = db_get_dw(NULL, MODULENAME, "LoadExistingKeyWindowY", 0); + globals.bJabberAPI = g_plugin.getByte("bJabberAPI", true) != 0; + globals.bPresenceSigning = g_plugin.getByte("bPresenceSigning", 0) != 0; + globals.bFileTransfers = g_plugin.getByte("bFileTransfers", 0) != 0; + globals.firstrun_rect.left = g_plugin.getDword("FirstrunWindowX", 0); + globals.firstrun_rect.top = g_plugin.getDword("FirstrunWindowY", 0); + globals.key_password_rect.left = g_plugin.getDword("PasswordWindowX", 0); + globals.key_password_rect.top = g_plugin.getDword("PasswordWindowY", 0); + globals.key_gen_rect.left = g_plugin.getDword("KeyGenWindowX", 0); + globals.key_gen_rect.top = g_plugin.getDword("KeyGenWindowY", 0); + globals.load_key_rect.left = g_plugin.getDword("LoadKeyWindowX", 0); + globals.load_key_rect.top = g_plugin.getDword("LoadKeyWindowY", 0); + globals.import_key_rect.left = g_plugin.getDword("ImportKeyWindowX", 0); + globals.import_key_rect.top = g_plugin.getDword("ImportKeyWindowY", 0); + globals.new_key_rect.left = g_plugin.getDword("NewKeyWindowX", 0); + globals.new_key_rect.top = g_plugin.getDword("NewKeyWindowY", 0); + globals.load_existing_key_rect.left = g_plugin.getDword("LoadExistingKeyWindowX", 0); + globals.load_existing_key_rect.top = g_plugin.getDword("LoadExistingKeyWindowY", 0); globals.tabsrmm_used = isTabsrmmUsed(); globals.bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, L"Arial"); } @@ -105,7 +105,7 @@ void init_vars() static int OnModulesLoaded(WPARAM, LPARAM) { FirstRun(); - if (!db_get_b(NULL, MODULENAME, "FirstRun", 1)) + if (!g_plugin.getByte("FirstRun", 1)) InitCheck(); StatusIconData sid = {}; diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp index c5f704ec57..93fe0f43d5 100755 --- a/plugins/New_GPG/src/log.cpp +++ b/plugins/New_GPG/src/log.cpp @@ -75,7 +75,7 @@ void logtofile::init() if (globals.bDebugLog) { if (path) mir_free(path); - path = UniGetContactSettingUtf(NULL, MODULENAME, "szLogFilePath", L"C:\\GPGdebug.log"); + path = UniGetContactSettingUtf(0, MODULENAME, "szLogFilePath", L"C:\\GPGdebug.log"); } _bDebugLog = globals.bDebugLog; } diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 42d754f6d5..81e162fff5 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -20,7 +20,7 @@ void FirstRun() { - if (!db_get_b(NULL, MODULENAME, "FirstRun", 1)) + if (!g_plugin.getByte("FirstRun", 1)) return; CDlgGpgBinOpts *d = new CDlgGpgBinOpts; d->Show(); @@ -30,13 +30,13 @@ void InitCheck() { { // parse gpg output - wchar_t *current_home = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); - db_set_ws(NULL, MODULENAME, "szHomePath", L""); //we do not need home for gpg binary validation + wchar_t *current_home = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); + g_plugin.setWString("szHomePath", L""); //we do not need home for gpg binary validation globals.gpg_valid = isGPGValid(); - db_set_ws(NULL, MODULENAME, "szHomePath", current_home); //return current home dir back + g_plugin.setWString("szHomePath", current_home); //return current home dir back mir_free(current_home); bool home_dir_access = false, temp_access = false; - wchar_t *home_dir = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *home_dir = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); std::wstring test_path = home_dir; mir_free(home_dir); test_path += L"/"; @@ -91,7 +91,7 @@ void InitCheck() if (result == pxNotFound) return; } - home_dir = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + home_dir = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); wstring tmp_dir = home_dir; mir_free(home_dir); tmp_dir += L"\\tmp"; @@ -109,11 +109,11 @@ void InitCheck() acc += pa->szModuleName; acc += ")"; acc += "_KeyID"; - keyid = UniGetContactSettingUtf(NULL, MODULENAME, acc.c_str(), ""); + keyid = UniGetContactSettingUtf(0, MODULENAME, acc.c_str(), ""); if (keyid[0]) { question = Translate("Your secret key with ID: "); mir_free(keyid); - keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); if ((p = out.find(keyid)) == string::npos) { question += keyid; question += Translate(" for account "); @@ -173,9 +173,9 @@ void InitCheck() } } question = Translate("Your secret key with ID: "); - keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); - char *key = UniGetContactSettingUtf(NULL, MODULENAME, "GPGPubKey", ""); - if (!db_get_b(NULL, MODULENAME, "FirstRun", 1) && (!keyid[0] || !key[0])) { + keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); + char *key = UniGetContactSettingUtf(0, MODULENAME, "GPGPubKey", ""); + if (!g_plugin.getByte("FirstRun", 1) && (!keyid[0] || !key[0])) { question = Translate("You didn't set a private key.\nWould you like to set it now?"); if (MessageBoxA(nullptr, question.c_str(), Translate("Own private key warning"), MB_YESNO) == IDYES) { CDlgFirstRun *d = new CDlgFirstRun; @@ -235,7 +235,7 @@ void InitCheck() mir_free(key); } { - wchar_t *path = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *path = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); DWORD dwFileAttr = GetFileAttributes(path); if (dwFileAttr != INVALID_FILE_ATTRIBUTES) { dwFileAttr &= ~FILE_ATTRIBUTE_READONLY; @@ -290,7 +290,7 @@ void ImportKey(MCONTACT hContact, std::wstring new_key) std::vector<wstring> cmd; wchar_t tmp2[MAX_PATH] = { 0 }; { - wcsncpy(tmp2, ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L"")), MAX_PATH - 1); + wcsncpy(tmp2, ptrW(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L"")), MAX_PATH - 1); mir_wstrncat(tmp2, L"\\", _countof(tmp2) - mir_wstrlen(tmp2)); mir_wstrncat(tmp2, L"temporary_exported.asc", _countof(tmp2) - mir_wstrlen(tmp2)); boost::filesystem::remove(tmp2); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index fc16bf8d73..526227ae1f 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -76,7 +76,7 @@ static void RecvMsgSvc_func(RecvParams *param) boost::algorithm::erase_all(param->str, "\r"); s2 += mir_wstrlen(L"-----END PGP MESSAGE-----"); - ptrW ptszHomePath(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L"")); + ptrW ptszHomePath(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L"")); wstring encfile = toUTF16(get_random(10)); wstring decfile = toUTF16(get_random(10)); { @@ -120,12 +120,12 @@ static void RecvMsgSvc_func(RecvParams *param) string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, MODULENAME, dbsetting.c_str(), L""); + pass = UniGetContactSettingUtf(0, MODULENAME, dbsetting.c_str(), L""); if (pass[0] && globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password in database for key ID: " + inkeyid + ", trying to decrypt message from " + toUTF8(Clist_GetContactDisplayName(hContact)) + " with password"); } else { - pass = UniGetContactSettingUtf(NULL, MODULENAME, "szKeyPassword", L""); + pass = UniGetContactSettingUtf(0, MODULENAME, "szKeyPassword", L""); if (pass[0] && globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to decrypt message from " + toUTF8(Clist_GetContactDisplayName(hContact)) + " with password"); } @@ -401,7 +401,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) string output; DWORD exitcode; { - ptrW ptmp(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L"")); + ptrW ptmp(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L"")); mir_wstrcpy(tmp2, ptmp); mir_free(ptmp); mir_wstrcat(tmp2, L"\\"); @@ -541,7 +541,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) if (globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info(autoexchange): received key request from: " + toUTF8(Clist_GetContactDisplayName(ccs->hContact))); - ptrA tmp(UniGetContactSettingUtf(NULL, MODULENAME, "GPGPubKey", "")); + ptrA tmp(UniGetContactSettingUtf(0, MODULENAME, "GPGPubKey", "")); if (tmp[0]) { int enc_state = db_get_b(ccs->hContact, MODULENAME, "GPGEncryption", 0); if (enc_state) @@ -643,7 +643,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) mir_free(tmp2); } { - wchar_t *tmp2 = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *tmp2 = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); path = tmp2; cmd.push_back(std::wstring(tmp2) + L"\\tmp\\" + file); mir_free(tmp2); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index dbf212737c..abf4af389d 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -106,23 +106,23 @@ public: i++; } } - edit_LOG_FILE_EDIT.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szLogFilePath", L""))); + edit_LOG_FILE_EDIT.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szLogFilePath", L""))); - check_DEBUG_LOG.SetState(db_get_b(NULL, MODULENAME, "bDebugLog", 0)); + check_DEBUG_LOG.SetState(g_plugin.getByte("bDebugLog", 0)); check_JABBER_API.Enable(); check_AUTO_EXCHANGE.Enable(globals.bJabberAPI); { string keyinfo = Translate("Default private key ID"); keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + char *keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); keyinfo += (mir_strlen(keyid) > 0) ? keyid : Translate("not set"); mir_free(keyid); lbl_CURRENT_KEY.SetTextA(keyinfo.c_str()); } - check_JABBER_API.SetState(db_get_b(NULL, MODULENAME, "bJabberAPI", 1)); - check_FILE_TRANSFERS.SetState(db_get_b(NULL, MODULENAME, "bFileTransfers", 0)); - check_AUTO_EXCHANGE.SetState(db_get_b(NULL, MODULENAME, "bAutoExchange", 0)); + check_JABBER_API.SetState(g_plugin.getByte("bJabberAPI", 1)); + check_FILE_TRANSFERS.SetState(g_plugin.getByte("bFileTransfers", 0)); + check_AUTO_EXCHANGE.SetState(g_plugin.getByte("bAutoExchange", 0)); //TODO: get rid of following s..t //////////////// @@ -136,19 +136,19 @@ public: bool OnApply() override { - db_set_b(NULL, MODULENAME, "bDebugLog", globals.bDebugLog = check_DEBUG_LOG.GetState()); + g_plugin.setByte("bDebugLog", globals.bDebugLog = check_DEBUG_LOG.GetState()); if (globals.bDebugLog) globals.debuglog.init(); - db_set_b(NULL, MODULENAME, "bJabberAPI", globals.bJabberAPI = check_JABBER_API.GetState()); - bool old_bFileTransfers = db_get_b(NULL, MODULENAME, "bFileTransfers", 0) != 0; - db_set_b(NULL, MODULENAME, "bFileTransfers", globals.bFileTransfers = check_FILE_TRANSFERS.GetState()); + g_plugin.setByte("bJabberAPI", globals.bJabberAPI = check_JABBER_API.GetState()); + bool old_bFileTransfers = g_plugin.getByte("bFileTransfers", 0) != 0; + g_plugin.setByte("bFileTransfers", globals.bFileTransfers = check_FILE_TRANSFERS.GetState()); if (globals.bFileTransfers != old_bFileTransfers) { - db_set_b(NULL, MODULENAME, "bSameAction", 0); + g_plugin.setByte("bSameAction", 0); globals.bSameAction = false; } - db_set_b(NULL, MODULENAME, "bAutoExchange", globals.bAutoExchange = check_AUTO_EXCHANGE.GetState()); - db_set_ws(NULL, MODULENAME, "szLogFilePath", ptrW(edit_LOG_FILE_EDIT.GetText())); + g_plugin.setByte("bAutoExchange", globals.bAutoExchange = check_AUTO_EXCHANGE.GetState()); + g_plugin.setWString("szLogFilePath", ptrW(edit_LOG_FILE_EDIT.GetText())); return true; } @@ -284,7 +284,7 @@ public: void onClick_COPY_KEY(CCtrlButton*) { if (OpenClipboard(m_hwnd)) { - char *szKey = UniGetContactSettingUtf(NULL, MODULENAME, "GPGPubKey", ""); + char *szKey = UniGetContactSettingUtf(0, MODULENAME, "GPGPubKey", ""); std::string str = szKey; mir_free(szKey); boost::algorithm::replace_all(str, "\n", "\r\n"); @@ -386,26 +386,26 @@ public: bool OnInitDialog() override { - edit_BIN_PATH.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L"gpg.exe"))); - edit_HOME_DIR.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L"gpg"))); + edit_BIN_PATH.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L"gpg.exe"))); + edit_HOME_DIR.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L"gpg"))); return true; } bool OnApply() override { wchar_t tmp[8192]; - db_set_ws(NULL, MODULENAME, "szGpgBinPath", edit_BIN_PATH.GetText()); + g_plugin.setWString("szGpgBinPath", edit_BIN_PATH.GetText()); mir_wstrncpy(tmp, edit_HOME_DIR.GetText(), 8191); while (tmp[mir_wstrlen(tmp) - 1] == '\\') tmp[mir_wstrlen(tmp) - 1] = '\0'; - db_set_ws(NULL, MODULENAME, "szHomePath", tmp); + g_plugin.setWString("szHomePath", tmp); return true; } void onClick_SET_BIN_PATH(CCtrlButton*) { GetFilePath(TranslateT("Choose gpg.exe"), "szGpgBinPath", L"*.exe", TranslateT("EXE Executables")); - CMStringW tmp(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L"gpg.exe"))); + CMStringW tmp(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L"gpg.exe"))); edit_BIN_PATH.SetText(tmp); bool gpg_exists = false; { @@ -413,8 +413,8 @@ public: gpg_exists = true; if (gpg_exists) { bool bad_version = false; - wchar_t *tmp_path = UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L""); - db_set_ws(NULL, MODULENAME, "szGpgBinPath", tmp); + wchar_t *tmp_path = UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L""); + g_plugin.setWString("szGpgBinPath", tmp); string out; DWORD code; std::vector<wstring> cmd; @@ -428,7 +428,7 @@ public: globals.gpg_valid = true; gpg_launcher(params); globals.gpg_valid = old_gpg_state; - db_set_ws(NULL, MODULENAME, "szGpgBinPath", tmp_path); + g_plugin.setWString("szGpgBinPath", tmp_path); mir_free(tmp_path); string::size_type p1 = out.find("(GnuPG) "); if (p1 != string::npos) { @@ -455,7 +455,7 @@ public: void onClick_SET_HOME_DIR(CCtrlButton*) { GetFolderPath(TranslateT("Set home directory")); - CMStringW tmp(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""))); + CMStringW tmp(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""))); edit_HOME_DIR.SetText(tmp); wchar_t mir_path[MAX_PATH]; PathToAbsoluteW(L"\\", mir_path); @@ -479,34 +479,34 @@ public: bool OnInitDialog() override { - check_APPEND_TAGS.SetState(db_get_b(NULL, MODULENAME, "bAppendTags", 0)); - check_STRIP_TAGS.SetState(db_get_b(NULL, MODULENAME, "bStripTags", 0)); - edit_IN_OPEN_TAG.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szInOpenTag", L"<GPGdec>"))); - edit_IN_CLOSE_TAG.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szInCloseTag", L"</GPGdec>"))); - edit_OUT_OPEN_TAG.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szOutOpenTag", L"<GPGenc>"))); - edit_OUT_CLOSE_TAG.SetText(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szOutCloseTag", L"</GPGenc>"))); + check_APPEND_TAGS.SetState(g_plugin.getByte("bAppendTags", 0)); + check_STRIP_TAGS.SetState(g_plugin.getByte("bStripTags", 0)); + edit_IN_OPEN_TAG.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szInOpenTag", L"<GPGdec>"))); + edit_IN_CLOSE_TAG.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szInCloseTag", L"</GPGdec>"))); + edit_OUT_OPEN_TAG.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szOutOpenTag", L"<GPGenc>"))); + edit_OUT_CLOSE_TAG.SetText(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szOutCloseTag", L"</GPGenc>"))); return true; } bool OnApply() override { - db_set_b(NULL, MODULENAME, "bAppendTags", globals.bAppendTags = check_APPEND_TAGS.GetState()); - db_set_b(NULL, MODULENAME, "bStripTags", globals.bStripTags = check_STRIP_TAGS.GetState()); + g_plugin.setByte("bAppendTags", globals.bAppendTags = check_APPEND_TAGS.GetState()); + g_plugin.setByte("bStripTags", globals.bStripTags = check_STRIP_TAGS.GetState()); { wchar_t *tmp = mir_wstrdup(edit_IN_OPEN_TAG.GetText()); - db_set_ws(NULL, MODULENAME, "szInOpenTag", tmp); + g_plugin.setWString("szInOpenTag", tmp); mir_free(globals.inopentag); globals.inopentag = tmp; tmp = mir_wstrdup(edit_IN_CLOSE_TAG.GetText()); - db_set_ws(NULL, MODULENAME, "szInCloseTag", tmp); + g_plugin.setWString("szInCloseTag", tmp); mir_free(globals.inclosetag); globals.inclosetag = tmp; tmp = mir_wstrdup(edit_OUT_OPEN_TAG.GetText()); - db_set_ws(NULL, MODULENAME, "szOutOpenTag", tmp); + g_plugin.setWString("szOutOpenTag", tmp); mir_free(globals.outopentag); globals.outopentag = tmp; tmp = mir_wstrdup(edit_OUT_CLOSE_TAG.GetText()); - db_set_ws(NULL, MODULENAME, "szOutCloseTag", tmp); + g_plugin.setWString("szOutCloseTag", tmp); mir_free(globals.outclosetag); globals.outclosetag = tmp; } @@ -530,14 +530,14 @@ public: bool OnInitDialog() override { - check_PRESCENSE_SUBSCRIPTION.SetState(db_get_b(NULL, MODULENAME, "bPresenceSigning", 0)); + check_PRESCENSE_SUBSCRIPTION.SetState(g_plugin.getByte("bPresenceSigning", 0)); check_PRESCENSE_SUBSCRIPTION.Enable(globals.bJabberAPI); return true; } bool OnApply() override { - db_set_b(NULL, MODULENAME, "bPresenceSigning", globals.bPresenceSigning = check_PRESCENSE_SUBSCRIPTION.GetState()); + g_plugin.setByte("bPresenceSigning", globals.bPresenceSigning = check_PRESCENSE_SUBSCRIPTION.GetState()); return true; } @@ -677,8 +677,8 @@ public: virtual void OnDestroy() override { GetWindowRect(m_hwnd, &globals.load_key_rect); - db_set_dw(NULL, MODULENAME, "LoadKeyWindowX", globals.load_key_rect.left); - db_set_dw(NULL, MODULENAME, "LoadKeyWindowY", globals.load_key_rect.top); + g_plugin.setDword("LoadKeyWindowX", globals.load_key_rect.left); + g_plugin.setDword("LoadKeyWindowY", globals.load_key_rect.top); edit_p_PubKeyEdit = nullptr; } @@ -742,7 +742,7 @@ public: DWORD exitcode; { MCONTACT hcnt = db_mc_tryMeta(hContact); - ptmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + ptmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); wcsncpy(tmp2, ptmp, MAX_PATH - 1); mir_free(ptmp); mir_wstrncat(tmp2, L"\\", _countof(tmp2) - mir_wstrlen(tmp2)); diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp index 8ec4ca30b8..fdf68a5bff 100755 --- a/plugins/New_GPG/src/ui.cpp +++ b/plugins/New_GPG/src/ui.cpp @@ -37,7 +37,7 @@ CDlgEncryptedFileMsgBox::CDlgEncryptedFileMsgBox() : void CDlgEncryptedFileMsgBox::onClick_IGNORE(CCtrlButton*) { if (chk_REMEMBER.GetState()) { - db_set_b(NULL, MODULENAME, "bSameAction", 1); + g_plugin.setByte("bSameAction", 1); globals.bSameAction = true; } this->Close(); @@ -47,9 +47,9 @@ void CDlgEncryptedFileMsgBox::onClick_DECRYPT(CCtrlButton*) { globals.bDecryptFiles = true; if (chk_REMEMBER.GetState()) { - db_set_b(NULL, MODULENAME, "bFileTransfers", 1); + g_plugin.setByte("bFileTransfers", 1); globals.bFileTransfers = true; - db_set_b(NULL, MODULENAME, "bSameAction", 0); + g_plugin.setByte("bSameAction", 0); globals.bSameAction = false; } this->Close(); @@ -114,7 +114,7 @@ void CDlgChangePasswdMsgBox::onClick_OK(CCtrlButton*) new_pass = toUTF8(edit_NEW_PASSWD1.GetText()); old_pass = toUTF8(edit_OLD_PASSWD.GetText()); bool old_pass_match = false; - wchar_t *pass = UniGetContactSettingUtf(NULL, MODULENAME, "szKeyPassword", L""); + wchar_t *pass = UniGetContactSettingUtf(0, MODULENAME, "szKeyPassword", L""); if (!mir_wstrcmp(pass, edit_OLD_PASSWD.GetText())) old_pass_match = true; mir_free(pass); @@ -124,7 +124,7 @@ void CDlgChangePasswdMsgBox::onClick_OK(CCtrlButton*) string dbsetting = "szKey_"; dbsetting += toUTF8(globals.key_id_global); dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, MODULENAME, dbsetting.c_str(), L""); + pass = UniGetContactSettingUtf(0, MODULENAME, dbsetting.c_str(), L""); if (!mir_wstrcmp(pass, edit_OLD_PASSWD.GetText())) old_pass_match = true; mir_free(pass); @@ -230,7 +230,7 @@ bool CDlgFirstRun::OnInitDialog() combo_ACCOUNT.SelectString(TranslateT("Default")); string keyinfo = Translate("key ID"); keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + char *keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); keyinfo += (mir_strlen(keyid) > 0) ? keyid : Translate("not set"); mir_free(keyid); lbl_KEY_ID.SetTextA(keyinfo.c_str()); @@ -445,32 +445,32 @@ void CDlgFirstRun::onClick_DELETE_KEY(CCtrlButton*) { char *buf = mir_strdup(combo_ACCOUNT.GetTextA()); if (!mir_strcmp(buf, Translate("Default"))) { - db_unset(NULL, MODULENAME, "GPGPubKey"); - db_unset(NULL, MODULENAME, "KeyID"); - db_unset(NULL, MODULENAME, "KeyComment"); - db_unset(NULL, MODULENAME, "KeyMainName"); - db_unset(NULL, MODULENAME, "KeyMainEmail"); - db_unset(NULL, MODULENAME, "KeyType"); + g_plugin.delSetting("GPGPubKey"); + g_plugin.delSetting("KeyID"); + g_plugin.delSetting("KeyComment"); + g_plugin.delSetting("KeyMainName"); + g_plugin.delSetting("KeyMainEmail"); + g_plugin.delSetting("KeyType"); } else { std::string acc_str = buf; acc_str += "_GPGPubKey"; - db_unset(NULL, MODULENAME, acc_str.c_str()); + g_plugin.delSetting(acc_str.c_str()); acc_str = buf; acc_str += "_KeyMainName"; - db_unset(NULL, MODULENAME, acc_str.c_str()); + g_plugin.delSetting(acc_str.c_str()); acc_str = buf; acc_str += "_KeyID"; - db_unset(NULL, MODULENAME, acc_str.c_str()); + g_plugin.delSetting(acc_str.c_str()); acc_str = buf; acc_str += "_KeyComment"; - db_unset(NULL, MODULENAME, acc_str.c_str()); + g_plugin.delSetting(acc_str.c_str()); acc_str = buf; acc_str += "_KeyMainEmail"; - db_unset(NULL, MODULENAME, acc_str.c_str()); + g_plugin.delSetting(acc_str.c_str()); acc_str = buf; acc_str += "_KeyType"; - db_unset(NULL, MODULENAME, acc_str.c_str()); + g_plugin.delSetting(acc_str.c_str()); } if (buf) mir_free(buf); @@ -520,20 +520,20 @@ void CDlgFirstRun::onClick_OK(CCtrlButton*) { char *buf = mir_strdup(combo_ACCOUNT.GetTextA()); if (!mir_strcmp(buf, Translate("Default"))) { - db_set_s(NULL, MODULENAME, "GPGPubKey", out.c_str()); - db_set_ws(NULL, MODULENAME, "KeyMainName", name); - db_set_ws(NULL, MODULENAME, "KeyID", fp); + g_plugin.setString("GPGPubKey", out.c_str()); + g_plugin.setWString("KeyMainName", name); + g_plugin.setWString("KeyID", fp); } else { std::string acc_str = buf; acc_str += "_GPGPubKey"; - db_set_s(NULL, MODULENAME, acc_str.c_str(), out.c_str()); + g_plugin.setString(acc_str.c_str(), out.c_str()); acc_str = buf; acc_str += "_KeyMainName"; - db_set_ws(NULL, MODULENAME, acc_str.c_str(), name); + g_plugin.setWString(acc_str.c_str(), name); acc_str = buf; acc_str += "_KeyID"; - db_set_ws(NULL, MODULENAME, acc_str.c_str(), fp); + g_plugin.setWString(acc_str.c_str(), fp); } if (!mir_strcmp(buf, Translate("Default"))) { wstring keyinfo = TranslateT("Default private key ID"); @@ -552,7 +552,7 @@ void CDlgFirstRun::onClick_OK(CCtrlButton*) dbsetting += keyid; mir_free(keyid); dbsetting += "_Password"; - db_set_ws(NULL, MODULENAME, dbsetting.c_str(), passwd); + g_plugin.setWString(dbsetting.c_str(), passwd); } mir_free(passwd); delete[] name; @@ -569,7 +569,7 @@ void CDlgFirstRun::onChange_ACCOUNT(CCtrlCombo*) if (!mir_strcmp(buf, Translate("Default"))) { string keyinfo = Translate("key ID"); keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + char *keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); keyinfo += (mir_strlen(keyid) > 0) ? keyid : Translate("not set"); mir_free(keyid); lbl_KEY_ID.SetTextA(keyinfo.c_str()); @@ -579,7 +579,7 @@ void CDlgFirstRun::onChange_ACCOUNT(CCtrlCombo*) keyinfo += ": "; std::string acc_str = buf; acc_str += "_KeyID"; - char *keyid = UniGetContactSettingUtf(NULL, MODULENAME, acc_str.c_str(), ""); + char *keyid = UniGetContactSettingUtf(0, MODULENAME, acc_str.c_str(), ""); keyinfo += (mir_strlen(keyid) > 0) ? keyid : Translate("not set"); mir_free(keyid); lbl_KEY_ID.SetTextA(keyinfo.c_str()); @@ -605,8 +605,8 @@ void CDlgFirstRun::onChange_KEY_LIST(CCtrlListView::TEventInfo *ev) //TODO: chec void CDlgFirstRun::OnDestroy() { GetWindowRect(m_hwnd, &globals.firstrun_rect); - db_set_dw(NULL, MODULENAME, "FirstrunWindowX", globals.firstrun_rect.left); - db_set_dw(NULL, MODULENAME, "FirstrunWindowY", globals.firstrun_rect.top); + g_plugin.setDword("FirstrunWindowX", globals.firstrun_rect.left); + g_plugin.setDword("FirstrunWindowY", globals.firstrun_rect.top); } void CDlgFirstRun::refresh_key_list() @@ -730,7 +730,7 @@ void CDlgFirstRun::refresh_key_list() setting += pa->szModuleName; setting += ")"; setting += "_KeyID"; - wchar_t *str = UniGetContactSettingUtf(NULL, MODULENAME, setting.c_str(), L""); + wchar_t *str = UniGetContactSettingUtf(0, MODULENAME, setting.c_str(), L""); if (key_id == str) { if (!accs.empty()) accs += L","; @@ -798,7 +798,7 @@ bool CDlgGpgBinOpts::OnInitDialog() { ptrW tmp; if (!gpg_exists) { - tmp = UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", (SHGetValueW(HKEY_CURRENT_USER, L"Software\\GNU\\GnuPG", L"gpgProgram", 0, (void*)path.c_str(), &len) == ERROR_SUCCESS) ? path.c_str() : L""); + tmp = UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", (SHGetValueW(HKEY_CURRENT_USER, L"Software\\GNU\\GnuPG", L"gpgProgram", 0, (void*)path.c_str(), &len) == ERROR_SUCCESS) ? path.c_str() : L""); if (tmp[0]) if (!boost::filesystem::exists((wchar_t*)tmp)) MessageBox(nullptr, TranslateT("Wrong GPG binary location found in system.\nPlease choose another location"), TranslateT("Warning"), MB_OK); @@ -807,7 +807,7 @@ bool CDlgGpgBinOpts::OnInitDialog() edit_BIN_PATH.SetText(tmp); if (gpg_exists/* && lang_exists*/) { - db_set_ws(NULL, MODULENAME, "szGpgBinPath", tmp); + g_plugin.setWString("szGpgBinPath", tmp); string out; DWORD code; std::vector<wstring> cmd; @@ -821,7 +821,7 @@ bool CDlgGpgBinOpts::OnInitDialog() globals.gpg_valid = true; gpg_launcher(params); globals.gpg_valid = _gpg_valid; //TODO: check this - db_unset(NULL, MODULENAME, "szGpgBinPath"); + g_plugin.delSetting("szGpgBinPath"); string::size_type p1 = out.find("(GnuPG) "); if (p1 != string::npos) { p1 += mir_strlen("(GnuPG) "); @@ -837,7 +837,7 @@ bool CDlgGpgBinOpts::OnInitDialog() } } { - ptrW tmp(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L"")); + ptrW tmp(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L"")); if (!tmp[0]) { wchar_t mir_path[MAX_PATH]; PathToAbsoluteW(L"\\", mir_path); @@ -864,7 +864,7 @@ bool CDlgGpgBinOpts::OnInitDialog() void CDlgGpgBinOpts::onClick_SET_BIN_PATH(CCtrlButton*) { GetFilePath(L"Choose gpg.exe", "szGpgBinPath", L"*.exe", L"EXE Executables"); - CMStringW tmp(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L"gpg.exe"))); + CMStringW tmp(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L"gpg.exe"))); edit_BIN_PATH.SetText(tmp); wchar_t mir_path[MAX_PATH]; PathToAbsoluteW(L"\\", mir_path); @@ -877,7 +877,7 @@ void CDlgGpgBinOpts::onClick_SET_BIN_PATH(CCtrlButton*) void CDlgGpgBinOpts::onClick_SET_HOME_DIR(CCtrlButton*) { GetFolderPath(L"Set home directory"); - CMStringW tmp(ptrW(UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""))); + CMStringW tmp(ptrW(UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""))); edit_HOME_DIR.SetText(tmp); wchar_t mir_path[MAX_PATH]; PathToAbsoluteW(L"\\", mir_path); @@ -893,7 +893,7 @@ void CDlgGpgBinOpts::onClick_OK(CCtrlButton*) if (gpg_validate_paths(edit_BIN_PATH.GetText(), edit_HOME_DIR.GetText())) { gpg_save_paths(edit_BIN_PATH.GetText(), edit_HOME_DIR.GetText()); globals.gpg_valid = true; - db_set_b(NULL, MODULENAME, "FirstRun", 0); + g_plugin.setByte("FirstRun", 0); this->Hide(); CDlgFirstRun *d = new CDlgFirstRun; d->Show(); @@ -907,9 +907,9 @@ void CDlgGpgBinOpts::onClick_GENERATE_RANDOM(CCtrlButton*) gpg_save_paths(edit_BIN_PATH.GetText(), edit_HOME_DIR.GetText()); globals.gpg_valid = true; if (gpg_use_new_random_key()) { - db_set_b(NULL, MODULENAME, "bAutoExchange", globals.bAutoExchange = chk_AUTO_EXCHANGE.GetState()); + g_plugin.setByte("bAutoExchange", globals.bAutoExchange = chk_AUTO_EXCHANGE.GetState()); globals.gpg_valid = true; - db_set_b(NULL, MODULENAME, "FirstRun", 0); + g_plugin.setByte("FirstRun", 0); this->Close(); } } @@ -957,8 +957,8 @@ bool CDlgNewKey::OnInitDialog() void CDlgNewKey::OnDestroy() { GetWindowRect(m_hwnd, &globals.new_key_rect); - db_set_dw(NULL, MODULENAME, "NewKeyWindowX", globals.new_key_rect.left); - db_set_dw(NULL, MODULENAME, "NewKeyWindowY", globals.new_key_rect.top); + g_plugin.setDword("NewKeyWindowX", globals.new_key_rect.left); + g_plugin.setDword("NewKeyWindowY", globals.new_key_rect.top); } void CDlgNewKey::onClick_IMPORT(CCtrlButton*) @@ -1081,7 +1081,7 @@ void CDlgKeyGen::onClick_OK(CCtrlButton*) mir_free(tmp); } { //generating key file - wchar_t *tmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *tmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); char *tmp2;// = mir_u2a(tmp); path = tmp; mir_free(tmp); @@ -1175,8 +1175,8 @@ void CDlgKeyGen::onClick_CANCEL(CCtrlButton*) void CDlgKeyGen::OnDestroy() { GetWindowRect(m_hwnd, &globals.key_gen_rect); - db_set_dw(NULL, MODULENAME, "KeyGenWindowX", globals.key_gen_rect.left); - db_set_dw(NULL, MODULENAME, "KeyGenWindowY", globals.key_gen_rect.top); + g_plugin.setDword("KeyGenWindowX", globals.key_gen_rect.left); + g_plugin.setDword("KeyGenWindowY", globals.key_gen_rect.top); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1298,8 +1298,8 @@ bool CDlgLoadExistingKey::OnInitDialog() void CDlgLoadExistingKey::OnDestroy() { GetWindowRect(m_hwnd, &globals.load_existing_key_rect); - db_set_dw(NULL, MODULENAME, "LoadExistingKeyWindowX", globals.load_existing_key_rect.left); - db_set_dw(NULL, MODULENAME, "LoadExistingKeyWindowY", globals.load_existing_key_rect.top); + g_plugin.setDword("LoadExistingKeyWindowX", globals.load_existing_key_rect.left); + g_plugin.setDword("LoadExistingKeyWindowY", globals.load_existing_key_rect.top); } void CDlgLoadExistingKey::onClick_OK(CCtrlButton*) @@ -1382,8 +1382,8 @@ bool CDlgImportKey::OnInitDialog() void CDlgImportKey::OnDestroy() { GetWindowRect(m_hwnd, &globals.import_key_rect); - db_set_dw(NULL, MODULENAME, "ImportKeyWindowX", globals.import_key_rect.left); - db_set_dw(NULL, MODULENAME, "ImportKeyWindowY", globals.import_key_rect.top); + g_plugin.setDword("ImportKeyWindowX", globals.import_key_rect.left); + g_plugin.setDword("ImportKeyWindowY", globals.import_key_rect.top); } void CDlgImportKey::onClick_IMPORT(CCtrlButton*) @@ -1438,8 +1438,8 @@ void CDlgKeyPasswordMsgBox::OnDestroy() { mir_free(inkeyid); GetWindowRect(m_hwnd, &globals.key_password_rect); - db_set_dw(NULL, MODULENAME, "PasswordWindowX", globals.key_password_rect.left); - db_set_dw(NULL, MODULENAME, "PasswordWindowY", globals.key_password_rect.top); + g_plugin.setDword("PasswordWindowX", globals.key_password_rect.left); + g_plugin.setDword("PasswordWindowY", globals.key_password_rect.top); } void CDlgKeyPasswordMsgBox::onClick_OK(CCtrlButton*) @@ -1452,10 +1452,10 @@ void CDlgKeyPasswordMsgBox::onClick_OK(CCtrlButton*) string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; - db_set_ws(NULL, MODULENAME, dbsetting.c_str(), tmp); + g_plugin.setWString(dbsetting.c_str(), tmp); } else - db_set_ws(NULL, MODULENAME, "szKeyPassword", tmp); + g_plugin.setWString("szKeyPassword", tmp); } if (globals.password) mir_free(globals.password); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index fed328235e..bbb140f0c7 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -74,7 +74,7 @@ void GetFilePath(wchar_t *WindowTittle, char *szSetting, wchar_t *szExt, wchar_t ofn.nMaxFileTitle = MAX_PATH; if (!GetOpenFileName(&ofn)) return; - db_set_ws(0, MODULENAME, szSetting, str); + g_plugin.setWString(szSetting, str); } wchar_t* GetFilePath(wchar_t *WindowTittle, wchar_t *szExt, wchar_t *szExtDesc, bool save_file) @@ -121,7 +121,7 @@ void GetFolderPath(wchar_t *WindowTittle) if (pidl != nullptr) { wchar_t path[MAX_PATH]; if (SHGetPathFromIDList(pidl, path)) { - db_set_ws(NULL, MODULENAME, "szHomePath", path); + g_plugin.setWString("szHomePath", path); } IMalloc * imalloc = nullptr; if (SUCCEEDED(SHGetMalloc(&imalloc))) { @@ -156,10 +156,10 @@ INT_PTR SendKey(WPARAM w, LPARAM) key_id_str += "_KeyID"; acc_str += "_GPGPubKey"; } - szMessage = UniGetContactSettingUtf(NULL, MODULENAME, acc_str.empty() ? "GPGPubKey" : acc_str.c_str(), ""); + szMessage = UniGetContactSettingUtf(0, MODULENAME, acc_str.empty() ? "GPGPubKey" : acc_str.c_str(), ""); if (!szMessage[0]) { mir_free(szMessage); - szMessage = UniGetContactSettingUtf(NULL, MODULENAME, "GPGPubKey", ""); //try to get default key as fallback in any way + szMessage = UniGetContactSettingUtf(0, MODULENAME, "GPGPubKey", ""); //try to get default key as fallback in any way } } if (szMessage[0]) { @@ -167,10 +167,10 @@ INT_PTR SendKey(WPARAM w, LPARAM) db_set_b(hContact, MODULENAME, "GPGEncryption", 0); ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)szMessage); std::string msg = "Public key "; - char *keyid = UniGetContactSettingUtf(NULL, MODULENAME, key_id_str.c_str(), ""); + char *keyid = UniGetContactSettingUtf(0, MODULENAME, key_id_str.c_str(), ""); if (!keyid[0]) { mir_free(keyid); - keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); } msg += keyid; mir_free(keyid); @@ -229,10 +229,10 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM) setting += ")"; setting += "_KeyID"; } - char *keyid = UniGetContactSettingUtf(NULL, MODULENAME, setting.c_str(), ""); + char *keyid = UniGetContactSettingUtf(0, MODULENAME, setting.c_str(), ""); if (!keyid[0]) { mir_free(keyid); - keyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + keyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); } wchar_t buf[128] = { 0 }; mir_snwprintf(buf, L"%s: %s", TranslateT("Send public key"), toUTF16(keyid).c_str()); @@ -319,12 +319,12 @@ int onProtoAck(WPARAM, LPARAM l) string dbsetting = "szKey_"; dbsetting += keyid; dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, MODULENAME, dbsetting.c_str(), L""); + pass = UniGetContactSettingUtf(0, MODULENAME, dbsetting.c_str(), L""); if (mir_wstrlen(pass) > 0 && globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password in database for key ID: " + keyid + ", trying to decrypt message from " + toUTF8(Clist_GetContactDisplayName(ack->hContact)) + " with password"); } else { - pass = UniGetContactSettingUtf(NULL, MODULENAME, "szKeyPassword", L""); + pass = UniGetContactSettingUtf(0, MODULENAME, "szKeyPassword", L""); if (mir_wstrlen(pass) > 0 && globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to decrypt message from " + toUTF8(Clist_GetContactDisplayName(ack->hContact)) + " with password"); } @@ -669,7 +669,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) } if (globals.bPresenceSigning && nodename && wcsstr(nodename, L"status")) { - wchar_t *path_c = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *path_c = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); wstring path_out = path_c; wstring file = toUTF16(get_random(10)); mir_free(path_c); @@ -693,10 +693,10 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) char setting[64]; mir_snprintf(setting, sizeof(setting) - 1, "%s_KeyID", ji->GetModuleName()); - inkeyid = UniGetContactSettingUtf(NULL, MODULENAME, setting, ""); + inkeyid = UniGetContactSettingUtf(0, MODULENAME, setting, ""); if (!inkeyid[0]) { mir_free(inkeyid); - inkeyid = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", ""); + inkeyid = UniGetContactSettingUtf(0, MODULENAME, "KeyID", ""); } ptrW pass; @@ -704,14 +704,14 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, MODULENAME, dbsetting.c_str(), L""); + pass = UniGetContactSettingUtf(0, MODULENAME, dbsetting.c_str(), L""); if (pass[0] && globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password in database for key ID: " + inkeyid + ", trying to encrypt message from self with password"); } if (inkeyid && inkeyid[0]) mir_free(inkeyid); else { - pass = UniGetContactSettingUtf(NULL, MODULENAME, "szKeyPassword", L""); + pass = UniGetContactSettingUtf(0, MODULENAME, "szKeyPassword", L""); if (pass[0] && globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password for all keys in database, trying to encrypt message from self with password"); } @@ -730,7 +730,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) } cmd.push_back(L"--local-user"); - path_c = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", L""); + path_c = UniGetContactSettingUtf(0, MODULENAME, "KeyID", L""); cmd.push_back(path_c); cmd.push_back(L"--default-key"); cmd.push_back(path_c); @@ -832,7 +832,7 @@ static JABBER_HANDLER_FUNC PresenceHandler(IJabberInterface*, HXML node, void*) wstring file = toUTF16(get_random(10)), status_file = toUTF16(get_random(10)); sign += data; sign += L"\n-----END PGP SIGNATURE-----\n"; - wchar_t *path_c = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *path_c = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); wstring path_out = path_c, status_file_out = path_c; mir_free(path_c); path_out += L"\\tmp\\"; @@ -972,8 +972,8 @@ bool isContactHaveKey(MCONTACT hContact) bool isGPGKeyExist() { - wchar_t *id = UniGetContactSettingUtf(NULL, MODULENAME, "KeyID", L""); - char *key = UniGetContactSettingUtf(NULL, MODULENAME, "GPGPubKey", ""); + wchar_t *id = UniGetContactSettingUtf(0, MODULENAME, "KeyID", L""); + char *key = UniGetContactSettingUtf(0, MODULENAME, "GPGPubKey", ""); if (id[0] && key[0]) { mir_free(id); mir_free(key); @@ -987,7 +987,7 @@ bool isGPGValid() { wchar_t *tmp = nullptr; bool gpg_exists = false, is_valid = true; - tmp = UniGetContactSettingUtf(NULL, MODULENAME, "szGpgBinPath", L""); + tmp = UniGetContactSettingUtf(0, MODULENAME, "szGpgBinPath", L""); boost::filesystem::path p(tmp); if (boost::filesystem::exists(p) && boost::filesystem::is_regular_file(p)) @@ -1018,7 +1018,7 @@ bool isGPGValid() } if (gpg_exists) { - db_set_ws(NULL, MODULENAME, "szGpgBinPath", tmp); + g_plugin.setWString("szGpgBinPath", tmp); mir_free(tmp); tmp = nullptr; string out; @@ -1046,7 +1046,7 @@ bool isGPGValid() { wstring path_ = _wgetenv(L"APPDATA"); path_ += L"\\GnuPG"; - tmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", (wchar_t*)path_.c_str()); + tmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", (wchar_t*)path_.c_str()); } if(tmp) mir_free(tmp); */ @@ -1212,7 +1212,7 @@ int handleEnum(const char *szSetting, void *lParam) { if (!*(bool*)lParam && szSetting[0] && StriStr(szSetting, "tabsrmm")) { bool f = false, *found = (bool*)lParam; - f = !db_get_b(NULL, "PluginDisable", szSetting, 0); + f = !db_get_b(0, "PluginDisable", szSetting, 0); if (f) *found = f; } @@ -1595,7 +1595,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) string output; DWORD exitcode; { - ptmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + ptmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); path = ptmp; mir_free(ptmp); wstring rand = toUTF16(get_random(10)); @@ -1700,7 +1700,7 @@ INT_PTR ImportGpGKeys(WPARAM, LPARAM) string output; DWORD exitcode; { - ptmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + ptmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); wcsncpy(tmp2, ptmp, MAX_PATH - 1); mir_free(ptmp); mir_wstrncat(tmp2, L"\\", _countof(tmp2) - mir_wstrlen(tmp2)); @@ -1813,7 +1813,7 @@ void clean_temp_dir() wstring path = toUTF16(mir_path); SetCurrentDirectoryA(mir_path); delete[] mir_path; - wchar_t *tmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *tmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); path += tmp; mir_free(tmp); path += L"\\tmp"; @@ -1847,7 +1847,7 @@ bool gpg_validate_paths(wchar_t *gpg_bin_path, wchar_t *gpg_home_path) } { bool bad_version = false; - db_set_ws(NULL, MODULENAME, "szGpgBinPath", tmp.c_str()); + g_plugin.setWString("szGpgBinPath", tmp.c_str()); string out; DWORD code; std::vector<wstring> cmd; @@ -1861,7 +1861,7 @@ bool gpg_validate_paths(wchar_t *gpg_bin_path, wchar_t *gpg_home_path) globals.gpg_valid = true; gpg_launcher(params); globals.gpg_valid = _gpg_valid; //TODO: check this - db_unset(NULL, MODULENAME, "szGpgBinPath"); + g_plugin.delSetting("szGpgBinPath"); string::size_type p1 = out.find("(GnuPG) "); if (p1 != string::npos) { p1 += mir_strlen("(GnuPG) "); @@ -1884,7 +1884,7 @@ bool gpg_validate_paths(wchar_t *gpg_bin_path, wchar_t *gpg_home_path) return false; } { - wchar_t *path = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + wchar_t *path = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); DWORD dwFileAttr = GetFileAttributes(path); if (dwFileAttr != INVALID_FILE_ATTRIBUTES) { dwFileAttr &= ~FILE_ATTRIBUTE_READONLY; @@ -1897,8 +1897,8 @@ bool gpg_validate_paths(wchar_t *gpg_bin_path, wchar_t *gpg_home_path) void gpg_save_paths(wchar_t *gpg_bin_path, wchar_t *gpg_home_path) { - db_set_ws(NULL, MODULENAME, "szGpgBinPath", gpg_bin_path); - db_set_ws(NULL, MODULENAME, "szHomePath", gpg_home_path); + g_plugin.setWString("szGpgBinPath", gpg_bin_path); + g_plugin.setWString("szHomePath", gpg_home_path); } bool gpg_use_new_random_key(char *account_name, wchar_t *gpg_bin_path, wchar_t *gpg_home_dir) @@ -1913,7 +1913,7 @@ bool gpg_use_new_random_key(char *account_name, wchar_t *gpg_bin_path, wchar_t * if (gpg_home_dir) tmp = gpg_home_dir; else - tmp = UniGetContactSettingUtf(NULL, MODULENAME, "szHomePath", L""); + tmp = UniGetContactSettingUtf(0, MODULENAME, "szHomePath", L""); path = tmp; if (!gpg_home_dir) mir_free(tmp); @@ -1991,16 +1991,16 @@ bool gpg_use_new_random_key(char *account_name, wchar_t *gpg_bin_path, wchar_t * out.erase(s, 1); if (!mir_strcmp(account_name, Translate("Default"))) { - db_set_s(NULL, MODULENAME, "GPGPubKey", out.c_str()); - db_set_ws(NULL, MODULENAME, "KeyID", path.c_str()); + g_plugin.setString("GPGPubKey", out.c_str()); + g_plugin.setWString("KeyID", path.c_str()); } else { std::string acc_str = account_name; acc_str += "_GPGPubKey"; - db_set_s(NULL, MODULENAME, acc_str.c_str(), out.c_str()); + g_plugin.setString(acc_str.c_str(), out.c_str()); acc_str = account_name; acc_str += "_KeyID"; - db_set_ws(NULL, MODULENAME, acc_str.c_str(), path.c_str()); + g_plugin.setWString(acc_str.c_str(), path.c_str()); } } return true; diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index 8623ec52c4..9459f9697c 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -30,7 +30,7 @@ void InitMenu() SET_UID(mi, 0x3ec91864, 0xefa7, 0x4994, 0xb7, 0x75, 0x6c, 0x96, 0xcb, 0x29, 0x2f, 0x93);
mi.position = 10100001;
- if (db_get_b(NULL, MODULENAME, "AutoUpdate", 1))
+ if (g_plugin.getByte("AutoUpdate", 1))
mi.name.w = LPGENW("Auto Update Enabled");
else
mi.name.w = LPGENW("Auto Update Disabled");
@@ -79,5 +79,5 @@ void InitMenu() mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED;
hService2[6] = Menu_AddContactMenuItem(&mi, MODULENAME);
- Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(db_get_b(NULL, MODULENAME, "AutoUpdate", 1) ? "enabled" : "disabled"));
+ Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(g_plugin.getByte("AutoUpdate", 1) ? "enabled" : "disabled"));
}
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 852f316517..3dc61421d1 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -37,7 +37,7 @@ int NewsAggrInit(WPARAM, LPARAM) mir_wstrncpy(tszRoot, VARSW(L"%miranda_userdata%\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER)), _countof(tszRoot));
for (auto &hContact : Contacts(MODULENAME)) {
- if (!db_get_b(NULL, MODULENAME, "StartupRetrieve", 1))
+ if (!g_plugin.getByte("StartupRetrieve", 1))
db_set_dw(hContact, MODULENAME, "LastCheck", time(0));
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
@@ -209,7 +209,7 @@ INT_PTR NewsAggrGetAvatarInfo(WPARAM wParam, LPARAM lParam) // otherwise, cached avatar is used
if ((wParam & GAIF_FORCE) && db_get_dw(pai->hContact, MODULENAME, "UpdateTime", DEFAULT_UPDATE_TIME))
UpdateListAdd(pai->hContact);
- if (db_get_b(NULL, MODULENAME, "AutoUpdate", 1) != 0 && !ThreadRunning)
+ if (g_plugin.getByte("AutoUpdate", 1) != 0 && !ThreadRunning)
mir_forkthread(UpdateThreadProc, (void *)TRUE);
wchar_t *ptszImageURL = db_get_wsa(pai->hContact, MODULENAME, "ImageURL");
@@ -239,14 +239,14 @@ void UpdateMenu(bool State) Menu_ModifyItem(hService2[0], LPGENW("Auto Update Disabled"), GetIconHandle("disabled"));
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : 0);
- db_set_b(NULL, MODULENAME, "AutoUpdate", !State);
+ g_plugin.setByte("AutoUpdate", !State);
}
// update the newsaggregator auto-update menu item when click on it
INT_PTR EnableDisable(WPARAM, LPARAM)
{
- UpdateMenu(db_get_b(NULL, MODULENAME, "AutoUpdate", 1) != 0);
- NewsAggrSetStatus(db_get_b(NULL, MODULENAME, "AutoUpdate", 1) ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE, 0);
+ UpdateMenu(g_plugin.getByte("AutoUpdate", 1) != 0);
+ NewsAggrSetStatus(g_plugin.getByte("AutoUpdate", 1) ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE, 0);
return 0;
}
@@ -259,7 +259,7 @@ int OnToolbarLoaded(WPARAM, LPARAM) ttb.pszTooltipDn = LPGEN("Auto Update Disabled");
ttb.hIconHandleUp = GetIconHandle("enabled");
ttb.hIconHandleDn = GetIconHandle("disabled");
- ttb.dwFlags = (db_get_b(NULL, MODULENAME, "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;
}
diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp index 7809904ad9..cde3ef2686 100644 --- a/plugins/NewsAggregator/Src/Update.cpp +++ b/plugins/NewsAggregator/Src/Update.cpp @@ -33,7 +33,7 @@ void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) for (auto &hContact : Contacts(MODULENAME)) {
if (db_get_dw(hContact, MODULENAME, "UpdateTime", DEFAULT_UPDATE_TIME)) {
double diff = difftime(time(0), (time_t)db_get_dw(hContact, MODULENAME, "LastCheck", 0));
- if (db_get_b(NULL, MODULENAME, "AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULENAME, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) {
+ if (g_plugin.getByte("AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULENAME, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) {
UpdateListAdd(hContact);
HaveUpdates = TRUE;
}
@@ -51,8 +51,8 @@ void CALLBACK timerProc2(HWND, UINT, UINT_PTR, DWORD) KillTimer(nullptr, timerId);
ThreadRunning = FALSE;
- if (db_get_b(NULL, MODULENAME, "AutoUpdate", 1) && !Miranda_IsTerminated()) {
- if (db_get_b(NULL, MODULENAME, "StartupRetrieve", 1))
+ if (g_plugin.getByte("AutoUpdate", 1) && !Miranda_IsTerminated()) {
+ if (g_plugin.getByte("StartupRetrieve", 1))
CheckAllFeeds(0, 1);
timerId = SetTimer(nullptr, 0, 30000, (TIMERPROC)timerProc);
}
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index ec3a49d1e3..9ee6ce2d77 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -156,10 +156,10 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1);
wchar_t string[512];
SetDlgItemText(hwnd, IDC_TIMER, _itow(db_get_w(hContact, MODNAME, "Timer", 15), string, 10));
- if (!db_get_w(NULL, MODNAME, "Timer", 1))
+ if (!db_get_w(0, MODNAME, "Timer", 1))
SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, TranslateT("Non-IM Contact protocol timer is Disabled"));
else {
- mir_snwprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(NULL, MODNAME, "Timer", 1));
+ mir_snwprintf(string, TranslateT("Timer intervals... Non-IM Contact Protocol timer is %d seconds"), db_get_w(0, MODNAME, "Timer", 1));
SetDlgItemText(hwnd, IDC_TIMER_INTERVAL_MSG, string);
}
}
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index fe21a066f3..873aac3052 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -22,10 +22,10 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
- CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, db_get_b(NULL, MODNAME, "AwayAsStatus", 0) ? BST_CHECKED : BST_UNCHECKED);
- if (db_get_w(NULL, MODNAME, "Timer", 1)) {
+ CheckDlgButton(hwnd, IDC_AWAYISNOTONLINE, db_get_b(0, MODNAME, "AwayAsStatus", 0) ? BST_CHECKED : BST_UNCHECKED);
+ if (db_get_w(0, MODNAME, "Timer", 1)) {
EnableWindow(GetDlgItem(hwnd, IDC_TIMER_INT), 1);
- SetDlgItemText(hwnd, IDC_TIMER_INT, _itow(db_get_w(NULL, MODNAME, "Timer", 1), tmp, 10));
+ SetDlgItemText(hwnd, IDC_TIMER_INT, _itow(db_get_w(0, MODNAME, "Timer", 1), tmp, 10));
EnableWindow(GetDlgItem(hwnd, IDC_TIMER_TEXT), 1);
}
else {
@@ -58,12 +58,12 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
+ db_set_b(0, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT))) {
GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, _countof(tmp));
- db_set_w(NULL, MODNAME, "Timer", (WORD)_wtoi(tmp));
+ db_set_w(0, MODNAME, "Timer", (WORD)_wtoi(tmp));
}
- else db_set_w(NULL, MODNAME, "Timer", 0);
+ else db_set_w(0, MODNAME, "Timer", 0);
return TRUE;
}
}
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index b0164a9ed7..8a58b495ac 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -132,8 +132,8 @@ void readFile(HWND hwnd) SendDlgItemMessageA(hwnd, IDC_FILE_CONTENTS, LB_ADDSTRING, 0, (LPARAM)temp1);
lineNumber++;
fileLength++;
- if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)))
- SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*db_get_b(NULL, MODNAME, "WidthMultiplier", 5)), 0);
+ if ((unsigned int)SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_GETHORIZONTALEXTENT, 0, 0) <= (mir_strlen(temp1)*db_get_b(0, MODNAME, "WidthMultiplier", 5)))
+ SendDlgItemMessage(hwnd, IDC_FILE_CONTENTS, LB_SETHORIZONTALEXTENT, (mir_strlen(temp1)*db_get_b(0, MODNAME, "WidthMultiplier", 5)), 0);
}
fclose(filen);
}
@@ -157,7 +157,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if ((!strncmp("http://", string, mir_strlen("http://"))) || (!strncmp("https://", string, mir_strlen("https://")))) {
SetDlgItemTextA(hwnd, IDC_URL, string);
mir_snprintf(fn, "fn%d_timer", i);
- SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10));
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(0, MODNAME, fn, 60), tmp, 10));
}
readFile(hwnd);
}
@@ -184,7 +184,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(szFileName, "%s\\plugins\\%s.html", getMimDir(temp), fn);
if (savehtml(szFileName)) {
mir_snprintf(fn, "fn%d", i);
- db_set_s(NULL, MODNAME, fn, url);
+ db_set_s(0, MODNAME, fn, url);
int timer;
if (!GetWindowTextLength(GetDlgItem(hwnd, IDC_WWW_TIMER)))
timer = 60;
@@ -193,7 +193,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) timer = atoi(text);
}
mir_snprintf(fn, "fn%d_timer", i);
- db_set_w(NULL, MODNAME, fn, (WORD)timer);
+ db_set_w(0, MODNAME, fn, (WORD)timer);
SendMessage(hwnd, WM_RELOADWINDOW, 0, 0);
}
break;
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(fn, "fn%d", i);
if (db_get_static(NULL, MODNAME, fn, file, _countof(file))) {
if (Openfile(file, 1)) {
- db_set_s(NULL, MODNAME, fn, file);
+ db_set_s(0, MODNAME, fn, file);
int index = SendDlgItemMessageA(hwnd, IDC_FILE_LIST, CB_ADDSTRING, 0, (LPARAM)file);
SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_SETITEMDATA, index, (LPARAM)i);
SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_SETCURSEL, index, 0);
@@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) while (!db_get_static(NULL, MODNAME, fn, tmp, _countof(tmp))) {
char fn1[4];
mir_snprintf(fn1, "fn%d", i - 1);
- db_set_s(NULL, MODNAME, fn1, tmp);
+ db_set_s(0, MODNAME, fn1, tmp);
mir_snprintf(fn, "fn%d", ++i);
}
mir_snprintf(fn, "fn%d", --i);
@@ -267,7 +267,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!strncmp("http://", tmp, mir_strlen("http://")) || !strncmp("https://", tmp, mir_strlen("https://"))) {
SetDlgItemTextA(hwnd, IDC_URL, tmp);
mir_snprintf(fn, "fn%d_timer", index);
- SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(NULL, MODNAME, fn, 60), tmp, 10));
+ SetDlgItemTextA(hwnd, IDC_WWW_TIMER, _itoa(db_get_w(0, MODNAME, fn, 60), tmp, 10));
}
else {
SetDlgItemText(hwnd, IDC_URL, L"");
@@ -302,7 +302,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!db_get_static(NULL, MODNAME, fn, string, _countof(string)))
if (!strncmp("http://", string, mir_strlen("http://")) || !strncmp("https://", string, mir_strlen("https://"))) {
mir_snprintf(fn, "fn%d_timer", i);
- db_set_w(NULL, MODNAME, fn, (WORD)timer);
+ db_set_w(0, MODNAME, fn, (WORD)timer);
}
return TRUE;
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 62bac3b7c5..bbefafd3a6 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -149,7 +149,7 @@ int CMPlugin::Load() mi.pszService = "LoadFilesDlg";
Menu_AddMainMenuItem(&mi);
- if (db_get_b(NULL, MODNAME, "Beta", 0)) {
+ if (db_get_b(0, MODNAME, "Beta", 0)) {
SET_UID(mi, 0x23051356, 0xad45, 0x4101, 0x8e, 0x11, 0xf6, 0x3a, 0xe8, 0xa3, 0xa5, 0x25);
mi.position = 600090002;
mi.name.a = LPGEN("&Export all Non-IM Contacts");
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index cb1103260b..8e93072747 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -302,19 +302,19 @@ void checkStringForSaveN(CMStringA &str) switch (D[0]) {
case '0':
case 'b':
- db_set_b(NULL, A, B, (BYTE)atoi(C));
+ db_set_b(0, A, B, (BYTE)atoi(C));
break;
case '1':
case 'w':
- db_set_w(NULL, A, B, (WORD)atoi(C));
+ db_set_w(0, A, B, (WORD)atoi(C));
break;
case '2':
case 'd':
- db_set_dw(NULL, A, B, (DWORD)atoi(C));
+ db_set_dw(0, A, B, (DWORD)atoi(C));
break;
case '3':
case 's':
- db_set_s(NULL, A, B, C);
+ db_set_s(0, A, B, C);
break;
}
}
diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index 395f323c98..4e70d79a4e 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -55,11 +55,11 @@ int SetLCStatus(WPARAM wParam, LPARAM) {
int oldStatus = LCStatus;
LCStatus = wParam;
- db_set_w(NULL, MODNAME, "Status", (WORD)wParam);
- db_set_w(NULL, MODNAME, "timerCount", 0);
- if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !db_get_b(NULL, MODNAME, "AwayAsStatus", 0)) || !db_get_w(NULL, MODNAME, "Timer", 1))
+ db_set_w(0, MODNAME, "Status", (WORD)wParam);
+ db_set_w(0, MODNAME, "timerCount", 0);
+ if (LCStatus == ID_STATUS_OFFLINE || (LCStatus == ID_STATUS_AWAY && !db_get_b(0, MODNAME, "AwayAsStatus", 0)) || !db_get_w(0, MODNAME, "Timer", 1))
killTimer();
- else if (db_get_w(NULL, MODNAME, "Timer", 1))
+ else if (db_get_w(0, MODNAME, "Timer", 1))
startTimer(TIMER);
for (auto &hContact : Contacts(MODNAME)) {
@@ -79,9 +79,9 @@ int SetLCStatus(WPARAM wParam, LPARAM) break;
case ID_STATUS_AWAY:
- if (db_get_b(NULL, MODNAME, "AwayAsStatus", 0) && (db_get_b(hContact, MODNAME, "AlwaysVisible", 0) || (db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE) == ID_STATUS_AWAY)))
+ if (db_get_b(0, MODNAME, "AwayAsStatus", 0) && (db_get_b(hContact, MODNAME, "AlwaysVisible", 0) || (db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE) == ID_STATUS_AWAY)))
db_set_w(hContact, MODNAME, "Status", (WORD)db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE));
- else if (!db_get_b(NULL, MODNAME, "AwayAsStatus", 0))
+ else if (!db_get_b(0, MODNAME, "AwayAsStatus", 0))
db_set_w(hContact, MODNAME, "Status", (WORD)db_get_w(hContact, MODNAME, "Icon", ID_STATUS_ONLINE));
else
db_set_w(hContact, MODNAME, "Status", ID_STATUS_OFFLINE);
diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h index 43d301a805..7df1c07b7b 100644 --- a/plugins/Non-IM Contact/src/stdafx.h +++ b/plugins/Non-IM Contact/src/stdafx.h @@ -58,7 +58,7 @@ struct DLGTEMPLATEEX #define MAX_STRING_LENGTH 10000
#define LINE_LENGTH 10000
#define msg(a,b) MessageBoxA(0,a,b,MB_OK);
-#define TIMER (db_get_w(NULL, MODNAME, "Timer", 1) * 1000)
+#define TIMER (db_get_w(0, MODNAME, "Timer", 1) * 1000)
/* ERROR VALUES */
#define ERROR_NO_LINE_AFTER_VAR_F -1
#define ERROR_LINE_NOT_READ -2
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index b076d9284f..ba658997d6 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -13,13 +13,13 @@ void timerFunc(void*) {
char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH];
- int timerCount = db_get_w(NULL, MODNAME, "timerCount", 1) + 1;
+ int timerCount = db_get_w(0, MODNAME, "timerCount", 1) + 1;
if (LCStatus == ID_STATUS_OFFLINE) {
killTimer();
return;
}
- db_set_w(NULL, MODNAME, "timerCount", (WORD)timerCount);
+ db_set_w(0, MODNAME, "timerCount", (WORD)timerCount);
/* update the web pages*/
for (int i = 0;; i++) {
@@ -29,7 +29,7 @@ void timerFunc(void*) if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) {
mir_snprintf(fn, "fn%d_timer", i);
- int timer = db_get_w(NULL, MODNAME, fn, 60);
+ int timer = db_get_w(0, MODNAME, fn, 60);
if (timer && !(timerCount % timer)) {
if (!InternetDownloadFile(text)) {
mir_snprintf(szFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), i);
@@ -77,7 +77,7 @@ int startTimer(int interval) int killTimer()
{
if (timerId != 0) {
- db_set_w(NULL, MODNAME, "timerCount", 0);
+ db_set_w(0, MODNAME, "timerCount", 0);
KillTimer(nullptr, timerId);
timerId = 0;
}
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 317127c8b7..66f764a94f 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -187,7 +187,7 @@ int OnModulesLoaded(WPARAM, LPARAM) RegisterFontServiceFonts();
RegisterKeyBindings();
- g_AddContListMI = (BOOL)db_get_dw(0, MODULENAME, "AddContactMenuItems", 1);
+ g_AddContListMI = (BOOL)g_plugin.getDword("AddContactMenuItems", 1);
// register menus
CMenuItem mi(&g_plugin);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 1f843c520c..493d47c6ee 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -334,7 +334,7 @@ void LoadNotes(BOOL bIsStartup) g_Stickies = nullptr; - int NotesCount = db_get_dw(0, MODULENAME, "NotesData", 0); + int NotesCount = g_plugin.getDword("NotesData", 0); for (int I = 0; I < NotesCount; I++) { char *DelPos; @@ -625,17 +625,17 @@ void PurgeNotes(void) { char ValueName[16]; - int NotesCount = db_get_dw(0, MODULENAME, "NotesData", 0); + int NotesCount = g_plugin.getDword("NotesData", 0); for (int I = 0; I < NotesCount; I++) { mir_snprintf(ValueName, "NotesData%d", I); - db_unset(0, MODULENAME, ValueName); + g_plugin.delSetting(ValueName); } } void DeleteNotes(void) { PurgeNotes(); - db_set_dw(0, MODULENAME, "NotesData", 0); + g_plugin.setDword("NotesData", 0); PurgeNotesTree(); NOTIFY_LIST(); } @@ -679,9 +679,9 @@ static void JustSaveNotesEx(STICKYNOTE *pModified = nullptr) int scrollV; char *tData; - const int OldNotesCount = db_get_dw(0, MODULENAME, "NotesData", 0); + const int OldNotesCount = g_plugin.getDword("NotesData", 0); - db_set_dw(0, MODULENAME, "NotesData", NotesCount); + g_plugin.setDword("NotesData", NotesCount); for (TREEELEMENT *TTE = g_Stickies; TTE; TTE = (TREEELEMENT*)TTE->next, I++) { STICKYNOTE *pNote = (STICKYNOTE*)TTE->ptrdata; @@ -798,7 +798,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified = nullptr) // delete any left over DB note entries for (; I < OldNotesCount; I++) { mir_snprintf(ValueName, "NotesData%d", I); - db_unset(0, MODULENAME, ValueName); + g_plugin.delSetting(ValueName); } NOTIFY_LIST(); diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 6e87a570be..c088db9257 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -211,7 +211,7 @@ static int FS_ColorChanged(WPARAM, LPARAM) LoadNRFont(NR_FONTID_CAPTION, &lfCaption, (COLORREF*)&CaptionFontColor);
LoadNRFont(NR_FONTID_BODY, &lfBody, (COLORREF*)&BodyFontColor);
- BodyColor = db_get_dw(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
+ BodyColor = g_plugin.getDword(colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
SaveNotes();
LoadNotes(FALSE);
@@ -399,21 +399,21 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l }
SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
if (g_lpszAltBrowser)
- db_set_s(0, MODULENAME, "AltBrowser", g_lpszAltBrowser);
+ g_plugin.setString("AltBrowser", g_lpszAltBrowser);
else
- db_unset(0, MODULENAME, "AltBrowser");
-
- db_set_dw(0, MODULENAME, "ShowNotesAtStart", g_ShowNotesAtStart);
- db_set_dw(0, MODULENAME, "ShowNoteButtons", g_ShowNoteButtons);
- db_set_dw(0, MODULENAME, "ShowScrollbar", g_ShowScrollbar);
- db_set_dw(0, MODULENAME, "AddContactMenuItems", g_AddContListMI);
- db_set_dw(0, MODULENAME, "NoteWidth", g_NoteWidth);
- db_set_dw(0, MODULENAME, "NoteHeight", g_NoteHeight);
- db_set_dw(0, MODULENAME, "Transparency", g_Transparency);
- db_set_dw(0, MODULENAME, "NoteTitleDate", g_NoteTitleDate);
- db_set_dw(0, MODULENAME, "NoteTitleTime", g_NoteTitleTime);
- db_set_dw(0, MODULENAME, "CloseAfterAddReminder", g_CloseAfterAddReminder);
- db_set_dw(0, MODULENAME, "UseMCI", !g_UseDefaultPlaySound);
+ g_plugin.delSetting("AltBrowser");
+
+ g_plugin.setDword("ShowNotesAtStart", g_ShowNotesAtStart);
+ g_plugin.setDword("ShowNoteButtons", g_ShowNoteButtons);
+ g_plugin.setDword("ShowScrollbar", g_ShowScrollbar);
+ g_plugin.setDword("AddContactMenuItems", g_AddContListMI);
+ g_plugin.setDword("NoteWidth", g_NoteWidth);
+ g_plugin.setDword("NoteHeight", g_NoteHeight);
+ g_plugin.setDword("Transparency", g_Transparency);
+ g_plugin.setDword("NoteTitleDate", g_NoteTitleDate);
+ g_plugin.setDword("NoteTitleTime", g_NoteTitleTime);
+ g_plugin.setDword("CloseAfterAddReminder", g_CloseAfterAddReminder);
+ g_plugin.setDword("UseMCI", !g_UseDefaultPlaySound);
SaveNotes();
LoadNotes(FALSE);
return TRUE;
@@ -521,26 +521,26 @@ void InitSettings(void) FreeSettingBlob(Sz1, P);
}
- g_lpszAltBrowser = db_get_sa(0, MODULENAME, "AltBrowser");
+ g_lpszAltBrowser = g_plugin.getStringA("AltBrowser");
- g_ShowNotesAtStart = (BOOL)db_get_dw(0, MODULENAME, "ShowNotesAtStart", 1);
- g_ShowNoteButtons = (BOOL)db_get_dw(0, MODULENAME, "ShowNoteButtons", 1);
- g_ShowScrollbar = (BOOL)db_get_dw(0, MODULENAME, "ShowScrollbar", 1);
- g_AddContListMI = (BOOL)db_get_dw(0, MODULENAME, "AddContactMenuItems", 1);
- g_NoteWidth = db_get_dw(0, MODULENAME, "NoteWidth", 179);
- g_NoteHeight = db_get_dw(0, MODULENAME, "NoteHeight", 50);
- g_Transparency = db_get_dw(0, MODULENAME, "Transparency", 255);
- g_NoteTitleDate = db_get_dw(0, MODULENAME, "NoteTitleDate", 1);
- g_NoteTitleTime = db_get_dw(0, MODULENAME, "NoteTitleTime", 1);
- g_CloseAfterAddReminder = (BOOL)db_get_dw(0, MODULENAME, "CloseAfterAddReminder", 1);
- g_UseDefaultPlaySound = !(BOOL)db_get_dw(0, MODULENAME, "UseMCI", 1);
+ g_ShowNotesAtStart = (BOOL)g_plugin.getDword("ShowNotesAtStart", 1);
+ g_ShowNoteButtons = (BOOL)g_plugin.getDword("ShowNoteButtons", 1);
+ g_ShowScrollbar = (BOOL)g_plugin.getDword("ShowScrollbar", 1);
+ g_AddContListMI = (BOOL)g_plugin.getDword("AddContactMenuItems", 1);
+ g_NoteWidth = g_plugin.getDword("NoteWidth", 179);
+ g_NoteHeight = g_plugin.getDword("NoteHeight", 50);
+ g_Transparency = g_plugin.getDword("Transparency", 255);
+ g_NoteTitleDate = g_plugin.getDword("NoteTitleDate", 1);
+ g_NoteTitleTime = g_plugin.getDword("NoteTitleTime", 1);
+ g_CloseAfterAddReminder = (BOOL)g_plugin.getDword("CloseAfterAddReminder", 1);
+ g_UseDefaultPlaySound = !(BOOL)g_plugin.getDword("UseMCI", 1);
ReadSettingIntArray(0, MODULENAME, "ReminderListGeom", g_reminderListGeom, _countof(g_reminderListGeom));
ReadSettingIntArray(0, MODULENAME, "ReminderListColGeom", g_reminderListColGeom, _countof(g_reminderListColGeom));
ReadSettingIntArray(0, MODULENAME, "NotesListGeom", g_notesListGeom, _countof(g_notesListGeom));
ReadSettingIntArray(0, MODULENAME, "NotesListColGeom", g_notesListColGeom, _countof(g_notesListColGeom));
- BodyColor = db_get_dw(NULL, MODULENAME, colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
+ BodyColor = g_plugin.getDword(colourOptionsList[0].szSettingName, colourOptionsList[0].defColour);
InitFonts();
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 5f8b9b7fc6..e8a021da1d 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -160,10 +160,10 @@ void PurgeReminders(void) {
char ValueName[32];
- int ReminderCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
+ int ReminderCount = g_plugin.getDword("RemindersData", 0);
for (int I = 0; I < ReminderCount; I++) {
mir_snprintf(ValueName, "RemindersData%d", I);
- db_unset(0, MODULENAME, ValueName);
+ g_plugin.delSetting(ValueName);
}
}
@@ -174,11 +174,11 @@ void JustSaveReminders(void) char ValueName[32];
int ReminderCount;
- const int OldReminderCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
+ const int OldReminderCount = g_plugin.getDword("RemindersData", 0);
ReminderCount = TreeGetCount(RemindersList);
- db_set_dw(0, MODULENAME, "RemindersData", ReminderCount);
+ g_plugin.setDword("RemindersData", ReminderCount);
for (TREEELEMENT *TTE = RemindersList; TTE; TTE = (TREEELEMENT *)TTE->next, I++) {
REMINDERDATA *pReminder = (REMINDERDATA *)TTE->ptrdata;
@@ -237,7 +237,7 @@ void JustSaveReminders(void) // delete any left over DB reminder entries
for (; I < OldReminderCount; I++) {
mir_snprintf(ValueName, "RemindersData%d", I);
- db_unset(0, MODULENAME, ValueName);
+ g_plugin.delSetting(ValueName);
}
}
@@ -249,7 +249,7 @@ void LoadReminders(void) BOOL GenerateUids = FALSE;
RemindersList = nullptr;
- int RemindersCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
+ int RemindersCount = g_plugin.getDword("RemindersData", 0);
for (int I = 0; I < RemindersCount; I++) {
Size = 65535;
@@ -429,7 +429,7 @@ void SaveReminders(void) void DeleteReminders(void)
{
PurgeReminders();
- db_set_dw(0, MODULENAME, "RemindersData", 0);
+ g_plugin.setDword("RemindersData", 0);
PurgeReminderTree();
}
@@ -465,10 +465,10 @@ static void Skin_PlaySoundPoly(LPCSTR pszSoundName) return;
}
- if (db_get_b(NULL, "SkinSoundsOff", pszSoundName, 0) == 0) {
+ if (db_get_b(0, "SkinSoundsOff", pszSoundName, 0) == 0) {
DBVARIANT dbv;
- if (db_get_s(NULL, "SkinSounds", pszSoundName, &dbv) == 0) {
+ if (db_get_s(0, "SkinSounds", pszSoundName, &dbv) == 0) {
char szFull[MAX_PATH];
PathToAbsolute(dbv.pszVal, szFull);
diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 0976c9151e..24c46c4f7e 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -134,34 +134,34 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara void save_settings()
{
- db_set_b(NULL, MODULENAME, "local_only", g_settings.local_only);
- db_set_b(NULL, MODULENAME, "debug_messages", g_settings.debug_messages);
- db_set_b(NULL, MODULENAME, "log_to_file", g_settings.log_to_file);
- db_set_b(NULL, MODULENAME, "beep", g_settings.sound);
- db_set_b(NULL, MODULENAME, "use_pcspeaker", g_settings.use_pcspeaker);
- db_set_b(NULL, MODULENAME, "allow_execute", g_settings.allow_execute);
- db_set_dw(NULL, MODULENAME, "port", g_settings.port);
- db_set_ws(NULL, MODULENAME, "password", g_settings.password.c_str());
- db_set_ws(NULL, MODULENAME, "log_filename", g_settings.log_filename.c_str());
+ g_plugin.setByte("local_only", g_settings.local_only);
+ g_plugin.setByte("debug_messages", g_settings.debug_messages);
+ g_plugin.setByte("log_to_file", g_settings.log_to_file);
+ g_plugin.setByte("beep", g_settings.sound);
+ g_plugin.setByte("use_pcspeaker", g_settings.use_pcspeaker);
+ g_plugin.setByte("allow_execute", g_settings.allow_execute);
+ g_plugin.setDword("port", g_settings.port);
+ g_plugin.setWString("password", g_settings.password.c_str());
+ g_plugin.setWString("log_filename", g_settings.log_filename.c_str());
}
void load_settings()
{
- g_settings.local_only = db_get_b(NULL, MODULENAME, "local_only", 1) != 0;
- g_settings.debug_messages = db_get_b(NULL, MODULENAME, "debug_messages", 0) != 0;
- g_settings.log_to_file = db_get_b(NULL, MODULENAME, "log_to_file", 0) != 0;
- g_settings.sound = NASettings::sound_t(db_get_b(NULL, MODULENAME, "beep", g_settings.request));
- g_settings.use_pcspeaker = db_get_b(NULL, MODULENAME, "use_pcspeaker", 0) != 0;
- g_settings.allow_execute = db_get_b(NULL, MODULENAME, "allow_execute", 0) != 0;
- g_settings.port = db_get_dw(NULL, MODULENAME, "port", 12001);
+ g_settings.local_only = g_plugin.getByte("local_only", 1) != 0;
+ g_settings.debug_messages = g_plugin.getByte("debug_messages", 0) != 0;
+ g_settings.log_to_file = g_plugin.getByte("log_to_file", 0) != 0;
+ g_settings.sound = NASettings::sound_t(g_plugin.getByte("beep", g_settings.request));
+ g_settings.use_pcspeaker = g_plugin.getByte("use_pcspeaker", 0) != 0;
+ g_settings.allow_execute = g_plugin.getByte("allow_execute", 0) != 0;
+ g_settings.port = g_plugin.getDword("port", 12001);
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "password", &dbv)) {
+ if (!g_plugin.getWString("password", &dbv)) {
g_settings.password = dbv.pwszVal;
db_free(&dbv);
}
- if (!db_get_ws(NULL, MODULENAME, "log_filename", &dbv)) {
+ if (!g_plugin.getWString("log_filename", &dbv)) {
g_settings.log_filename = dbv.pwszVal;
db_free(&dbv);
}
diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp index 0fd8bf670f..dfac692132 100644 --- a/plugins/Nudge/src/nudge.cpp +++ b/plugins/Nudge/src/nudge.cpp @@ -4,97 +4,92 @@ void CNudge::Save(void) {
char SectionName[512];
mir_snprintf(SectionName, "useByProtocol");
- db_set_b(NULL, MODULENAME, SectionName, this->useByProtocol);
+ g_plugin.setByte(SectionName, this->useByProtocol);
mir_snprintf(SectionName, "RecvTimeSec");
- db_set_dw(NULL, MODULENAME, SectionName, this->recvTimeSec);
+ g_plugin.setDword(SectionName, this->recvTimeSec);
mir_snprintf(SectionName, "SendTimeSec");
- db_set_dw(NULL, MODULENAME, SectionName, this->sendTimeSec);
+ g_plugin.setDword(SectionName, this->sendTimeSec);
mir_snprintf(SectionName, "ResendDelaySec");
- db_set_dw(NULL, MODULENAME, SectionName, this->resendDelaySec);
+ g_plugin.setDword(SectionName, this->resendDelaySec);
}
void CNudge::Load(void)
{
char SectionName[512];
mir_snprintf(SectionName, "useByProtocol");
- this->useByProtocol = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
+ this->useByProtocol = g_plugin.getByte(SectionName, FALSE) != 0;
mir_snprintf(SectionName, "RecvTimeSec");
- this->recvTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
+ this->recvTimeSec = g_plugin.getDword(SectionName, 30);
mir_snprintf(SectionName, "SendTimeSec");
- this->sendTimeSec = db_get_dw(NULL, MODULENAME, SectionName, 30);
+ this->sendTimeSec = g_plugin.getDword(SectionName, 30);
mir_snprintf(SectionName, "ResendDelaySec");
- this->resendDelaySec = db_get_dw(NULL, MODULENAME, SectionName, 3);
+ this->resendDelaySec = g_plugin.getDword(SectionName, 3);
}
void CNudgeElement::Save(void)
{
char SectionName[512];
mir_snprintf(SectionName, "%s-openMessageWindow", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->openMessageWindow);
+ g_plugin.setByte(SectionName, this->openMessageWindow);
mir_snprintf(SectionName, "%s-openContactList", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->openContactList);
+ g_plugin.setByte(SectionName, this->openContactList);
mir_snprintf(SectionName, "%s-useIgnore", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->useIgnoreSettings);
+ g_plugin.setByte(SectionName, this->useIgnoreSettings);
mir_snprintf(SectionName, "%s-showStatus", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->showStatus);
+ g_plugin.setByte(SectionName, this->showStatus);
mir_snprintf(SectionName, "%s-showPopup", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->showPopup);
+ g_plugin.setByte(SectionName, this->showPopup);
mir_snprintf(SectionName, "%s-shakeClist", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->shakeClist);
+ g_plugin.setByte(SectionName, this->shakeClist);
mir_snprintf(SectionName, "%s-shakeChat", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->shakeChat);
+ g_plugin.setByte(SectionName, this->shakeChat);
mir_snprintf(SectionName, "%s-enabled", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->enabled);
+ g_plugin.setByte(SectionName, this->enabled);
mir_snprintf(SectionName, "%s-autoResend", ProtocolName);
- db_set_b(NULL, MODULENAME, SectionName, this->autoResend);
+ g_plugin.setByte(SectionName, this->autoResend);
mir_snprintf(SectionName, "%s-statusFlags", ProtocolName);
- db_set_dw(NULL, MODULENAME, SectionName, this->statusFlags);
+ g_plugin.setDword(SectionName, this->statusFlags);
mir_snprintf(SectionName, "%s-recText", ProtocolName);
- db_set_ws(NULL, MODULENAME, SectionName, this->recText);
+ g_plugin.setWString(SectionName, this->recText);
mir_snprintf(SectionName, "%s-senText", ProtocolName);
- db_set_ws(NULL, MODULENAME, SectionName, this->senText);
+ g_plugin.setWString(SectionName, this->senText);
}
void CNudgeElement::Load(void)
{
- DBVARIANT dbv;
char SectionName[512];
mir_snprintf(SectionName, "%s-openMessageWindow", ProtocolName);
- this->openMessageWindow = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->openMessageWindow = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-openContactList", ProtocolName);
- this->openContactList = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->openContactList = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-useIgnore", ProtocolName);
- this->useIgnoreSettings = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->useIgnoreSettings = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-showStatus", ProtocolName);
- this->showStatus = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->showStatus = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-showPopup", ProtocolName);
- this->showPopup = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->showPopup = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-shakeClist", ProtocolName);
- this->shakeClist = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->shakeClist = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-shakeChat", ProtocolName);
- this->shakeChat = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->shakeChat = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-enabled", ProtocolName);
- this->enabled = db_get_b(NULL, MODULENAME, SectionName, TRUE) != 0;
+ this->enabled = g_plugin.getByte(SectionName, TRUE) != 0;
mir_snprintf(SectionName, "%s-autoResend", ProtocolName);
- this->autoResend = db_get_b(NULL, MODULENAME, SectionName, FALSE) != 0;
+ this->autoResend = g_plugin.getByte(SectionName, FALSE) != 0;
mir_snprintf(SectionName, "%s-statusFlags", ProtocolName);
- this->statusFlags = db_get_dw(NULL, MODULENAME, SectionName, 967);
+ this->statusFlags = g_plugin.getDword(SectionName, 967);
mir_snprintf(SectionName, "%s-recText", ProtocolName);
- if (!db_get_ws(NULL, MODULENAME, SectionName, &dbv)) {
- wcsncpy(this->recText, dbv.pwszVal, TEXT_LEN);
- if (wcslen(this->recText) < 1)
- wcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN);
- db_free(&dbv);
- }
- else wcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN);
+ ptrW wszRecvText(g_plugin.getWStringA(SectionName));
+ if (mir_wstrlen(wszRecvText) > 0)
+ wcsncpy_s(this->recText, wszRecvText, _TRUNCATE);
+ else
+ wcsncpy_s(this->recText, TranslateT("You received a nudge"), _TRUNCATE);
mir_snprintf(SectionName, "%s-senText", ProtocolName);
- if (!db_get_ws(NULL, MODULENAME, SectionName, &dbv)) {
- wcsncpy(this->senText, dbv.pwszVal, TEXT_LEN);
- if (wcslen(this->senText) < 1)
- wcsncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN);
- db_free(&dbv);
- }
- else wcsncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN);
+ ptrW wszSendText(g_plugin.getWStringA(SectionName));
+ if (mir_wstrlen(wszSendText) > 0)
+ wcsncpy_s(this->senText, wszSendText, _TRUNCATE);
+ else
+ wcsncpy_s(this->senText, TranslateT("You sent a nudge"), _TRUNCATE);
}
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index f9c9bc3e2e..eeb9851da9 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -4,17 +4,17 @@ void CShake::Load(void) {
Shaking = false;
ShakingChat = false;
- nScaleClist = db_get_dw(NULL, MODULENAME, "ScaleClist", 5);
- nScaleChat = db_get_dw(NULL, MODULENAME, "ScaleChat", 2);
- nMoveClist = db_get_dw(NULL, MODULENAME, "MoveClist", 15);
- nMoveChat = db_get_dw(NULL, MODULENAME, "MoveChat", 15);
+ nScaleClist = g_plugin.getDword("ScaleClist", 5);
+ nScaleChat = g_plugin.getDword("ScaleChat", 2);
+ nMoveClist = g_plugin.getDword("MoveClist", 15);
+ nMoveChat = g_plugin.getDword("MoveChat", 15);
}
void CShake::Save(void)
{
- db_set_dw(NULL, MODULENAME, "ScaleClist", this->nScaleClist);
- db_set_dw(NULL, MODULENAME, "ScaleChat", this->nScaleChat);
- db_set_dw(NULL, MODULENAME, "MoveClist", this->nMoveClist);
- db_set_dw(NULL, MODULENAME, "MoveChat", this->nMoveChat);
+ g_plugin.setDword("ScaleClist", this->nScaleClist);
+ g_plugin.setDword("ScaleChat", this->nScaleChat);
+ g_plugin.setDword("MoveClist", this->nMoveClist);
+ g_plugin.setDword("MoveChat", this->nMoveChat);
}
void __cdecl ShakeChatWindow(void *Param)
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index a9d691e588..64cdc6da08 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -176,9 +176,9 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM) static void __stdcall CreateDownloadDialog(void*)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups3", DEFAULT_POPUP_ENABLED))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop);
- else if (db_get_b(NULL, MODULENAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
+ else if (g_plugin.getByte("Popups3M", DEFAULT_MESSAGE_ENABLED)) {
mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DOWNLOAD), nullptr, DlgDownload);
}
@@ -195,11 +195,11 @@ void DlgDownloadProc() if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occurred while downloading the update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONSTOP);
}
CallFunctionAsync(DestroyDownloadDialog, nullptr);
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
mir_wstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, _countof(todo[i].tszCurVer));
mir_snprintf(szKey, "File_%d_CurrentVersion", todo[i].FileNum);
- db_set_ws(NULL, MODULENAME, szKey, todo[i].tszCurVer);
+ g_plugin.setWString(szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
arFilePath.push_back(todo[i].File.tszDiskPath);
arFileName.push_back(tszFileName);
@@ -420,7 +420,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(NULL, "Popup", "Actions", 0) & 1))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(0, "Popup", "Actions", 0) & 1))
rc = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop);
else
rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
@@ -436,7 +436,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam break;
case 1:
if (Reminder == 2)
- db_set_b(NULL, MODULENAME, "Reminder", 1);
+ g_plugin.setByte("Reminder", 1);
memset(&si, 0, sizeof(STARTUPINFO));
memset(&pi, 0, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
@@ -504,15 +504,15 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
else { //reminder for not installed pack update
if (Reminder && (UpdatesCount == 1) && (arFileType[0] == 1))
- db_set_b(NULL, MODULENAME, "Reminder", 2);
+ g_plugin.setByte("Reminder", 2);
mir_snwprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
}
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp index 0e5b293e3a..281415d69a 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -65,7 +65,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA else {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, "Popups%dM", i);
- CheckDlgButton(hwndDlg, (i + 1029), (db_get_b(NULL, MODULENAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, (i + 1029), (g_plugin.getByte(str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
}
}
return TRUE;
@@ -134,17 +134,17 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA InitTimer();
- db_set_b(NULL, MODULENAME, "UpdateOnStartup", UpdateOnStartup);
- db_set_b(NULL, MODULENAME, "OnlyOnceADay", OnlyOnceADay);
- db_set_b(NULL, MODULENAME, "UpdateOnPeriod", UpdateOnPeriod);
- db_set_dw(NULL, MODULENAME, "Period", Period);
- db_set_b(NULL, MODULENAME, "PeriodMeasure", PeriodMeasure);
+ g_plugin.setByte("UpdateOnStartup", UpdateOnStartup);
+ g_plugin.setByte("OnlyOnceADay", OnlyOnceADay);
+ g_plugin.setByte("UpdateOnPeriod", UpdateOnPeriod);
+ g_plugin.setDword("Period", Period);
+ g_plugin.setByte("PeriodMeasure", PeriodMeasure);
Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
- db_set_b(NULL, MODULENAME, "Reminder", Reminder);
+ g_plugin.setByte("Reminder", Reminder);
if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
for (int i = 1; i < POPUPS; i++) {
mir_snprintf(str, "Popups%dM", i);
- db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
+ g_plugin.setByte(str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029))));
}
}
}
@@ -200,14 +200,14 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
mir_snprintf(str2, "Popups%dM", i);
- CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODULENAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, (i + 1024), (db_get_b(NULL, MODULENAME, str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 40071), (g_plugin.getByte(str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 1024), (g_plugin.getByte(str2, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, (i + 40071)))
EnableWindow(GetDlgItem(hdlg, (i + 1024)), FALSE);
else if (i > 0)
EnableWindow(GetDlgItem(hdlg, (i + 1024)), TRUE);
}
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(0, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -215,7 +215,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) return TRUE;
case WM_SHOWWINDOW:
- if (!(db_get_dw(NULL, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(0, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -349,27 +349,27 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) ctlColor = SendDlgItemMessage(hdlg, (i + 42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, "Popups%iBg", i);
- db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
+ g_plugin.setDword(szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i + 41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, "Popups%iTx", i);
- db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
+ g_plugin.setDword(szSetting, ctlColor);
}
//Colors
- db_set_b(NULL, MODULENAME, "DefColors", MyOptions.DefColors);
+ g_plugin.setByte("DefColors", MyOptions.DefColors);
//Timeout
MyOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
- db_set_dw(NULL, MODULENAME, "Timeout", MyOptions.Timeout);
+ g_plugin.setDword("Timeout", MyOptions.Timeout);
//Left mouse click
- db_set_b(NULL, MODULENAME, "LeftClickAction", MyOptions.LeftClickAction);
+ g_plugin.setByte("LeftClickAction", MyOptions.LeftClickAction);
//Right mouse click
- db_set_b(NULL, MODULENAME, "RightClickAction", MyOptions.RightClickAction);
+ g_plugin.setByte("RightClickAction", MyOptions.RightClickAction);
//Notified popups
for (i = 0; i < POPUPS; i++) {
mir_snprintf(str, "Popups%d", i);
- db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
+ g_plugin.setByte(str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
mir_snprintf(str2, "Popups%dM", i);
- db_set_b(NULL, MODULENAME, str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
+ g_plugin.setByte(str2, (BYTE)(IsDlgButtonChecked(hdlg, (i + 1024))));
}
return TRUE;
}
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index b6cb5c24ae..1f15dd40be 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -68,41 +68,41 @@ void InitPopupList() int index = 0;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups2Tx", COLOR_TX_DEFAULT);
index = 3;
PopupsList[index].ID = index;
PopupsList[index].Icon = SKINICON_OTHER_MIRANDA;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups3Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups3Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups3Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups3Tx", COLOR_TX_DEFAULT);
}
void LoadOptions()
{
- MyOptions.DefColors = db_get_b(NULL, MODULENAME, "DefColors", DEFAULT_COLORS);
- MyOptions.LeftClickAction = db_get_b(NULL, MODULENAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- MyOptions.RightClickAction = db_get_b(NULL, MODULENAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- MyOptions.Timeout = db_get_dw(NULL, MODULENAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
- UpdateOnStartup = db_get_b(NULL, MODULENAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- OnlyOnceADay = db_get_b(NULL, MODULENAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- UpdateOnPeriod = db_get_b(NULL, MODULENAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- Period = db_get_dw(NULL, MODULENAME, "Period", DEFAULT_PERIOD);
- PeriodMeasure = db_get_b(NULL, MODULENAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- Reminder = db_get_b(NULL, MODULENAME, "Reminder", DEFAULT_REMINDER);
- FileCount = db_get_dw(NULL, MODULENAME, "FileCount", DEFAULT_FILECOUNT);
+ MyOptions.DefColors = g_plugin.getByte("DefColors", DEFAULT_COLORS);
+ MyOptions.LeftClickAction = g_plugin.getByte("LeftClickAction", DEFAULT_POPUP_LCLICK);
+ MyOptions.RightClickAction = g_plugin.getByte("RightClickAction", DEFAULT_POPUP_RCLICK);
+ MyOptions.Timeout = g_plugin.getDword("Timeout", DEFAULT_TIMEOUT_VALUE);
+ UpdateOnStartup = g_plugin.getByte("UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ OnlyOnceADay = g_plugin.getByte("OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ UpdateOnPeriod = g_plugin.getByte("UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ Period = g_plugin.getDword("Period", DEFAULT_PERIOD);
+ PeriodMeasure = g_plugin.getByte("PeriodMeasure", DEFAULT_PERIODMEASURE);
+ Reminder = g_plugin.getByte("Reminder", DEFAULT_REMINDER);
+ FileCount = g_plugin.getDword("FileCount", DEFAULT_FILECOUNT);
}
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
@@ -164,7 +164,7 @@ BOOL Exists(LPCTSTR strName) BOOL IsPluginDisabled(wchar_t* filename)
{
char* fname = mir_u2a(filename);
- int res = db_get_b(NULL, "PluginDisable", fname, 0);
+ int res = db_get_b(0, "PluginDisable", fname, 0);
mir_free(fname);
return res;
}
@@ -185,19 +185,19 @@ static void CheckUpdates(void *) if (!Exists(tszRoot))
CreateDirectory(tszRoot, nullptr);
Files.clear();
- Reminder = db_get_b(NULL, MODULENAME, "Reminder", DEFAULT_REMINDER);
- FileCount = db_get_dw(NULL, MODULENAME, "FileCount", DEFAULT_FILECOUNT);
+ Reminder = g_plugin.getByte("Reminder", DEFAULT_REMINDER);
+ FileCount = g_plugin.getDword("FileCount", DEFAULT_FILECOUNT);
// Load files info
- ptrW tszDownloadURL(db_get_wsa(NULL, MODULENAME, "File_VersionURL"));
+ ptrW tszDownloadURL(g_plugin.getWStringA("File_VersionURL"));
if (!tszDownloadURL) { // URL is not set
Title = TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONSTOP);
hCheckThread = nullptr;
return;
@@ -221,14 +221,14 @@ static void CheckUpdates(void *) FILEINFO FileInfo = { L"", L"", L"", L"", L"", L"", L"", { L"", L"" } };
mir_snprintf(szKey, "File_%d_CurrentVersion", CurrentFile + 1);
- ptrW tszCurVer(db_get_wsa(NULL, MODULENAME, szKey));
+ ptrW tszCurVer(g_plugin.getWStringA(szKey));
if (tszCurVer)
mir_wstrncpy(FileInfo.tszCurVer, tszCurVer, _countof(FileInfo.tszCurVer));
else
mir_wstrncpy(FileInfo.tszCurVer, L"", _countof(FileInfo.tszCurVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- ptrW tszLastVer(db_get_wsa(NULL, MODULENAME, szKey));
+ ptrW tszLastVer(g_plugin.getWStringA(szKey));
if (tszLastVer)
mir_wstrncpy(FileInfo.tszLastVer, tszLastVer, _countof(FileInfo.tszLastVer));
else
@@ -248,11 +248,11 @@ static void CheckUpdates(void *) if (wcsstr(tszBuff, L"\\")) { //check update name
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups1M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
@@ -322,7 +322,7 @@ static void CheckUpdates(void *) // Save last version
mir_wstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, _countof(Files[CurrentFile].tszLastVer));
mir_snprintf(szKey, "File_%d_LastVersion", CurrentFile + 1);
- db_set_ws(NULL, MODULENAME, szKey, Files[CurrentFile].tszLastVer);
+ g_plugin.setWString(szKey, Files[CurrentFile].tszLastVer);
} // end compare versions
} //end checking all files in for ()
@@ -339,22 +339,22 @@ static void CheckUpdates(void *) if (!UpdatesCount && !Silent) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
if (!FileCount) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
hCheckThread = nullptr;
@@ -365,16 +365,16 @@ void DoCheck(int iFlag) if (hCheckThread != nullptr) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODULENAME, "Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
- else if (db_get_b(NULL, MODULENAME, "Popups2M", DEFAULT_MESSAGE_ENABLED))
+ else if (g_plugin.getByte("Popups2M", DEFAULT_MESSAGE_ENABLED))
MessageBox(nullptr, Text, Title, MB_ICONINFORMATION);
}
else if (iFlag) {
hCheckThread = mir_forkthread(CheckUpdates);
- db_set_dw(NULL, MODULENAME, "LastUpdate", time(0));
+ g_plugin.setDword("LastUpdate", time(0));
}
}
@@ -382,7 +382,7 @@ BOOL AllowUpdateOnStartup() {
if (OnlyOnceADay) {
time_t now = time(0);
- time_t was = db_get_dw(NULL, MODULENAME, "LastUpdate", 0);
+ time_t was = g_plugin.getDword("LastUpdate", 0);
if ((now - was) < 86400)
return FALSE;
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index fe6a819888..9f6602076f 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -630,7 +630,7 @@ unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int void Options::SetDefWeb(int web)
{
defWeb = web;
- db_set_ws(0, MODULENAME, "defWeb", pasteToWebs[web]->GetName());
+ g_plugin.setWString("defWeb", pasteToWebs[web]->GetName());
DefWebPageChanged();
}
@@ -697,11 +697,11 @@ int Options::InitOptions(WPARAM wParam, LPARAM) void Options::Save()
{
- db_set_ws(0, MODULENAME, "defWeb", pasteToWebs[defWeb]->GetName());
- db_set_dw(0, MODULENAME, "codepage", codepage);
- db_set_b(0, MODULENAME, "autoUTF", autoUTF ? 1 : 0);
- db_set_b(0, MODULENAME, "confDlg", confDlg ? 1 : 0);
- db_set_b(0, MODULENAME, "autoSend", autoSend ? 1 : 0);
+ g_plugin.setWString("defWeb", pasteToWebs[defWeb]->GetName());
+ g_plugin.setDword("codepage", codepage);
+ g_plugin.setByte("autoUTF", autoUTF ? 1 : 0);
+ g_plugin.setByte("confDlg", confDlg ? 1 : 0);
+ g_plugin.setByte("autoSend", autoSend ? 1 : 0);
for (int i = 0; i < PasteToWeb::pages; ++i) {
char buf[256];
wchar_t* name = pasteToWebs[i]->GetName();
@@ -718,29 +718,29 @@ void Options::Save() forms += it->id + L'=' + it->name + L';';
}
- db_set_ws(0, MODULENAME, buf, forms.c_str());
+ g_plugin.setWString(buf, forms.c_str());
mir_strncpy(buf + j, "defFormatId", _countof(buf) - j);
- db_set_ws(0, MODULENAME, buf, webOptions[i]->defFormatId.c_str());
+ g_plugin.setWString(buf, webOptions[i]->defFormatId.c_str());
if (webOptions[i]->isSendFileName) {
mir_strncpy(buf + j, "sendFileName", _countof(buf) - j);
- db_set_b(0, MODULENAME, buf, webOptions[i]->sendFileName ? 1 : 0);
+ g_plugin.setByte(buf, webOptions[i]->sendFileName ? 1 : 0);
}
if (webOptions[i]->isPublicPaste) {
mir_strncpy(buf + j, "publicPaste", _countof(buf) - j);
- db_set_b(0, MODULENAME, buf, webOptions[i]->publicPaste ? 1 : 0);
+ g_plugin.setByte(buf, webOptions[i]->publicPaste ? 1 : 0);
}
if (webOptions[i]->isCombo1) {
mir_strncpy(buf + j, "combo1", _countof(buf) - j);
- db_set_ws(0, MODULENAME, buf, webOptions[i]->combo1.c_str());
+ g_plugin.setWString(buf, webOptions[i]->combo1.c_str());
}
if (webOptions[i]->isPastebin) {
mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j);
- db_set_ws(0, MODULENAME, buf, webOptions[i]->pastebinUserKey.c_str());
+ g_plugin.setWString(buf, webOptions[i]->pastebinUserKey.c_str());
}
}
}
@@ -748,7 +748,7 @@ void Options::Save() void Options::Load()
{
DBVARIANT defWebV;
- if (!db_get_ws(0, MODULENAME, "defWeb", &defWebV)) {
+ if (!g_plugin.getWString("defWeb", &defWebV)) {
for (int i = 0; i < PasteToWeb::pages; ++i) {
if (!mir_wstrcmp(pasteToWebs[i]->GetName(), defWebV.pwszVal)) {
defWeb = i;
@@ -757,10 +757,10 @@ void Options::Load() }
db_free(&defWebV);
}
- codepage = db_get_dw(0, MODULENAME, "codepage", CP_ACP);
- autoUTF = db_get_b(0, MODULENAME, "autoUTF", 1) ? true : false;
- confDlg = db_get_b(0, MODULENAME, "confDlg", 1) ? true : false;
- autoSend = db_get_b(0, MODULENAME, "autoSend", 0) ? true : false;
+ codepage = g_plugin.getDword("codepage", CP_ACP);
+ autoUTF = g_plugin.getByte("autoUTF", 1) ? true : false;
+ confDlg = g_plugin.getByte("confDlg", 1) ? true : false;
+ autoSend = g_plugin.getByte("autoSend", 0) ? true : false;
for (int i = 0; i < PasteToWeb::pages; ++i) {
char buf[256];
int j = 0;
@@ -775,7 +775,7 @@ void Options::Load() mir_strncpy(buf + j, "formats", _countof(buf) - j);
DBVARIANT forms;
- if (!db_get_ws(0, MODULENAME, buf, &forms)) {
+ if (!g_plugin.getWString(buf, &forms)) {
webOptions[i]->formats.clear();
int k = 0;
wchar_t *id = forms.pwszVal;
@@ -802,25 +802,25 @@ void Options::Load() mir_strncpy(buf + j, "defFormatId", _countof(buf) - j);
DBVARIANT defForm;
- if (!db_get_ws(0, MODULENAME, buf, &defForm)) {
+ if (!g_plugin.getWString(buf, &defForm)) {
webOptions[i]->defFormatId = defForm.pwszVal;
db_free(&defForm);
}
if (webOptions[i]->isSendFileName) {
mir_strncpy(buf + j, "sendFileName", _countof(buf) - j);
- webOptions[i]->sendFileName = db_get_b(0, MODULENAME, buf, 1) ? true : false;
+ webOptions[i]->sendFileName = g_plugin.getByte(buf, 1) ? true : false;
}
if (webOptions[i]->isPublicPaste) {
mir_strncpy(buf + j, "publicPaste", _countof(buf) - j);
- webOptions[i]->publicPaste = db_get_b(0, MODULENAME, buf, 0) ? true : false;
+ webOptions[i]->publicPaste = g_plugin.getByte(buf, 0) ? true : false;
}
if (webOptions[i]->isCombo1) {
mir_strncpy(buf + j, "combo1", _countof(buf) - j);
DBVARIANT combo1;
- if (!db_get_ws(0, MODULENAME, buf, &combo1)) {
+ if (!g_plugin.getWString(buf, &combo1)) {
webOptions[i]->combo1 = combo1.pwszVal;
db_free(&combo1);
}
@@ -829,7 +829,7 @@ void Options::Load() if (webOptions[i]->isPastebin) {
mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j);
DBVARIANT pastebinUserKey;
- if (!db_get_ws(0, MODULENAME, buf, &pastebinUserKey)) {
+ if (!g_plugin.getWString(buf, &pastebinUserKey)) {
webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal;
db_free(&pastebinUserKey);
}
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index 2ac0f8db41..b084eb1f7f 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -32,7 +32,7 @@ INT_PTR Log(WPARAM wParam, LPARAM) { INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
wchar_t *filename = (wchar_t *)lParam;
- if (db_get_ws(0, MODULENAME, "LogFilename", &dbv)) {
+ if (g_plugin.getWString("LogFilename", &dbv)) {
Profile_GetPathW(wParam, filename);
mir_wstrncat(filename, L"\\ping_log.txt", wParam - mir_wstrlen(filename));
}
@@ -47,7 +47,7 @@ INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { }
INT_PTR SetLogFilename(WPARAM, LPARAM lParam) {
- db_set_ws(0, MODULENAME, "LogFilename", (wchar_t *)lParam);
+ g_plugin.setWString("LogFilename", (wchar_t *)lParam);
return 0;
}
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index c6bac11d8d..71e62e2a9b 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -514,50 +514,50 @@ int PingOptInit(WPARAM wParam, LPARAM) }
void LoadOptions() {
- options.ping_period = db_get_dw(NULL, MODULENAME, "PingPeriod", DEFAULT_PING_PERIOD);
+ options.ping_period = g_plugin.getDword("PingPeriod", DEFAULT_PING_PERIOD);
- options.ping_timeout = db_get_dw(NULL, MODULENAME, "PingTimeout", DEFAULT_PING_TIMEOUT);
+ options.ping_timeout = g_plugin.getDword("PingTimeout", DEFAULT_PING_TIMEOUT);
CallService(MODULENAME "/SetPingTimeout", (WPARAM)options.ping_timeout, 0);
- options.show_popup = (db_get_b(NULL, MODULENAME, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1);
- options.show_popup2 = (db_get_b(NULL, MODULENAME, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1);
- options.block_reps = (db_get_b(NULL, MODULENAME, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1);
- options.logging = (db_get_b(NULL, MODULENAME, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1);
+ options.show_popup = (g_plugin.getByte("ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1);
+ options.show_popup2 = (g_plugin.getByte("ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1);
+ options.block_reps = (g_plugin.getByte("BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1);
+ options.logging = (g_plugin.getByte("LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1);
- options.no_test_icon = (db_get_b(NULL, MODULENAME, "NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1);
+ options.no_test_icon = (g_plugin.getByte("NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1);
- options.indent = db_get_w(NULL, MODULENAME, "Indent", 0);
- options.row_height = db_get_w(NULL, MODULENAME, "RowHeight", GetSystemMetrics(SM_CYSMICON));
+ options.indent = g_plugin.getWord("Indent", 0);
+ options.row_height = g_plugin.getWord("RowHeight", GetSystemMetrics(SM_CYSMICON));
- options.retries = db_get_dw(NULL, MODULENAME, "Retries", 0);
+ options.retries = g_plugin.getDword("Retries", 0);
CallService(MODULENAME "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename);
ICMP::get_instance()->set_timeout(options.ping_timeout * 1000);
- options.attach_to_clist = (db_get_b(NULL, MODULENAME, "AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1);
- options.log_csv = (db_get_b(NULL, MODULENAME, "LogCSV", 0) == 1);
+ options.attach_to_clist = (g_plugin.getByte("AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1);
+ options.log_csv = (g_plugin.getByte("LogCSV", 0) == 1);
}
void SaveOptions() {
- db_set_dw(NULL, MODULENAME, "PingPeriod", options.ping_period);
- db_set_dw(NULL, MODULENAME, "PingTimeout", options.ping_timeout);
+ g_plugin.setDword("PingPeriod", options.ping_period);
+ g_plugin.setDword("PingTimeout", options.ping_timeout);
CallService(MODULENAME "/SetPingTimeout", (WPARAM)options.ping_timeout, 0);
- db_set_b(NULL, MODULENAME, "ShowPopup", options.show_popup ? 1 : 0);
- db_set_b(NULL, MODULENAME, "ShowPopup2", options.show_popup2 ? 1 : 0);
- db_set_b(NULL, MODULENAME, "BlockReps", options.block_reps ? 1 : 0);
- db_set_b(NULL, MODULENAME, "LoggingEnabled", options.logging ? 1 : 0);
+ g_plugin.setByte("ShowPopup", options.show_popup ? 1 : 0);
+ g_plugin.setByte("ShowPopup2", options.show_popup2 ? 1 : 0);
+ g_plugin.setByte("BlockReps", options.block_reps ? 1 : 0);
+ g_plugin.setByte("LoggingEnabled", options.logging ? 1 : 0);
- db_set_b(NULL, MODULENAME, "NoTestStatus", options.no_test_icon ? 1 : 0);
+ g_plugin.setByte("NoTestStatus", options.no_test_icon ? 1 : 0);
- db_set_w(NULL, MODULENAME, "Indent", options.indent);
- db_set_w(NULL, MODULENAME, "RowHeight", options.row_height);
+ g_plugin.setWord("Indent", options.indent);
+ g_plugin.setWord("RowHeight", options.row_height);
- db_set_dw(NULL, MODULENAME, "Retries", (DWORD)options.retries);
+ g_plugin.setDword("Retries", (DWORD)options.retries);
CallService(MODULENAME "/SetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename);
ICMP::get_instance()->set_timeout(options.ping_timeout * 1000);
- db_set_b(NULL, MODULENAME, "AttachToClist", options.attach_to_clist ? 1 : 0);
- db_set_b(NULL, MODULENAME, "LogCSV", options.log_csv ? 1 : 0);
+ g_plugin.setByte("AttachToClist", options.attach_to_clist ? 1 : 0);
+ g_plugin.setByte("LogCSV", options.log_csv ? 1 : 0);
}
diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index da44e3ac1a..af99d9c4a9 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -89,10 +89,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) hFillListEvent = HookEvent(MODULENAME "/ListReload", FillList);
- if (!db_get_b(0, MODULENAME, "PingPlugImport", 0)) {
+ if (!g_plugin.getByte("PingPlugImport", 0)) {
if (db_get_dw(0, "PingPlug", "NumEntries", 0)) {
import_ping_addresses();
- db_set_b(0, MODULENAME, "PingPlugImport", 1);
+ g_plugin.setByte("PingPlugImport", 1);
}
}
@@ -119,7 +119,7 @@ static IconItem iconList[] = int CMPlugin::Load()
{
use_raw_ping = false;
- db_set_b(0, MODULENAME, "UsingRawSockets", (BYTE)use_raw_ping);
+ g_plugin.setByte("UsingRawSockets", (BYTE)use_raw_ping);
hWakeEvent = CreateEvent(nullptr, FALSE, FALSE, L"Local\\ThreadWaitEvent");
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index 254e175eb2..9731a9ecd5 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -242,7 +242,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar {
char buff[30];
mir_snprintf(buff, "WindowHandle%d", wd->item_id);
- db_set_dw(0, MODULENAME, buff, 0);
+ g_plugin.setDword(buff, 0);
}
delete wd;
}
@@ -255,7 +255,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
char buff[30];
mir_snprintf(buff, "WindowHandle%d", (DWORD)wParam);
- HWND hGraphWnd = (HWND)db_get_dw(0, MODULENAME, buff, 0);
+ HWND hGraphWnd = (HWND)g_plugin.getDword(buff, 0);
if (hGraphWnd) {
ShowWindow(hGraphWnd, SW_SHOW);
SetWindowPos(hGraphWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -291,10 +291,10 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { wd->item_id = (DWORD)wParam; // wParam is destination id
wd->hwnd_chk_grid = nullptr;
wd->hwnd_chk_stat = nullptr;
- wd->show_grid = db_get_b(0, MODULENAME, "ShowGridLines", 0) ? true : false;
- wd->show_stat = db_get_b(0, MODULENAME, "ShowStats", 1) ? true : false;
+ wd->show_grid = g_plugin.getByte("ShowGridLines", 0) ? true : false;
+ wd->show_stat = g_plugin.getByte("ShowStats", 1) ? true : false;
- db_set_dw(0, MODULENAME, buff, (UINT_PTR)hGraphWnd);
+ g_plugin.setDword(buff, (UINT_PTR)hGraphWnd);
SetWindowLongPtr(hGraphWnd, GWLP_USERDATA, (LONG_PTR)wd);
@@ -315,11 +315,11 @@ void graphs_cleanup() { for (int i = 0; i < list_size; i++) {
mir_snprintf(buff, "WindowHandle%d", i);
- if (hwnd = (HWND)db_get_dw(0, MODULENAME, buff, 0)) {
+ if (hwnd = (HWND)g_plugin.getDword(buff, 0)) {
DestroyWindow(hwnd);
- db_set_dw(0, MODULENAME, buff, 0);
+ g_plugin.setDword(buff, 0);
mir_snprintf(buff, "WindowWasOpen%d", i);
- db_set_b(0, MODULENAME, buff, 1);
+ g_plugin.setByte(buff, 1);
}
}
}
@@ -331,10 +331,10 @@ void graphs_init() { CallService(MODULENAME "/GetPingList", 0, (LPARAM)&pl);
for (pinglist_it i = pl.begin(); i != pl.end(); ++i) {
mir_snprintf(buff, "WindowHandle%d", i->item_id); // clean up from possible crash
- db_set_dw(0, MODULENAME, buff, 0);
+ g_plugin.setDword(buff, 0);
mir_snprintf(buff, "WindowWasOpen%d", i->item_id); // restore windows that were open on shutdown
- if (db_get_b(0, MODULENAME, buff, 0)) {
- db_set_b(0, MODULENAME, buff, 0);
+ if (g_plugin.getByte(buff, 0)) {
+ g_plugin.setByte(buff, 0);
ShowGraph((WPARAM)i->item_id, (LPARAM)i->pszLabel);
}
}
diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp index 33c7f34388..485aabe51f 100644 --- a/plugins/Ping/src/pinglist.cpp +++ b/plugins/Ping/src/pinglist.cpp @@ -59,7 +59,7 @@ void write_ping_address(PINGADDRESS &i) if (i.item_id == 0) {
i.item_id = NextID++;
- db_set_dw(0, MODULENAME, "NextID", NextID);
+ g_plugin.setDword("NextID", NextID);
}
db_set_dw(0, buff, "Id", i.item_id);
@@ -162,7 +162,7 @@ bool read_ping_address(PINGADDRESS &pa) { pa.index = index;
if (pa.item_id >= NextID) {
NextID = pa.item_id + 1;
- db_set_dw(0, MODULENAME, "NextID", NextID);
+ g_plugin.setDword("NextID", NextID);
}
return true;
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index f17298f6e1..7eff156372 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -356,11 +356,11 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if ((dis->itemState & ODS_SELECTED && dis->itemState & ODS_FOCUS)
|| (context_point_valid && (x >= dis->rcItem.left && x <= dis->rcItem.right) && (y >= dis->rcItem.top && y <= dis->rcItem.bottom))) {
- tcol = db_get_dw(NULL, "CLC", "SelBkColour", GetSysColor(COLOR_HIGHLIGHT));
+ tcol = db_get_dw(0, "CLC", "SelBkColour", GetSysColor(COLOR_HIGHLIGHT));
SetBkColor(dis->hDC, tcol);
FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol)));
- tcol = db_get_dw(NULL, "CLC", "SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT));
+ tcol = db_get_dw(0, "CLC", "SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT));
SetTextColor(dis->hDC, tcol);
}
else {
@@ -368,7 +368,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetBkColor(dis->hDC, tcol);
FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol)));
- tcol = db_get_dw(NULL, MODULENAME, "FontCol", GetSysColor(COLOR_WINDOWTEXT));
+ tcol = g_plugin.getDword("FontCol", GetSysColor(COLOR_WINDOWTEXT));
SetTextColor(dis->hDC, tcol);
}
@@ -475,7 +475,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar (WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY)
& ~WS_BORDER, 0, 0, 0, 0, hwnd, nullptr, g_plugin.getInst(), nullptr);
- if (db_get_b(NULL, "CList", "Transparent", 0)) {
+ if (db_get_b(0, "CList", "Transparent", 0)) {
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
}
@@ -484,7 +484,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
#endif
#ifdef LWA_ALPHA
- SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
}
}
@@ -499,15 +499,15 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_ACTIVATE:
if (wParam == WA_INACTIVE) {
if ((HWND)wParam != hwnd)
- if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT))
+ if (db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT))
if (transparentFocus)
SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
else {
- if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT)) {
+ if (db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT)) {
KillTimer(hwnd, TM_AUTOALPHA);
#ifdef LWA_ALPHA
- SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
transparentFocus = 1;
}
@@ -515,10 +515,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar return DefWindowProc(hwnd, msg, wParam, lParam);
case WM_SETCURSOR:
- if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT)) {
+ if (db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT)) {
if (!transparentFocus && GetForegroundWindow() != hwnd) {
#ifdef LWA_ALPHA
- SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
transparentFocus = 1;
SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
@@ -545,8 +545,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (inwnd != transparentFocus) { //change
transparentFocus = inwnd;
#ifdef LWA_ALPHA
- if (transparentFocus) SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
- else SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ if (transparentFocus) SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ else SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
#endif
}
if (!transparentFocus) KillTimer(hwnd, TM_AUTOALPHA);
@@ -559,7 +559,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar static int noRecurse = 0;
if (lParam) break;
if (noRecurse) break;
- if (!db_get_b(NULL, "CLUI", "FadeInOut", 0))
+ if (!db_get_b(0, "CLUI", "FadeInOut", 0))
break;
#ifdef WS_EX_LAYERED
if (GetWindowLongPtr(hwnd, GWL_EXSTYLE)&WS_EX_LAYERED) {
@@ -567,7 +567,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar int sourceAlpha, destAlpha;
if (wParam) {
sourceAlpha = 0;
- destAlpha = (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_AUTOALPHA_DEFAULT);
+ destAlpha = (BYTE)db_get_b(0, "CList", "Alpha", SETTING_AUTOALPHA_DEFAULT);
#ifdef LWA_ALPHA
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 0, LWA_ALPHA);
#endif
@@ -576,7 +576,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar noRecurse = 0;
}
else {
- sourceAlpha = (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_AUTOALPHA_DEFAULT);
+ sourceAlpha = (BYTE)db_get_b(0, "CList", "Alpha", SETTING_AUTOALPHA_DEFAULT);
destAlpha = 0;
}
for (startTick = GetTickCount();;) {
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index e7a289764a..b55d9ba333 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -368,7 +368,7 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t* FileInfo->File.CRCsum = hash.m_crc;
// Load list of checked Plugins from database
Netlib_LogfW(hNetlibUser, L"File %s found", FileInfo->tszOldName);
- FileInfo->bEnabled = db_get_b(NULL, DB_MODULE_NEW_FILES, _T2A(FileInfo->tszOldName)) != 0;
+ FileInfo->bEnabled = db_get_b(0, DB_MODULE_NEW_FILES, _T2A(FileInfo->tszOldName)) != 0;
return FileInfo;
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 1bce60f362..fbdaee7bf2 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -32,7 +32,7 @@ static void SelectAll(HWND hDlg, bool bEnable) for (auto &it : todo) {
ListView_SetCheckState(hwndList, todo.indexOf(&it), bEnable);
- db_set_b(NULL, DB_MODULE_FILES, StrToLower(_T2A(it->tszOldName)), it->bEnabled = bEnable);
+ db_set_b(0, DB_MODULE_FILES, StrToLower(_T2A(it->tszOldName)), it->bEnabled = bEnable);
}
}
@@ -122,7 +122,7 @@ static void ApplyUpdates(void *param) }
Skin_PlaySound("updatecompleted");
- db_set_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, 5);
+ g_plugin.setByte(DB_SETTING_RESTART_COUNT, 5);
if (opts.bBackup)
CallService(MS_AB_BACKUP, 0, 0);
@@ -130,28 +130,28 @@ static void ApplyUpdates(void *param) if (opts.bChangePlatform) {
wchar_t mirandaPath[MAX_PATH];
GetModuleFileName(nullptr, mirandaPath, _countof(mirandaPath));
- db_set_ws(NULL, MODULENAME, "OldBin2", mirandaPath);
+ g_plugin.setWString("OldBin2", mirandaPath);
- db_unset(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM);
+ g_plugin.delSetting(DB_SETTING_CHANGEPLATFORM);
}
else {
- ptrW oldbin(db_get_wsa(NULL, MODULENAME, "OldBin2"));
+ ptrW oldbin(g_plugin.getWStringA("OldBin2"));
if (oldbin) {
SafeDeleteFile(oldbin);
- db_unset(NULL, MODULENAME, "OldBin2");
+ g_plugin.delSetting("OldBin2");
}
}
if (opts.bForceRedownload) {
opts.bForceRedownload = 0;
- db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
+ g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
}
// 5) Prepare Restart
int rc = MessageBox(hDlg, TranslateT("Update complete. Press Yes to restart Miranda now or No to postpone a restart until the exit."), TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION);
PostMessage(hDlg, WM_CLOSE, 0, 0);
if (rc == IDYES) {
- BOOL bRestartCurrentProfile = db_get_b(NULL, MODULENAME, "RestartCurrentProfile", 1) ? 1 : 0;
+ BOOL bRestartCurrentProfile = g_plugin.getByte("RestartCurrentProfile", 1) ? 1 : 0;
if (opts.bChangePlatform) {
wchar_t mirstartpath[MAX_PATH];
@@ -292,7 +292,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM ListView_GetItem(hwndList, &lvI);
FILEINFO *p = (FILEINFO*)lvI.lParam;
- db_set_b(NULL, DB_MODULE_FILES, StrToLower(_T2A(p->tszOldName)), p->bEnabled = ListView_GetCheckState(hwndList, nmlv->iItem));
+ db_set_b(0, DB_MODULE_FILES, StrToLower(_T2A(p->tszOldName)), p->bEnabled = ListView_GetCheckState(hwndList, nmlv->iItem));
// Toggle the Download button
bool enableOk = false;
@@ -366,7 +366,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM delete (OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- db_set_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, time(0));
+ g_plugin.setDword(DB_SETTING_LAST_UPDATE, time(0));
mir_forkthread(InitTimer);
break;
@@ -457,19 +457,19 @@ static void DlgUpdateSilent(void *param) Skin_PlaySound("updatecompleted");
opts.bForceRedownload = false;
- db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
+ g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
opts.bChangePlatform = false;
- db_unset(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM);
+ g_plugin.delSetting(DB_SETTING_CHANGEPLATFORM);
- db_set_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, 5);
- db_set_b(NULL, MODULENAME, DB_SETTING_NEED_RESTART, 1);
+ g_plugin.setByte(DB_SETTING_RESTART_COUNT, 5);
+ g_plugin.setByte(DB_SETTING_NEED_RESTART, 1);
// 5) Prepare Restart
wchar_t tszTitle[100];
mir_snwprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1))
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1))
ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG);
else {
if (Clist_TrayNotifyW(MODULEA, tszTitle, TranslateT("You need to restart your Miranda to apply installed updates."), NIIF_INFO, 30000)) {
@@ -478,7 +478,7 @@ static void DlgUpdateSilent(void *param) mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(nullptr, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
- CallServiceSync(MS_SYSTEM_RESTART, db_get_b(NULL, MODULENAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
+ CallServiceSync(MS_SYSTEM_RESTART, g_plugin.getByte("RestartCurrentProfile", 1) ? 1 : 0, 0);
}
}
}
@@ -742,7 +742,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t *p++ = '/';
// remember whether the user has decided not to update this component with this particular new version
- FileInfo->bEnabled = db_get_b(NULL, DB_MODULE_FILES, StrToLower(_T2A(FileInfo->tszOldName)), 1);
+ FileInfo->bEnabled = db_get_b(0, DB_MODULE_FILES, StrToLower(_T2A(FileInfo->tszOldName)), 1);
FileInfo->File.CRCsum = MyCRC;
UpdateFiles->insert(FileInfo);
@@ -807,7 +807,7 @@ static void DoCheck(bool bSilent = true) else {
opts.bSilent = bSilent;
- db_set_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, time(0));
+ g_plugin.setDword(DB_SETTING_LAST_UPDATE, time(0));
hCheckThread = mir_forkthread(CheckUpdates);
}
@@ -845,7 +845,7 @@ void CheckUpdateOnStartup() if (opts.bUpdateOnStartup) {
if (opts.bOnlyOnceADay) {
time_t now = time(0),
- was = db_get_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, 0);
+ was = g_plugin.getDword(DB_SETTING_LAST_UPDATE, 0);
if ((now - was) < 86400)
return;
@@ -892,7 +892,7 @@ void InitTimer(void *type) case 0: // default, plan next check relative to last check
{
time_t now = time(0);
- time_t was = db_get_dw(NULL, MODULENAME, DB_SETTING_LAST_UPDATE, 0);
+ time_t was = g_plugin.getDword(DB_SETTING_LAST_UPDATE, 0);
interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
interval -= (now - was) * 1000;
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index 3fe786d3e1..4cde7317ff 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -55,9 +55,9 @@ int ModulesLoaded(WPARAM, LPARAM) if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
AssocMgr_AddNewUrlTypeW("mirpu:", TranslateT("Plugin updater URI scheme"), g_plugin.getInst(), IDI_PLGLIST, MODULENAME "/ParseUri", 0);
- int iRestartCount = db_get_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, 2);
+ int iRestartCount = g_plugin.getByte(DB_SETTING_RESTART_COUNT, 2);
if (iRestartCount > 0)
- db_set_b(NULL, MODULENAME, DB_SETTING_RESTART_COUNT, iRestartCount - 1);
+ g_plugin.setByte(DB_SETTING_RESTART_COUNT, iRestartCount - 1);
else
EmptyFolder(); // silently
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 7a215758d6..a7dec5cc32 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -25,18 +25,18 @@ void InitPopupList() {
int index = 0;
PopupsList[index].ID = index;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups0Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups0Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups0Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups0Tx", COLOR_TX_DEFAULT);
index = 1;
PopupsList[index].ID = index;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups1Bg", COLOR_BG_SECONDDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups1Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups1Bg", COLOR_BG_SECONDDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups1Tx", COLOR_TX_DEFAULT);
index = 2;
PopupsList[index].ID = index;
- PopupsList[index].colorBack = db_get_dw(NULL, MODULENAME, "Popups2Bg", COLOR_BG_FIRSTDEFAULT);
- PopupsList[index].colorText = db_get_dw(NULL, MODULENAME, "Popups2Tx", COLOR_TX_DEFAULT);
+ PopupsList[index].colorBack = g_plugin.getDword("Popups2Bg", COLOR_BG_FIRSTDEFAULT);
+ PopupsList[index].colorText = g_plugin.getDword("Popups2Tx", COLOR_TX_DEFAULT);
}
void PopupAction(HWND hPopup, BYTE action)
@@ -74,7 +74,7 @@ static void _stdcall RestartPrompt(void *) mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(nullptr, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
- CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODULENAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
+ CallService(MS_SYSTEM_RESTART, g_plugin.getByte("RestartCurrentProfile", 1) ? 1 : 0, 0);
}
static LRESULT CALLBACK PopupDlgProcRestart(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -95,11 +95,11 @@ static LRESULT CALLBACK PopupDlgProcRestart(HWND hPopup, UINT uMsg, WPARAM wPara void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
char setting[100];
mir_snprintf(setting, "Popups%d", Number);
- if (db_get_b(NULL, MODULENAME, setting, DEFAULT_POPUP_ENABLED)) {
+ if (g_plugin.getByte(setting, DEFAULT_POPUP_ENABLED)) {
POPUPDATAT pd = { 0 };
pd.lchContact = NULL;
pd.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 337f1b2dd7..092c096073 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -29,14 +29,14 @@ static int GetBits(HWND hwndDlg) static int GetUpdateMode()
{
- int UpdateMode = db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, -1);
+ int UpdateMode = g_plugin.getByte(DB_SETTING_UPDATE_MODE, -1);
// Check if there is url for custom mode
if (UpdateMode == UPDATE_MODE_CUSTOM) {
- ptrW url(db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL));
+ ptrW url(g_plugin.getWStringA(DB_SETTING_UPDATE_URL));
if (url == NULL || !wcslen(url)) {
// No url for custom mode, reset that setting so it will be determined automatically
- db_unset(NULL, MODULENAME, DB_SETTING_UPDATE_MODE);
+ g_plugin.delSetting(DB_SETTING_UPDATE_MODE);
UpdateMode = -1;
}
}
@@ -68,7 +68,7 @@ wchar_t* GetDefaultUrl() mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
return mir_wstrdup(url);
default:
- return db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL);
+ return g_plugin.getWStringA(DB_SETTING_UPDATE_URL);
}
}
@@ -95,7 +95,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), TRUE);
}
CheckDlgButton(hwndDlg, IDC_SILENTMODE, opts.bSilentMode ? BST_CHECKED : BST_UNCHECKED);
- if (db_get_b(NULL, MODULENAME, DB_SETTING_NEED_RESTART, 0))
+ if (g_plugin.getByte(DB_SETTING_NEED_RESTART, 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_NEEDRESTARTLABEL), SW_SHOW);
SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
@@ -110,12 +110,12 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
- if (db_get_b(NULL, MODULENAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0)) {
+ if (g_plugin.getByte(DB_SETTING_DONT_SWITCH_TO_STABLE, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STABLE), FALSE);
// Reset setting if needed
- int UpdateMode = db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ int UpdateMode = g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
SetDlgItemText(hwndDlg, IDC_STABLE, LPGENW("Stable version (incompatible with current development version)"));
}
TranslateDialogDefault(hwndDlg);
@@ -150,7 +150,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
- ptrW url(db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL));
+ ptrW url(g_plugin.getWStringA(DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -225,7 +225,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
{
- ptrW url(db_get_wsa(NULL, MODULENAME, DB_SETTING_UPDATE_URL));
+ ptrW url(g_plugin.getWStringA(DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -277,63 +277,63 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (hdr && hdr->code == PSN_APPLY) {
- db_set_b(NULL, MODULENAME, "UpdateOnStartup", opts.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
- db_set_b(NULL, MODULENAME, "OnlyOnceADay", opts.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
- db_set_b(NULL, MODULENAME, "UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
- db_set_b(NULL, MODULENAME, "PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
- db_set_b(NULL, MODULENAME, "SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
- db_set_b(NULL, MODULENAME, "Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
+ g_plugin.setByte("UpdateOnStartup", opts.bUpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
+ g_plugin.setByte("OnlyOnceADay", opts.bOnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY));
+ g_plugin.setByte("UpdateOnPeriod", opts.bUpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD));
+ g_plugin.setByte("PeriodMeasure", opts.bPeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE)));
+ g_plugin.setByte("SilentMode", opts.bSilentMode = IsDlgButtonChecked(hwndDlg, IDC_SILENTMODE));
+ g_plugin.setByte("Backup", opts.bBackup = IsDlgButtonChecked(hwndDlg, IDC_BACKUP));
wchar_t buffer[3] = { 0 };
Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), buffer, _countof(buffer));
- db_set_dw(NULL, MODULENAME, "Period", opts.Period = _wtoi(buffer));
+ g_plugin.setDword("Period", opts.Period = _wtoi(buffer));
mir_forkthread(InitTimer, (void*)1);
bool bNoSymbols = false;
if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (!opts.bChangePlatform)
opts.bForceRedownload = 0;
- db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
+ g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
bNoSymbols = true;
}
else if (IsDlgButtonChecked(hwndDlg, IDC_STABLE_SYMBOLS)) {
// Only set ForceRedownload if the previous UpdateMode was different
// to redownload all plugin with pdb files
- if (db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_STABLE_SYMBOLS) {
- db_set_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE_SYMBOLS);
+ if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_STABLE_SYMBOLS) {
+ g_plugin.setByte(DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE_SYMBOLS);
}
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
if (!opts.bChangePlatform)
opts.bForceRedownload = 0;
- db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
+ g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
bNoSymbols = true;
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
// Only set ForceRedownload if the previous UpdateMode was different
// to redownload all plugin with pdb files
- if (db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
- db_set_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
+ if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
+ g_plugin.setByte(DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
}
}
else {
wchar_t tszUrl[100];
GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
- db_set_ws(NULL, MODULENAME, DB_SETTING_UPDATE_URL, tszUrl);
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
+ g_plugin.setWString(DB_SETTING_UPDATE_URL, tszUrl);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
opts.bForceRedownload = 0;
- db_unset(NULL, MODULENAME, DB_SETTING_REDOWNLOAD);
+ g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
}
if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) {
- db_set_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
- db_set_b(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
+ g_plugin.setByte(DB_SETTING_REDOWNLOAD, opts.bForceRedownload = 1);
+ g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 1);
}
- else db_set_b(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 0);
+ else g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, opts.bChangePlatform = 0);
// if user selected update channel without symbols, remove PDBs
if (bNoSymbols) {
@@ -399,7 +399,7 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM for (int i = 0; i < POPUPS; i++) {
char str[20] = { 0 };
mir_snprintf(str, "Popups%d", i);
- CheckDlgButton(hdlg, (i + 40071), (db_get_b(NULL, MODULENAME, str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, (i + 40071), (g_plugin.getByte(str, DEFAULT_POPUP_ENABLED)) ? BST_CHECKED : BST_UNCHECKED);
}
return TRUE;
@@ -525,26 +525,26 @@ static INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM ctlColor = SendDlgItemMessage(hdlg, (i + 42071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorBack = ctlColor;
mir_snprintf(szSetting, "Popups%iBg", i);
- db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
+ g_plugin.setDword(szSetting, ctlColor);
ctlColor = SendDlgItemMessage(hdlg, (i + 41071), CPM_GETCOLOUR, 0, 0);
PopupsList[i].colorText = ctlColor;
mir_snprintf(szSetting, "Popups%iTx", i);
- db_set_dw(NULL, MODULENAME, szSetting, ctlColor);
+ g_plugin.setDword(szSetting, ctlColor);
}
//Colors
- db_set_b(NULL, MODULENAME, "DefColors", PopupOptions.DefColors);
+ g_plugin.setByte("DefColors", PopupOptions.DefColors);
//Timeout
PopupOptions.Timeout = GetDlgItemInt(hdlg, IDC_TIMEOUT_VALUE, nullptr, TRUE);
- db_set_dw(NULL, MODULENAME, "Timeout", PopupOptions.Timeout);
+ g_plugin.setDword("Timeout", PopupOptions.Timeout);
//Left mouse click
- db_set_b(NULL, MODULENAME, "LeftClickAction", PopupOptions.LeftClickAction);
+ g_plugin.setByte("LeftClickAction", PopupOptions.LeftClickAction);
//Right mouse click
- db_set_b(NULL, MODULENAME, "RightClickAction", PopupOptions.RightClickAction);
+ g_plugin.setByte("RightClickAction", PopupOptions.RightClickAction);
//Notified popups
for (int i = 0; i < POPUPS; i++) {
char str[20] = { 0 };
mir_snprintf(str, "Popups%d", i);
- db_set_b(NULL, MODULENAME, str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
+ g_plugin.setByte(str, (BYTE)(IsDlgButtonChecked(hdlg, (i + 40071))));
}
return TRUE;
} //case PSN_APPLY
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 21f680eec1..5a4f6c3d8f 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -48,7 +48,7 @@ int CMPlugin::Load() {
InitServices();
- db_set_b(NULL, MODULENAME, DB_SETTING_NEED_RESTART, 0);
+ g_plugin.setByte(DB_SETTING_NEED_RESTART, 0);
DWORD dwLen = GetTempPath(_countof(g_tszTempPath), g_tszTempPath);
if (g_tszTempPath[dwLen-1] == '\\')
@@ -100,22 +100,22 @@ int CMPlugin::Load() g_plugin.addSound("updatefailed", LPGENW("Plugin Updater"), LPGENW("Update failed"));
// Upgrade old settings
- if (-1 == db_get_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, -1)) {
- ptrW dbvUpdateURL(db_get_wsa(0, MODULENAME, DB_SETTING_UPDATE_URL));
+ if (-1 == g_plugin.getByte(DB_SETTING_UPDATE_MODE, -1)) {
+ ptrW dbvUpdateURL(g_plugin.getWStringA(DB_SETTING_UPDATE_URL));
if (dbvUpdateURL) {
if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_OLD))) {
- db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
- db_unset(0, MODULENAME, DB_SETTING_UPDATE_URL);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ g_plugin.delSetting(DB_SETTING_UPDATE_URL);
}
else if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_TRUNK_OLD))) {
- db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- db_unset(0, MODULENAME, DB_SETTING_UPDATE_URL);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ g_plugin.delSetting(DB_SETTING_UPDATE_URL);
}
else if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS_OLD) L"/")) {
- db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
- db_unset(0, MODULENAME, DB_SETTING_UPDATE_URL);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
+ g_plugin.delSetting(DB_SETTING_UPDATE_URL);
}
- else db_set_b(0, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
+ else g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index e0c47e2680..b57676e6dd 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -25,20 +25,20 @@ HANDLE hPipe = nullptr; /////////////////////////////////////////////////////////////////////////////////////
void LoadOptions()
{
- PopupOptions.DefColors = db_get_b(NULL, MODULENAME, "DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= db_get_b(NULL, MODULENAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = db_get_b(NULL, MODULENAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = db_get_dw(NULL, MODULENAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
-
- opts.bUpdateOnStartup = db_get_b(NULL, MODULENAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = db_get_b(NULL, MODULENAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = db_get_b(NULL, MODULENAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = db_get_dw(NULL, MODULENAME, "Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = db_get_b(NULL, MODULENAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bForceRedownload = db_get_b(NULL, MODULENAME, DB_SETTING_REDOWNLOAD, 0);
- opts.bSilentMode = db_get_b(NULL, MODULENAME, "SilentMode", 0);
- opts.bBackup = db_get_b(NULL, MODULENAME, "Backup", 0);
- opts.bChangePlatform = db_get_b(NULL, MODULENAME, DB_SETTING_CHANGEPLATFORM, 0);
+ PopupOptions.DefColors = g_plugin.getByte("DefColors", DEFAULT_COLORS);
+ PopupOptions.LeftClickAction= g_plugin.getByte("LeftClickAction", DEFAULT_POPUP_LCLICK);
+ PopupOptions.RightClickAction = g_plugin.getByte("RightClickAction", DEFAULT_POPUP_RCLICK);
+ PopupOptions.Timeout = g_plugin.getDword("Timeout", DEFAULT_TIMEOUT_VALUE);
+
+ opts.bUpdateOnStartup = g_plugin.getByte("UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ opts.bOnlyOnceADay = g_plugin.getByte("OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ opts.bUpdateOnPeriod = g_plugin.getByte("UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ opts.Period = g_plugin.getDword("Period", DEFAULT_PERIOD);
+ opts.bPeriodMeasure = g_plugin.getByte("PeriodMeasure", DEFAULT_PERIODMEASURE);
+ opts.bForceRedownload = g_plugin.getByte(DB_SETTING_REDOWNLOAD, 0);
+ opts.bSilentMode = g_plugin.getByte("SilentMode", 0);
+ opts.bBackup = g_plugin.getByte("Backup", 0);
+ opts.bChangePlatform = g_plugin.getByte(DB_SETTING_CHANGEPLATFORM, 0);
}
IconItem iconList[] =
@@ -205,14 +205,14 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) DeleteFile(tszTmpIni);
if (bDoNotSwitchToStable) {
- db_set_b(NULL, MODULENAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1);
+ g_plugin.setByte(DB_SETTING_DONT_SWITCH_TO_STABLE, 1);
// Reset setting if needed
- int UpdateMode = db_get_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ int UpdateMode = g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
if (UpdateMode == UPDATE_MODE_STABLE)
- db_set_b(NULL, MODULENAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
}
else
- db_set_b(NULL, MODULENAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0);
+ g_plugin.setByte(DB_SETTING_DONT_SWITCH_TO_STABLE, 0);
return true;
}
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 7e0ddca0e5..92a51887c5 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -49,7 +49,7 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath // This is because there may be more then one file in a single zip
// So we need to check each file
- if (ch && !db_get_b(NULL, DB_MODULE_FILES, StrToLower(ptrA(mir_strdup(filename))), 1))
+ if (ch && !db_get_b(0, DB_MODULE_FILES, StrToLower(ptrA(mir_strdup(filename))), 1))
return true;
wchar_t tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 5839b0c752..867e4d48bf 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -67,7 +67,7 @@ void RegisterAction(POPUPACTION *action) else {
POPUPACTION *actionCopy = new POPUPACTION;
*actionCopy = *action;
- actionCopy->flags = db_get_b(NULL, "PopupActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? PAF_ENABLED : 0;
+ actionCopy->flags = db_get_b(0, "PopupActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? PAF_ENABLED : 0;
gActions.insert(actionCopy);
}
}
@@ -138,13 +138,13 @@ DWORD MouseOverride(HWND hCombo, int number) void LoadOption_Actions()
{
- PopupOptions.actions = db_get_dw(NULL, MODULENAME, "Actions",
+ PopupOptions.actions = g_plugin.getDword("Actions",
ACT_ENABLE | ACT_RIGHTICONS | ACT_DEF_KEEPWND | ACT_DEF_IMONLY |
ACT_DEF_NOGLOBAL | ACT_DEF_MESSAGE | ACT_DEF_DETAILS | ACT_DEF_MENU |
ACT_DEF_ADD | ACT_DEF_DISMISS | ACT_DEF_PIN);
- PopupOptions.overrideLeft = db_get_dw(NULL, MODULENAME, "OverrideLeft", 0);
- PopupOptions.overrideMiddle = db_get_dw(NULL, MODULENAME, "OverrideMiddle", 0);
- PopupOptions.overrideRight = db_get_dw(NULL, MODULENAME, "OverrideRight", 0);
+ PopupOptions.overrideLeft = g_plugin.getDword("OverrideLeft", 0);
+ PopupOptions.overrideMiddle = g_plugin.getDword("OverrideMiddle", 0);
+ PopupOptions.overrideRight = g_plugin.getDword("OverrideRight", 0);
}
static UINT controls[] =
@@ -340,18 +340,18 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case PSN_APPLY:
- db_set_dw(NULL, MODULENAME, "Actions", PopupOptions.actions);
+ g_plugin.setDword("Actions", PopupOptions.actions);
HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
for (int i = 0; i < gActions.getCount(); ++i) {
gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0;
- db_set_b(NULL, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0);
+ db_set_b(0, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0);
}
// overrideActions
- db_set_dw(NULL, MODULENAME, "OverrideLeft", PopupOptions.overrideLeft);
- db_set_dw(NULL, MODULENAME, "OverrideMiddle", PopupOptions.overrideMiddle);
- db_set_dw(NULL, MODULENAME, "OverrideRight", PopupOptions.overrideRight);
+ g_plugin.setDword("OverrideLeft", PopupOptions.overrideLeft);
+ g_plugin.setDword("OverrideMiddle", PopupOptions.overrideMiddle);
+ g_plugin.setDword("OverrideRight", PopupOptions.overrideRight);
}
break;
diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index e3e531fcfb..db5e64650f 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -30,7 +30,7 @@ PopupAvatar *PopupAvatar::create(MCONTACT hContact) AVATARCACHEENTRY *av = (AVATARCACHEENTRY*)CallService(MS_AV_GETAVATARBITMAP, hContact, 0);
if (av && (mir_wstrlen(av->szFilename) > 4))
if (!mir_wstrcmpi(av->szFilename + mir_wstrlen(av->szFilename) - 4, L".gif"))
- if (db_get_b(NULL, MODULENAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename))
+ if (g_plugin.getByte("EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename))
return new GifAvatar(hContact);
}
}
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 6abf66ddd5..5a023520ab 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -46,7 +46,7 @@ void LoadOptions() {
memset(&PopupOptions, 0, sizeof(PopupOptions));
#if defined(_DEBUG)
- PopupOptions.debug = db_get_b(NULL, MODULENAME, "debug", FALSE);
+ PopupOptions.debug = g_plugin.getByte("debug", FALSE);
#endif
// Load Popup Options
@@ -132,7 +132,7 @@ static void CopyModule(const char *szModule, const char *szNewModule) void UpgradeDb()
{
- if (db_get_b(NULL, "Compatibility", "Popup+ Opts", 0) == 1)
+ if (db_get_b(0, "Compatibility", "Popup+ Opts", 0) == 1)
return;
CopyModule("PopUp", "Popup");
@@ -140,5 +140,5 @@ void UpgradeDb() CopyModule("PopUpActions", "PopupActions");
CopyModule("PopUpNotifications", "PopupNotifications");
- db_set_b(NULL, "Compatibility", "Popup+ Opts", 1);
+ db_set_b(0, "Compatibility", "Popup+ Opts", 1);
}
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index f1adc8eb80..deed963c17 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -56,7 +56,7 @@ void PopupHistoryResize() void PopupHistoryLoad()
{
- popupHistoryBuffer = db_get_w(NULL, MODULENAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
+ popupHistoryBuffer = g_plugin.getWord("HistorySize", SETTING_HISTORYSIZE_DEFAULT);
}
void PopupHistoryUnload()
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index e82c40c5fa..ae4875c9ba 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -145,14 +145,14 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) // The module is enabled.
// The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item.
PopupOptions.ModuleIsEnabled = FALSE;
- db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE);
+ db_set_b(0, "Popup", "ModuleIsEnabled", FALSE);
Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), hIcon = GetIconHandle(IDI_NOPOPUP));
}
else {
// The module is disabled.
// The action to do is enable popups (show enabled), then write "disable popup" in the new item.
PopupOptions.ModuleIsEnabled = TRUE;
- db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE);
+ db_set_b(0, "Popup", "ModuleIsEnabled", TRUE);
Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP));
}
@@ -323,7 +323,7 @@ int CMPlugin::Load() CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus);
#if defined(_DEBUG)
- PopupOptions.debug = db_get_b(NULL, MODULENAME, "debug", FALSE);
+ PopupOptions.debug = g_plugin.getByte("debug", FALSE);
#else
PopupOptions.debug = false;
#endif
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index f86d235189..8dbee80a98 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -95,32 +95,32 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char *szModul) mir_snprintf(setting, "{%s/%s}Timeout",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- db_set_w(NULL, szModul, setting, ptd->notification.iSeconds);
+ db_set_w(0, szModul, setting, ptd->notification.iSeconds);
mir_snprintf(setting, "{%s/%s}enabled",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- db_set_b(NULL, szModul, setting, ptd->enabled);
+ db_set_b(0, szModul, setting, ptd->enabled);
mir_snprintf(setting, "{%s/%s}TimeoutVal",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- db_set_w(NULL, szModul, setting, ptd->timeoutValue);
+ db_set_w(0, szModul, setting, ptd->timeoutValue);
mir_snprintf(setting, "{%s/%s}disableWhen",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- db_set_b(NULL, szModul, setting, ptd->disableWhen);
+ db_set_b(0, szModul, setting, ptd->disableWhen);
mir_snprintf(setting, "{%s/%s}leftAction",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- db_set_s(NULL, szModul, setting, ptd->leftAction);
+ db_set_s(0, szModul, setting, ptd->leftAction);
mir_snprintf(setting, "{%s/%s}rightAction",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- db_set_s(NULL, szModul, setting, ptd->rightAction);
+ db_set_s(0, szModul, setting, ptd->rightAction);
for (int i = 0; i < ptd->notification.actionCount; ++i) {
POPUPNOTIFYACTION &p = ptd->notification.lpActions[i];
@@ -140,28 +140,28 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->enabled =
- (signed char)db_get_b(NULL, szModul, setting, TRUE);
+ (signed char)db_get_b(0, szModul, setting, TRUE);
mir_snprintf(setting, "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->notification.iSeconds =
- (signed char)db_get_w(NULL, szModul, setting, ptd->notification.iSeconds);
+ (signed char)db_get_w(0, szModul, setting, ptd->notification.iSeconds);
mir_snprintf(setting, "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->timeoutValue =
- (signed char)db_get_w(NULL, szModul, setting,
+ (signed char)db_get_w(0, szModul, setting,
ptd->notification.iSeconds ? ptd->notification.iSeconds : 0);
mir_snprintf(setting, "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->disableWhen =
- db_get_b(NULL, szModul, setting, 0);
+ db_get_b(0, szModul, setting, 0);
mir_snprintf(setting, "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
- char *szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzLAction);
+ char *szTmp = db_get_s(0, szModul, setting, ptd->notification.lpzLAction);
mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
mir_free(szTmp); szTmp = nullptr;
mir_snprintf(setting, "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
- szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzRAction);
+ szTmp = db_get_s(0, szModul, setting, ptd->notification.lpzRAction);
mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
mir_free(szTmp); szTmp = nullptr;
}
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 235e60833a..e279e7ebb2 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -46,34 +46,34 @@ void OptAdv_UnregisterVfx() void LoadOption_AdvOpts()
{
// History
- PopupOptions.EnableHistory = db_get_b(NULL, MODULENAME, "EnableHistory", TRUE);
- PopupOptions.HistorySize = db_get_w(NULL, MODULENAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
- PopupOptions.UseHppHistoryLog = db_get_b(NULL, MODULENAME, "UseHppHistoryLog", TRUE);
+ PopupOptions.EnableHistory = g_plugin.getByte("EnableHistory", TRUE);
+ PopupOptions.HistorySize = g_plugin.getWord("HistorySize", SETTING_HISTORYSIZE_DEFAULT);
+ PopupOptions.UseHppHistoryLog = g_plugin.getByte("UseHppHistoryLog", TRUE);
// Avatars
- PopupOptions.avatarBorders = db_get_b(NULL, MODULENAME, "AvatarBorders", TRUE);
- PopupOptions.avatarPNGBorders = db_get_b(NULL, MODULENAME, "AvatarPNGBorders", FALSE);
- PopupOptions.avatarRadius = db_get_b(NULL, MODULENAME, "AvatarRadius", 2);
- PopupOptions.avatarSize = db_get_w(NULL, MODULENAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT);
- PopupOptions.EnableAvatarUpdates = db_get_b(NULL, MODULENAME, "EnableAvatarUpdates", FALSE);
+ PopupOptions.avatarBorders = g_plugin.getByte("AvatarBorders", TRUE);
+ PopupOptions.avatarPNGBorders = g_plugin.getByte("AvatarPNGBorders", FALSE);
+ PopupOptions.avatarRadius = g_plugin.getByte("AvatarRadius", 2);
+ PopupOptions.avatarSize = g_plugin.getWord("AvatarSize", SETTING_AVTSIZE_DEFAULT);
+ PopupOptions.EnableAvatarUpdates = g_plugin.getByte("EnableAvatarUpdates", FALSE);
// Monitor
- PopupOptions.Monitor = db_get_b(NULL, MODULENAME, "Monitor", SETTING_MONITOR_DEFAULT);
+ PopupOptions.Monitor = g_plugin.getByte("Monitor", SETTING_MONITOR_DEFAULT);
// Transparency
- PopupOptions.UseTransparency = db_get_b(NULL, MODULENAME, "UseTransparency", TRUE);
- PopupOptions.Alpha = db_get_b(NULL, MODULENAME, "Alpha", SETTING_ALPHA_DEFAULT);
- PopupOptions.OpaqueOnHover = db_get_b(NULL, MODULENAME, "OpaqueOnHover", TRUE);
+ PopupOptions.UseTransparency = g_plugin.getByte("UseTransparency", TRUE);
+ PopupOptions.Alpha = g_plugin.getByte("Alpha", SETTING_ALPHA_DEFAULT);
+ PopupOptions.OpaqueOnHover = g_plugin.getByte("OpaqueOnHover", TRUE);
// Effects
- PopupOptions.UseAnimations = db_get_b(NULL, MODULENAME, "UseAnimations", TRUE);
- PopupOptions.UseEffect = db_get_b(NULL, MODULENAME, "Fade", TRUE);
- PopupOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL, MODULENAME, "Effect", "", DBVT_WCHAR);
- PopupOptions.FadeIn = db_get_dw(NULL, MODULENAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT);
- PopupOptions.FadeOut = db_get_dw(NULL, MODULENAME, "FadeOutTime", SETTING_FADEOUTTIME_DEFAULT);
+ PopupOptions.UseAnimations = g_plugin.getByte("UseAnimations", TRUE);
+ PopupOptions.UseEffect = g_plugin.getByte("Fade", TRUE);
+ PopupOptions.Effect = (LPTSTR)DBGetContactSettingStringX(0, MODULENAME, "Effect", "", DBVT_WCHAR);
+ PopupOptions.FadeIn = g_plugin.getDword("FadeInTime", SETTING_FADEINTIME_DEFAULT);
+ PopupOptions.FadeOut = g_plugin.getDword("FadeOutTime", SETTING_FADEOUTTIME_DEFAULT);
// other old stuff
- PopupOptions.MaxPopups = db_get_w(NULL, MODULENAME, "MaxPopups", 20);
+ PopupOptions.MaxPopups = g_plugin.getWord("MaxPopups", 20);
}
INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -492,31 +492,31 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY:
// History
- db_set_b(NULL, MODULENAME, "EnableHistory", (BYTE)PopupOptions.EnableHistory);
- db_set_w(NULL, MODULENAME, "HistorySize", PopupOptions.HistorySize);
+ g_plugin.setByte("EnableHistory", (BYTE)PopupOptions.EnableHistory);
+ g_plugin.setWord("HistorySize", PopupOptions.HistorySize);
PopupHistoryResize();
- db_set_b(NULL, MODULENAME, "UseHppHistoryLog", PopupOptions.UseHppHistoryLog);
+ g_plugin.setByte("UseHppHistoryLog", PopupOptions.UseHppHistoryLog);
// Avatars
- db_set_b(NULL, MODULENAME, "AvatarBorders", PopupOptions.avatarBorders);
- db_set_b(NULL, MODULENAME, "AvatarPNGBorders", PopupOptions.avatarPNGBorders);
- db_set_b(NULL, MODULENAME, "AvatarRadius", PopupOptions.avatarRadius);
- db_set_w(NULL, MODULENAME, "AvatarSize", PopupOptions.avatarSize);
- db_set_b(NULL, MODULENAME, "EnableAvatarUpdates", PopupOptions.EnableAvatarUpdates);
+ g_plugin.setByte("AvatarBorders", PopupOptions.avatarBorders);
+ g_plugin.setByte("AvatarPNGBorders", PopupOptions.avatarPNGBorders);
+ g_plugin.setByte("AvatarRadius", PopupOptions.avatarRadius);
+ g_plugin.setWord("AvatarSize", PopupOptions.avatarSize);
+ g_plugin.setByte("EnableAvatarUpdates", PopupOptions.EnableAvatarUpdates);
// Monitor
- db_set_b(NULL, MODULENAME, "Monitor", PopupOptions.Monitor);
+ g_plugin.setByte("Monitor", PopupOptions.Monitor);
// Transparency
- db_set_b(NULL, MODULENAME, "UseTransparency", PopupOptions.UseTransparency);
- db_set_b(NULL, MODULENAME, "Alpha", PopupOptions.Alpha);
- db_set_b(NULL, MODULENAME, "OpaqueOnHover", PopupOptions.OpaqueOnHover);
+ g_plugin.setByte("UseTransparency", PopupOptions.UseTransparency);
+ g_plugin.setByte("Alpha", PopupOptions.Alpha);
+ g_plugin.setByte("OpaqueOnHover", PopupOptions.OpaqueOnHover);
// Effects
- db_set_b(NULL, MODULENAME, "UseAnimations", PopupOptions.UseAnimations);
- db_set_b(NULL, MODULENAME, "Fade", PopupOptions.UseEffect);
- db_set_ws(NULL, MODULENAME, "Effect", PopupOptions.Effect);
- db_set_dw(NULL, MODULENAME, "FadeInTime", PopupOptions.FadeIn);
- db_set_dw(NULL, MODULENAME, "FadeOutTime", PopupOptions.FadeOut);
+ g_plugin.setByte("UseAnimations", PopupOptions.UseAnimations);
+ g_plugin.setByte("Fade", PopupOptions.UseEffect);
+ g_plugin.setWString("Effect", PopupOptions.Effect);
+ g_plugin.setDword("FadeInTime", PopupOptions.FadeIn);
+ g_plugin.setDword("FadeOutTime", PopupOptions.FadeOut);
// other old stuff
- db_set_w(NULL, MODULENAME, "MaxPopups", (BYTE)PopupOptions.MaxPopups);
+ g_plugin.setWord("MaxPopups", (BYTE)PopupOptions.MaxPopups);
}
return TRUE;
}
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 415d9a2cdb..4b38d22a18 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -483,24 +483,24 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) char setting[2 * MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s/enabled", ptd->pupClass.pszName);
ptd->enabled =
- (signed char)db_get_b(NULL, szModul, setting, TRUE);
+ (signed char)db_get_b(0, szModul, setting, TRUE);
mir_snprintf(setting, "%s/Timeout", ptd->pupClass.pszName);
ptd->pupClass.iSeconds =
- (signed char)db_get_w(NULL, szModul, setting, 0);
+ (signed char)db_get_w(0, szModul, setting, 0);
mir_snprintf(setting, "%s/TimeoutVal", ptd->pupClass.pszName);
ptd->timeoutValue =
- (signed char)db_get_w(NULL, szModul, setting,
+ (signed char)db_get_w(0, szModul, setting,
ptd->pupClass.iSeconds ? ptd->pupClass.iSeconds : PopupOptions.Seconds);
mir_snprintf(setting, "%s/leftAction", ptd->pupClass.pszName);
- char *szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_NOTHING); // standart ??
+ char *szTmp = db_get_s(0, szModul, setting, POPUP_ACTION_NOTHING); // standart ??
mir_strncpy(ptd->leftAction, szTmp, _countof(ptd->leftAction));
mir_free(szTmp);
mir_snprintf(setting, "%s/rightAction", ptd->pupClass.pszName);
- szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_DISMISS); // standart ??
+ szTmp = db_get_s(0, szModul, setting, POPUP_ACTION_DISMISS); // standart ??
mir_strncpy(ptd->rightAction, szTmp, _countof(ptd->rightAction));
mir_free(szTmp);
}
@@ -510,17 +510,17 @@ void SaveClassSettings(POPUPTREEDATA *ptd, char* szModul) char setting[2 * MAXMODULELABELLENGTH];
mir_snprintf(setting, "%s/enabled", ptd->pupClass.pszName);
- db_set_b(NULL, szModul, setting, ptd->enabled);
+ db_set_b(0, szModul, setting, ptd->enabled);
mir_snprintf(setting, "%s/Timeout", ptd->pupClass.pszName);
- db_set_w(NULL, szModul, setting, ptd->pupClass.iSeconds);
+ db_set_w(0, szModul, setting, ptd->pupClass.iSeconds);
mir_snprintf(setting, "%s/TimeoutVal", ptd->pupClass.pszName);
- db_set_w(NULL, szModul, setting, ptd->timeoutValue);
+ db_set_w(0, szModul, setting, ptd->timeoutValue);
mir_snprintf(setting, "%s/leftAction", ptd->pupClass.pszName);
- db_set_s(NULL, szModul, setting, ptd->leftAction);
+ db_set_s(0, szModul, setting, ptd->leftAction);
mir_snprintf(setting, "%s/rightAction", ptd->pupClass.pszName);
- db_set_s(NULL, szModul, setting, ptd->rightAction);
+ db_set_s(0, szModul, setting, ptd->rightAction);
}
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index c77cae67e9..80620f84dd 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -89,40 +89,40 @@ int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flags) void LoadOption_General()
{
// Seconds
- PopupOptions.InfiniteDelay = db_get_b(NULL, MODULENAME, "InfiniteDelay", FALSE);
+ PopupOptions.InfiniteDelay = g_plugin.getByte("InfiniteDelay", FALSE);
PopupOptions.Seconds =
- DBGetContactSettingRangedWord(NULL, MODULENAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- PopupOptions.LeaveHovered = db_get_b(NULL, MODULENAME, "LeaveHovered", TRUE);
+ DBGetContactSettingRangedWord(0, MODULENAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
+ PopupOptions.LeaveHovered = g_plugin.getByte("LeaveHovered", TRUE);
// Dynamic Resize
- PopupOptions.DynamicResize = db_get_b(NULL, MODULENAME, "DynamicResize", FALSE);
- PopupOptions.UseMinimumWidth = db_get_b(NULL, MODULENAME, "UseMinimumWidth", TRUE);
- PopupOptions.MinimumWidth = db_get_w(NULL, MODULENAME, "MinimumWidth", 160);
- PopupOptions.UseMaximumWidth = db_get_b(NULL, MODULENAME, "UseMaximumWidth", TRUE);
- PopupOptions.MaximumWidth = db_get_w(NULL, MODULENAME, "MaximumWidth", 300);
+ PopupOptions.DynamicResize = g_plugin.getByte("DynamicResize", FALSE);
+ PopupOptions.UseMinimumWidth = g_plugin.getByte("UseMinimumWidth", TRUE);
+ PopupOptions.MinimumWidth = g_plugin.getWord("MinimumWidth", 160);
+ PopupOptions.UseMaximumWidth = g_plugin.getByte("UseMaximumWidth", TRUE);
+ PopupOptions.MaximumWidth = g_plugin.getWord("MaximumWidth", 300);
// Position
PopupOptions.Position =
- DBGetContactSettingRangedByte(NULL, MODULENAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE);
+ DBGetContactSettingRangedByte(0, MODULENAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE);
// Configure popup area
- PopupOptions.gapTop = db_get_w(NULL, MODULENAME, "gapTop", 5);
- PopupOptions.gapBottom = db_get_w(NULL, MODULENAME, "gapBottom", 5);
- PopupOptions.gapLeft = db_get_w(NULL, MODULENAME, "gapLeft", 5);
- PopupOptions.gapRight = db_get_w(NULL, MODULENAME, "gapRight", 5);
- PopupOptions.spacing = db_get_w(NULL, MODULENAME, "spacing", 5);
+ PopupOptions.gapTop = g_plugin.getWord("gapTop", 5);
+ PopupOptions.gapBottom = g_plugin.getWord("gapBottom", 5);
+ PopupOptions.gapLeft = g_plugin.getWord("gapLeft", 5);
+ PopupOptions.gapRight = g_plugin.getWord("gapRight", 5);
+ PopupOptions.spacing = g_plugin.getWord("spacing", 5);
// Spreading
PopupOptions.Spreading =
- DBGetContactSettingRangedByte(NULL, MODULENAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE);
+ DBGetContactSettingRangedByte(0, MODULENAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE);
// miscellaneous
- PopupOptions.ReorderPopups = db_get_b(NULL, MODULENAME, "ReorderPopups", TRUE);
- PopupOptions.ReorderPopupsWarning = db_get_b(NULL, MODULENAME, "ReorderPopupsWarning", TRUE);
+ PopupOptions.ReorderPopups = g_plugin.getByte("ReorderPopups", TRUE);
+ PopupOptions.ReorderPopupsWarning = g_plugin.getByte("ReorderPopupsWarning", TRUE);
// disable When
- PopupOptions.ModuleIsEnabled = db_get_b(NULL, "Popup", "ModuleIsEnabled", TRUE);
- PopupOptions.DisableWhenFullscreen = db_get_b(NULL, MODULENAME, "DisableWhenFullscreen", TRUE);
+ PopupOptions.ModuleIsEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", TRUE);
+ PopupOptions.DisableWhenFullscreen = g_plugin.getByte("DisableWhenFullscreen", TRUE);
}
INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -243,10 +243,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM wchar_t pszSettingName[256];
mir_snwprintf(pszSettingName, LPGENW("Protocol Status")L"/%s", pa->tszAccountName);
- OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULENAME, prefix, 0), pszSettingName);
+ OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, g_plugin.getDword(prefix, 0), pszSettingName);
}
}
- OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULENAME, "Global Status", 0), LPGENW("Global Status"));
+ OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, g_plugin.getDword("Global Status", 0), LPGENW("Global Status"));
}
TranslateDialogDefault(hwnd); // do it on end of WM_INITDIALOG
@@ -335,7 +335,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_REORDERPOPUPS:
PopupOptions.ReorderPopups = !PopupOptions.ReorderPopups;
- PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? db_get_b(NULL, MODULENAME, "ReorderPopupsWarning", TRUE) : TRUE;
+ PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? g_plugin.getByte("ReorderPopupsWarning", TRUE) : TRUE;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
@@ -485,35 +485,35 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY:
// Seconds
- db_set_b(NULL, MODULENAME, "InfiniteDelay", PopupOptions.InfiniteDelay);
- db_set_w(NULL, MODULENAME, "Seconds", (WORD)PopupOptions.Seconds);
- db_set_b(NULL, MODULENAME, "LeaveHovered", PopupOptions.LeaveHovered);
+ g_plugin.setByte("InfiniteDelay", PopupOptions.InfiniteDelay);
+ g_plugin.setWord("Seconds", (WORD)PopupOptions.Seconds);
+ g_plugin.setByte("LeaveHovered", PopupOptions.LeaveHovered);
// Dynamic Resize
- db_set_b(NULL, MODULENAME, "DynamicResize", PopupOptions.DynamicResize);
- db_set_b(NULL, MODULENAME, "UseMinimumWidth", PopupOptions.UseMinimumWidth);
- db_set_w(NULL, MODULENAME, "MinimumWidth", PopupOptions.MinimumWidth);
- db_set_b(NULL, MODULENAME, "UseMaximumWidth", PopupOptions.UseMaximumWidth);
- db_set_w(NULL, MODULENAME, "MaximumWidth", PopupOptions.MaximumWidth);
+ g_plugin.setByte("DynamicResize", PopupOptions.DynamicResize);
+ g_plugin.setByte("UseMinimumWidth", PopupOptions.UseMinimumWidth);
+ g_plugin.setWord("MinimumWidth", PopupOptions.MinimumWidth);
+ g_plugin.setByte("UseMaximumWidth", PopupOptions.UseMaximumWidth);
+ g_plugin.setWord("MaximumWidth", PopupOptions.MaximumWidth);
// Position
- db_set_b(NULL, MODULENAME, "Position", (BYTE)PopupOptions.Position);
+ g_plugin.setByte("Position", (BYTE)PopupOptions.Position);
// Configure popup area
- db_set_w(NULL, MODULENAME, "gapTop", (WORD)PopupOptions.gapTop);
- db_set_w(NULL, MODULENAME, "gapBottom", (WORD)PopupOptions.gapBottom);
- db_set_w(NULL, MODULENAME, "gapLeft", (WORD)PopupOptions.gapLeft);
- db_set_w(NULL, MODULENAME, "gapRight", (WORD)PopupOptions.gapRight);
- db_set_w(NULL, MODULENAME, "spacing", (WORD)PopupOptions.spacing);
+ g_plugin.setWord("gapTop", (WORD)PopupOptions.gapTop);
+ g_plugin.setWord("gapBottom", (WORD)PopupOptions.gapBottom);
+ g_plugin.setWord("gapLeft", (WORD)PopupOptions.gapLeft);
+ g_plugin.setWord("gapRight", (WORD)PopupOptions.gapRight);
+ g_plugin.setWord("spacing", (WORD)PopupOptions.spacing);
// Spreading
- db_set_b(NULL, MODULENAME, "Spreading", (BYTE)PopupOptions.Spreading);
+ g_plugin.setByte("Spreading", (BYTE)PopupOptions.Spreading);
// miscellaneous
Check_ReorderPopups(hwnd); // this save also PopupOptions.ReorderPopups
// disable When
- db_set_b(NULL, MODULENAME, "DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen);
+ g_plugin.setByte("DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen);
// new status options
for (auto &pa : Accounts())
@@ -523,10 +523,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM wchar_t pszSettingName[256];
mir_snwprintf(pszSettingName, L"Protocol Status/%s", pa->tszAccountName);
- db_set_dw(NULL, MODULENAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName));
+ g_plugin.setDword(prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName));
}
- db_set_dw(NULL, MODULENAME, "Global Status", OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, L"Global Status"));
+ g_plugin.setDword("Global Status", OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, L"Global Status"));
return TRUE;
}
break;
@@ -598,8 +598,8 @@ void Check_ReorderPopups(HWND hwnd) return;
}
}
- db_set_b(NULL, MODULENAME, "ReorderPopups", PopupOptions.ReorderPopups);
- db_set_b(NULL, MODULENAME, "ReorderPopupsWarning", PopupOptions.ReorderPopupsWarning);
+ g_plugin.setByte("ReorderPopups", PopupOptions.ReorderPopups);
+ g_plugin.setByte("ReorderPopupsWarning", PopupOptions.ReorderPopupsWarning);
if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups ? BST_CHECKED : BST_UNCHECKED);
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index cca1efd0b9..ba678c497e 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -282,7 +282,7 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn char prefix[128];
mir_snprintf(prefix, "skin.%S", PopupOptions.SkinPack);
OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount,
- db_get_dw(NULL, MODULENAME, prefix, dwSkinOptions), L"Skin options");
+ g_plugin.getDword(prefix, dwSkinOptions), L"Skin options");
// check "Global Settings"
OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount,
@@ -293,14 +293,14 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn void LoadOption_Skins() {
// skin pack
- PopupOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(NULL, MODULENAME, "SkinPack", "* Popup Classic", DBVT_WCHAR);
+ PopupOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(0, MODULENAME, "SkinPack", "* Popup Classic", DBVT_WCHAR);
// more Skin options
- PopupOptions.DisplayTime = db_get_b(NULL, MODULENAME, "DisplayTime", TRUE);
- PopupOptions.DropShadow = db_get_b(NULL, MODULENAME, "DropShadow", TRUE);
- PopupOptions.EnableFreeformShadows = db_get_b(NULL, MODULENAME, "EnableShadowRegion", 1);
- PopupOptions.EnableAeroGlass = db_get_b(NULL, MODULENAME, "EnableAeroGlass", 1);
- PopupOptions.UseWinColors = db_get_b(NULL, MODULENAME, "UseWinColors", FALSE);
- PopupOptions.UseMText = db_get_b(NULL, MODULENAME, "UseMText", TRUE);
+ PopupOptions.DisplayTime = g_plugin.getByte("DisplayTime", TRUE);
+ PopupOptions.DropShadow = g_plugin.getByte("DropShadow", TRUE);
+ PopupOptions.EnableFreeformShadows = g_plugin.getByte("EnableShadowRegion", 1);
+ PopupOptions.EnableAeroGlass = g_plugin.getByte("EnableAeroGlass", 1);
+ PopupOptions.UseWinColors = g_plugin.getByte("UseWinColors", FALSE);
+ PopupOptions.UseMText = g_plugin.getByte("UseMText", TRUE);
}
INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -477,19 +477,19 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case PSN_APPLY:
{
// skin pack
- db_set_ws(NULL, MODULENAME, "SkinPack", PopupOptions.SkinPack);
+ g_plugin.setWString("SkinPack", PopupOptions.SkinPack);
// skin options
const PopupSkin *skin = nullptr;
if (skin = skins.getSkin(PopupOptions.SkinPack))
skin->saveOpts();
skins.freeAllButActive();
// more Skin options
- db_set_b(NULL, MODULENAME, "DisplayTime", PopupOptions.DisplayTime);
- db_set_b(NULL, MODULENAME, "DropShadow", PopupOptions.DropShadow);
- db_set_b(NULL, MODULENAME, "EnableShadowRegion", PopupOptions.EnableFreeformShadows);
- db_set_b(NULL, MODULENAME, "EnableAeroGlass", PopupOptions.EnableAeroGlass);
- db_set_b(NULL, MODULENAME, "UseWinColors", PopupOptions.UseWinColors);
- db_set_b(NULL, MODULENAME, "UseMText", PopupOptions.UseMText);
+ g_plugin.setByte("DisplayTime", PopupOptions.DisplayTime);
+ g_plugin.setByte("DropShadow", PopupOptions.DropShadow);
+ g_plugin.setByte("EnableShadowRegion", PopupOptions.EnableFreeformShadows);
+ g_plugin.setByte("EnableAeroGlass", PopupOptions.EnableAeroGlass);
+ g_plugin.setByte("UseWinColors", PopupOptions.UseWinColors);
+ g_plugin.setByte("UseMText", PopupOptions.UseMText);
}// end PSN_APPLY:
return TRUE;
}// switch (((LPNMHDR)lParam)->code)
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 6aecc57af8..6d86c83432 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -152,7 +152,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA switch (message) {
case UTM_STOP_THREAD:
gTerminating = true;
- if (db_get_b(NULL, MODULENAME, "FastExit", 0))
+ if (g_plugin.getByte("FastExit", 0))
for (auto &it : popupList)
PUDeletePopup(it->getHwnd());
PostQuitMessage(0);
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 3490c2a25f..058b565150 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -138,7 +138,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (PopupOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && IsFullScreen())
return -1;
- if (db_get_dw(NULL, MODULENAME, LPGEN("Global Status"), 0) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
+ if (g_plugin.getDword(LPGEN("Global Status"), 0) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
return -1;
if ((disableWhen & 0x0000FFFF) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0)))
@@ -147,7 +147,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (proto) {
char prefix[128];
mir_snprintf(prefix, LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact));
- if (db_get_dw(NULL, MODULENAME, prefix, 0) & Proto_Status2Flag_My(Proto_GetStatus(proto)))
+ if (g_plugin.getDword(prefix, 0) & Proto_Status2Flag_My(Proto_GetStatus(proto)))
return -1;
if (((disableWhen >> 16) & 0xFFFF0000) & Proto_Status2Flag_My(Proto_GetStatus(proto)))
return -1;
@@ -379,7 +379,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) // we ignore pc->colorText and use fonts.text as default (if no setting found in DB)
mir_snprintf(setting, "%s/TextCol", ptd->pupClass.pszName);
- ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
+ ptd->pupClass.colorText = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
FontIDW fid = {};
mir_snwprintf(fid.group, L"%S/%s", PU_FNT_AND_COLOR, ptd->pszDescription);
@@ -397,7 +397,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) // we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB)
mir_snprintf(setting, "%s/BgCol", ptd->pupClass.pszName);
- ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
+ ptd->pupClass.colorBack = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
ColourIDW cid = {};
mir_snwprintf(cid.group, L"%S/%s", PU_FNT_AND_COLOR, ptd->pszDescription);
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 0ccfdca254..477bc9f533 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -524,7 +524,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW if (textAreaWidth <= 0) textAreaWidth = wnd->getRenderInfo()->realtextw;
drawActionBar(bmp, wnd,
- db_get_b(NULL, MODULENAME, "CenterActions", 0) ?
+ g_plugin.getByte("CenterActions", 0) ?
(pt.x + (textAreaWidth - wnd->getRenderInfo()->actw) / 2) :
(PopupOptions.actions & ACT_RIGHTICONS) ?
(pt.x + textAreaWidth - wnd->getRenderInfo()->actw) :
@@ -1046,14 +1046,14 @@ void PopupSkin::saveOpts() const {
char buf[128];
mir_snprintf(buf, "skin.%.120S", m_name);
- db_set_dw(NULL, MODULENAME, buf, m_flags);
+ g_plugin.setDword(buf, m_flags);
}
void PopupSkin::loadOpts() const
{
char buf[128];
mir_snprintf(buf, "skin.%.120S", m_name);
- m_flags = db_get_dw(NULL, MODULENAME, buf, m_flags);
+ m_flags = g_plugin.getDword(buf, m_flags);
}
// Skins
diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp index 2b28f39993..b5c8f01d3e 100644 --- a/plugins/ProxySwitch/src/main.cpp +++ b/plugins/ProxySwitch/src/main.cpp @@ -264,10 +264,10 @@ int Init(WPARAM, LPARAM) HGENMENU hMenu = Menu_AddMainMenuItem(&mi); hSvcShowMyIP = CreateServiceFunction(mi.pszService, ShowMyIPAddrs); - int opt_showMyIP = db_get_b(NULL, MODULENAME, "ShowMyIP", 100); + int opt_showMyIP = g_plugin.getByte("ShowMyIP", 100); if (opt_showMyIP != 100) { Menu_SetVisible(hMenu, opt_showMyIP != 0); - db_unset(NULL, MODULENAME, "ShowMyIP"); + g_plugin.delSetting("ShowMyIP"); } hMenuRoot = mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Proxy settings && interfaces"), 0xC0000000); @@ -287,10 +287,10 @@ int Init(WPARAM, LPARAM) Menu_AddMainMenuItem(&mi); hSvcProxyEnable = CreateServiceFunction(mi.pszService, ProxyEnable); - int opt_showProxyIP = db_get_b(NULL, MODULENAME, "ShowProxyIP", 100); + int opt_showProxyIP = g_plugin.getByte("ShowProxyIP", 100); if (opt_showProxyIP != 100) { Menu_SetVisible(mi.root, opt_showProxyIP != 0); - db_unset(NULL, MODULENAME, "ShowProxyIP"); + g_plugin.delSetting("ShowProxyIP"); } UpdateInterfacesMenu(); diff --git a/plugins/ProxySwitch/src/opt.cpp b/plugins/ProxySwitch/src/opt.cpp index 2a071da495..e78de5e9b7 100644 --- a/plugins/ProxySwitch/src/opt.cpp +++ b/plugins/ProxySwitch/src/opt.cpp @@ -142,47 +142,47 @@ int OptInit(WPARAM wParam, LPARAM) void LoadSettings(void) { - ptrW wszStr(db_get_wsa(NULL, MODULENAME, "UseProxyIPNets")); + ptrW wszStr(g_plugin.getWStringA("UseProxyIPNets")); if (!wszStr) opt_useProxy[0] = 0; else wcsncpy_s(opt_useProxy, wszStr, _TRUNCATE); - wszStr = db_get_wsa(NULL, MODULENAME, "NoProxyIPNets"); + wszStr = g_plugin.getWStringA("NoProxyIPNets"); if (!wszStr) opt_noProxy[0] = 0; else wcsncpy_s(opt_noProxy, wszStr, _TRUNCATE); - wszStr = db_get_wsa(NULL, MODULENAME, "HideInterfaces"); + wszStr = g_plugin.getWStringA("HideInterfaces"); if (!wszStr) opt_hideIntf[0] = 0; else wcsncpy_s(opt_hideIntf, wszStr, _TRUNCATE); - opt_miranda = db_get_b(NULL, MODULENAME, "ManageMirandaProxy", TRUE); - opt_ie = db_get_b(NULL, MODULENAME, "ManageIEProxy", FALSE); - opt_firefox = db_get_b(NULL, MODULENAME, "ManageFirefoxProxy", FALSE) && Firefox_Installed(); - opt_alwayReconnect = db_get_b(NULL, MODULENAME, "AlwaysReconnect", FALSE); - opt_popups = db_get_b(NULL, MODULENAME, "PopupEnabled", TRUE); - opt_defaultColors = db_get_b(NULL, MODULENAME, "PopupDefaultColors", TRUE); - opt_showProxyState = db_get_b(NULL, MODULENAME, "ShowProxyStatus", TRUE); - opt_bgColor = db_get_dw(NULL, MODULENAME, "PopupBgColor", GetSysColor(COLOR_BTNFACE)); - opt_txtColor = db_get_dw(NULL, MODULENAME, "PopupTxtColor", GetSysColor(COLOR_WINDOWTEXT)); + opt_miranda = g_plugin.getByte("ManageMirandaProxy", TRUE); + opt_ie = g_plugin.getByte("ManageIEProxy", FALSE); + opt_firefox = g_plugin.getByte("ManageFirefoxProxy", FALSE) && Firefox_Installed(); + opt_alwayReconnect = g_plugin.getByte("AlwaysReconnect", FALSE); + opt_popups = g_plugin.getByte("PopupEnabled", TRUE); + opt_defaultColors = g_plugin.getByte("PopupDefaultColors", TRUE); + opt_showProxyState = g_plugin.getByte("ShowProxyStatus", TRUE); + opt_bgColor = g_plugin.getDword("PopupBgColor", GetSysColor(COLOR_BTNFACE)); + opt_txtColor = g_plugin.getDword("PopupTxtColor", GetSysColor(COLOR_WINDOWTEXT)); } void SaveSettings(void) { - db_set_ws(NULL, MODULENAME, "UseProxyIPNets", opt_useProxy); - db_set_ws(NULL, MODULENAME, "NoProxyIPNets", opt_noProxy); - db_set_ws(NULL, MODULENAME, "HideInterfaces", opt_hideIntf); - db_set_b(NULL, MODULENAME, "ManageMirandaProxy", (BYTE)opt_miranda); - db_set_b(NULL, MODULENAME, "ManageIEProxy", (BYTE)opt_ie); - db_set_b(NULL, MODULENAME, "ManageFirefoxProxy", (BYTE)opt_firefox); - db_set_b(NULL, MODULENAME, "AlwaysReconnect", (BYTE)opt_alwayReconnect); - db_set_b(NULL, MODULENAME, "PopupEnabled", (BYTE)opt_popups); - db_set_b(NULL, MODULENAME, "PopupDefaultColors", (BYTE)opt_defaultColors); - db_set_b(NULL, MODULENAME, "ShowProxyStatus", (BYTE)opt_showProxyState); - db_set_dw(NULL, MODULENAME, "PopupBgColor", (DWORD)opt_bgColor); - db_set_dw(NULL, MODULENAME, "PopupTxtColor", (DWORD)opt_txtColor); + g_plugin.setWString("UseProxyIPNets", opt_useProxy); + g_plugin.setWString("NoProxyIPNets", opt_noProxy); + g_plugin.setWString("HideInterfaces", opt_hideIntf); + g_plugin.setByte("ManageMirandaProxy", (BYTE)opt_miranda); + g_plugin.setByte("ManageIEProxy", (BYTE)opt_ie); + g_plugin.setByte("ManageFirefoxProxy", (BYTE)opt_firefox); + g_plugin.setByte("AlwaysReconnect", (BYTE)opt_alwayReconnect); + g_plugin.setByte("PopupEnabled", (BYTE)opt_popups); + g_plugin.setByte("PopupDefaultColors", (BYTE)opt_defaultColors); + g_plugin.setByte("ShowProxyStatus", (BYTE)opt_showProxyState); + g_plugin.setDword("PopupBgColor", (DWORD)opt_bgColor); + g_plugin.setDword("PopupTxtColor", (DWORD)opt_txtColor); } diff --git a/plugins/ProxySwitch/src/proxy.cpp b/plugins/ProxySwitch/src/proxy.cpp index bed73e9fb6..45ac91f303 100644 --- a/plugins/ProxySwitch/src/proxy.cpp +++ b/plugins/ProxySwitch/src/proxy.cpp @@ -82,7 +82,7 @@ char Get_Miranda_Proxy_Status(void) Create_Proxy_Settings_List(&ps); for (i = 0; i < ps.count; i++) { - p = db_get_b(NULL, ps.item[i].ModuleName, ps.item[i].SettingName, FALSE); + p = db_get_b(0, ps.item[i].ModuleName, ps.item[i].SettingName, FALSE); if (proxy == PROXY_NO_CONFIG) { proxy = p; continue; @@ -109,7 +109,7 @@ void Set_Miranda_Proxy_Status(char proxy) Create_Proxy_Settings_List(&ps); for (i = 0; i < ps.count; i++) { if (ps.item[i].SettingName[0] != 0) - db_set_b(NULL, ps.item[i].ModuleName, ps.item[i].SettingName, proxy); + db_set_b(0, ps.item[i].ModuleName, ps.item[i].SettingName, proxy); ZeroMemory(&nlus, sizeof(nlus)); nlus.cbSize = sizeof(nlus); if (Netlib_GetUserSettingsByName(ps.item[i].ModuleName, &nlus)) { diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index 82155af3c9..40c17c2111 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -153,22 +153,22 @@ void SaveModuleSettings(int buttonnum, ButtonData* bd) char szMEntry[256] = { '\0' }; mir_snprintf(szMEntry, "EntryName_%u_%u", buttonnum, bd->dwPos); - db_set_ws(NULL, MODULENAME, szMEntry, bd->pszName); + g_plugin.setWString(szMEntry, bd->pszName); mir_snprintf(szMEntry, "EntryValue_%u_%u", buttonnum, bd->dwPos); if (bd->pszValue) - db_set_ws(NULL, MODULENAME, szMEntry, bd->pszValue); + g_plugin.setWString(szMEntry, bd->pszValue); else - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "EntryRel_%u_%u", buttonnum, bd->dwPos); - db_set_b(NULL, MODULENAME, szMEntry, bd->fEntryType); + g_plugin.setByte(szMEntry, bd->fEntryType); mir_snprintf(szMEntry, "EntryToQMenu_%u_%u", buttonnum, bd->dwPos); - db_set_b(NULL, MODULENAME, szMEntry, bd->bInQMenu); + g_plugin.setByte(szMEntry, bd->bInQMenu); mir_snprintf(szMEntry, "EntryIsServiceName_%u_%u", buttonnum, bd->dwPos); - db_set_b(NULL, MODULENAME, szMEntry, bd->bIsServName); + g_plugin.setByte(szMEntry, bd->bIsServName); } void CleanSettings(int buttonnum, int from) @@ -177,24 +177,24 @@ void CleanSettings(int buttonnum, int from) DBVARIANT dbv = { 0 }; if (from == -1) { mir_snprintf(szMEntry, "ButtonName_%u", buttonnum); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "ButtonValue_%u", buttonnum); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "RCEntryIsServiceName_%u", buttonnum); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); } mir_snprintf(szMEntry, "EntryName_%u_%u", buttonnum, from); - while (!db_get_ws(NULL, MODULENAME, szMEntry, &dbv)) { - db_unset(NULL, MODULENAME, szMEntry); + while (!g_plugin.getWString(szMEntry, &dbv)) { + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "EntryValue_%u_%u", buttonnum, from); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "EntryRel_%u_%u", buttonnum, from); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "EntryToQMenu_%u_%u", buttonnum, from); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "EntryIsServiceName_%u_%u", buttonnum, from); - db_unset(NULL, MODULENAME, szMEntry); + g_plugin.delSetting(szMEntry); mir_snprintf(szMEntry, "EntryName_%u_%u", buttonnum, ++from); } @@ -219,7 +219,7 @@ BYTE getEntryByte(int buttonnum, int entrynum, BOOL mode) mir_snprintf(szMEntry, "RCEntryIsServiceName_%u", buttonnum); break; } - return db_get_b(NULL, MODULENAME, szMEntry, 0); + return g_plugin.getByte(szMEntry, 0); } static HANDLE AddIcon(char* szIcoName) @@ -270,7 +270,7 @@ void InitButtonsList() ListData* ld = nullptr; if (!(pszBName = getMenuEntry(i, 0, 3))) { g_iButtonsCount = i; - db_set_b(NULL, MODULENAME, "ButtonsCount", (BYTE)g_iButtonsCount); + g_plugin.setByte("ButtonsCount", (BYTE)g_iButtonsCount); break; } @@ -352,7 +352,7 @@ wchar_t* getMenuEntry(int buttonnum, int entrynum, BYTE mode) break; } - if (!db_get_ws(NULL, MODULENAME, szMEntry, &dbv)) { + if (!g_plugin.getWString(szMEntry, &dbv)) { if (mir_wstrlen(dbv.pwszVal)) buffer = mir_wstrdup(dbv.pwszVal); db_free(&dbv); diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index e43b9b3fcb..3308f6811f 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -263,10 +263,10 @@ static int PluginInit(WPARAM, LPARAM) HookTemporaryEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton);
- g_bRClickAuto = db_get_b(NULL, MODULENAME, "RClickAuto", 0);
- g_bLClickAuto = db_get_b(NULL, MODULENAME, "LClickAuto", 0);
- g_iButtonsCount = db_get_b(NULL, MODULENAME, "ButtonsCount", 0);
- g_bQuickMenu = db_get_b(NULL, MODULENAME, "QuickMenu", 1);
+ g_bRClickAuto = g_plugin.getByte("RClickAuto", 0);
+ g_bLClickAuto = g_plugin.getByte("LClickAuto", 0);
+ g_iButtonsCount = g_plugin.getByte("ButtonsCount", 0);
+ g_bQuickMenu = g_plugin.getByte("QuickMenu", 1);
InitButtonsList();
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index 7d72dd7a14..ae950639ab 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -249,7 +249,7 @@ void SaveMenuTree() if (ld->ptszQValue) {
mir_snprintf(szMEntry, "ButtonValue_%u", iBl);
- db_set_ws(NULL, MODULENAME, szMEntry, ld->ptszQValue);
+ g_plugin.setWString(szMEntry, ld->ptszQValue);
}
if (((ld->dwOPFlags & QMF_NEW) || (ld->dwOPFlags & QMF_RENAMED) || bDeleted)) {
@@ -261,13 +261,13 @@ void SaveMenuTree() }
mir_snprintf(szMEntry, "ButtonName_%u", iBl);
- db_set_ws(NULL, MODULENAME, szMEntry, ld->ptszButtonName);
+ g_plugin.setWString(szMEntry, ld->ptszButtonName);
ld->dwOPFlags = 0;
ld->dwPos = iBl;
ld->bIsServName = ld->bIsOpServName;
mir_snprintf(szMEntry, "RCEntryIsServiceName_%u", iBl);
- db_set_b(NULL, MODULENAME, szMEntry, ld->bIsServName);
+ g_plugin.setByte(szMEntry, ld->bIsServName);
bDeleted = FALSE;
@@ -314,7 +314,7 @@ void SaveMenuTree() iBl++;
}
- db_set_b(NULL, MODULENAME, "ButtonsCount", (BYTE)g_iButtonsCount);
+ g_plugin.setByte("ButtonsCount", (BYTE)g_iButtonsCount);
}
void RestoreModuleData()
@@ -504,7 +504,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) g_opHdlg = hdlg;
bOptionsInit = TRUE;
TranslateDialogDefault(hdlg);
- if (g_iButtonsCount != db_get_b(NULL, MODULENAME, "ButtonsCount", 0)) {
+ if (g_iButtonsCount != g_plugin.getByte("ButtonsCount", 0)) {
LOGFONT logFont;
HFONT hFont;
bNeedRestart = TRUE;
@@ -553,9 +553,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) EnableWindow(GetDlgItem(hdlg, IDC_MENUVALUE), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_INQMENU), FALSE);
EnableWindow(GetDlgItem(hdlg, IDC_ISSERVNAME), FALSE);
- CheckDlgButton(hdlg, IDC_RAUTOSEND, (g_bRClickAuto = db_get_b(NULL, MODULENAME, "RClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_LAUTOSEND, (g_bLClickAuto = db_get_b(NULL, MODULENAME, "LClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_ENABLEQUICKMENU, (g_bQuickMenu = db_get_b(NULL, MODULENAME, "QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_RAUTOSEND, (g_bRClickAuto = g_plugin.getByte("RClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_LAUTOSEND, (g_bLClickAuto = g_plugin.getByte("LClickAuto", 0)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_ENABLEQUICKMENU, (g_bQuickMenu = g_plugin.getByte("QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED);
bOptionsInit = FALSE;
}break;
@@ -694,9 +694,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) SetMenuEntryProperties(hdlg);
SaveMenuTree();
}
- db_set_b(NULL, MODULENAME, "RClickAuto", (BYTE)(g_bRClickAuto = IsDlgButtonChecked(hdlg, IDC_RAUTOSEND)));
- db_set_b(NULL, MODULENAME, "LClickAuto", (BYTE)(g_bLClickAuto = IsDlgButtonChecked(hdlg, IDC_LAUTOSEND)));
- db_set_b(NULL, MODULENAME, "QuickMenu", (BYTE)(g_bQuickMenu = IsDlgButtonChecked(hdlg, IDC_ENABLEQUICKMENU)));
+ g_plugin.setByte("RClickAuto", (BYTE)(g_bRClickAuto = IsDlgButtonChecked(hdlg, IDC_RAUTOSEND)));
+ g_plugin.setByte("LClickAuto", (BYTE)(g_bLClickAuto = IsDlgButtonChecked(hdlg, IDC_LAUTOSEND)));
+ g_plugin.setByte("QuickMenu", (BYTE)(g_bQuickMenu = IsDlgButtonChecked(hdlg, IDC_ENABLEQUICKMENU)));
return 1;
}
else if (((LPNMHDR)lparam)->code == PSN_RESET) {
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 74870255db..5865a6298c 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -63,7 +63,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) char key[64];
mir_snprintf(key, "RepliesCount_%x", iNumber);
- int count = db_get_w(NULL, MODULENAME, key, 0);
+ int count = g_plugin.getWord(key, 0);
if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON) {
mir_snprintf(buttonName, "%s %x", Translate("Button"), iNumber + 1);
@@ -76,7 +76,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) LIST<wchar_t> replyList(1);
for (int i = 0; i < count; i++) {
mir_snprintf(key, "Reply_%x_%x", iNumber, i);
- ptrW value(db_get_wsa(NULL, MODULENAME, key));
+ ptrW value(g_plugin.getWStringA(key));
if (value == nullptr)
replyList.insert(mir_wstrdup(L""));
else
@@ -94,7 +94,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) CallService(MS_MSG_SENDMESSAGEW, cbcd->hContact, (LPARAM)replyList[index - 1]);
mir_snprintf(key, "ImmediatelySend_%x", iNumber);
- if (db_get_b(NULL, MODULENAME, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
+ if (g_plugin.getByte(key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
}
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index 170bfba27e..f64a5e0391 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -69,14 +69,14 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR mir_subclassWindow(GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
mir_snprintf(key, "ImmediatelySend_%x", iNumber);
- CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, db_get_w(NULL, MODULENAME, key, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, g_plugin.getWord(key, 1) ? BST_CHECKED : BST_UNCHECKED);
mir_snprintf(key, "RepliesCount_%x", iNumber);
- count = db_get_w(NULL, MODULENAME, key, 0);
+ count = g_plugin.getWord(key, 0);
for (int i = 0; i < count; i++) {
mir_snprintf(key, "Reply_%x_%x", iNumber, i);
- wchar_t *value = db_get_wsa(NULL, MODULENAME, key);
+ wchar_t *value = g_plugin.getWStringA(key);
if (value) {
replies.Append(value);
replies.Append(L"\r\n");
@@ -113,11 +113,11 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR wchar_t *tszReplies;
mir_snprintf(key, "RepliesCount_%x", iNumber);
- count = db_get_b(NULL, MODULENAME, key, 0);
+ count = g_plugin.getByte(key, 0);
for (int i = 0; i < count; i++) {
mir_snprintf(key, "Reply_%x_%x", iNumber, i);
- db_unset(NULL, MODULENAME, key);
+ g_plugin.delSetting(key);
}
int length = SendDlgItemMessage(hwndDlg, IDC_REPLIES, WM_GETTEXTLENGTH, 0, 0);
@@ -133,17 +133,17 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR int pos = -1, prev = 0;
while ((pos = replies.Find(L"\r\n", prev)) != -1) {
mir_snprintf(key, "Reply_%x_%x", iNumber, count++);
- db_set_ws(NULL, MODULENAME, key, replies.Mid(prev, pos - prev).GetBuffer());
+ g_plugin.setWString(key, replies.Mid(prev, pos - prev).GetBuffer());
prev = pos + 2;
}
}
mir_free(tszReplies);
mir_snprintf(key, "RepliesCount_%x", iNumber);
- db_set_w(NULL, MODULENAME, key, count);
+ g_plugin.setWord(key, count);
mir_snprintf(key, "ImmediatelySend_%x", iNumber);
- db_set_b(NULL, MODULENAME, key, IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
+ g_plugin.setByte(key, IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
return TRUE;
}
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 7ebf619817..5aafc73a81 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -47,11 +47,11 @@ CMPlugin::CMPlugin() : void LoadDBSettings()
{
memset(&LastUCOpt, 0, sizeof(LastUCOpt));
- LastUCOpt.MaxShownContacts = (INT)db_get_b(NULL, MODULENAME, dbLastUC_MaxShownContacts, 0);
- LastUCOpt.HideOffline = db_get_b(NULL, MODULENAME, dbLastUC_HideOfflineContacts, 0);
- LastUCOpt.WindowAutoSize = db_get_b(NULL, MODULENAME, dbLastUC_WindowAutosize, 0);
+ LastUCOpt.MaxShownContacts = (INT)g_plugin.getByte(dbLastUC_MaxShownContacts, 0);
+ LastUCOpt.HideOffline = g_plugin.getByte(dbLastUC_HideOfflineContacts, 0);
+ LastUCOpt.WindowAutoSize = g_plugin.getByte(dbLastUC_WindowAutosize, 0);
- ptrA szFormat(db_get_sa(NULL, MODULENAME, dbLastUC_DateTimeFormat));
+ ptrA szFormat(g_plugin.getStringA(dbLastUC_DateTimeFormat));
if (szFormat)
LastUCOpt.DateTimeFormat = szFormat;
else
@@ -205,7 +205,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM std::wstring str;
char strtim[256 + 16];
- ptrA szFormat(db_get_sa(NULL, MODULENAME, dbLastUC_DateTimeFormat));
+ ptrA szFormat(g_plugin.getStringA(dbLastUC_DateTimeFormat));
if (!szFormat)
szFormat = mir_strdup(dbLastUC_DateTimeFormatDefault);
@@ -252,7 +252,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM char szSettingName[64];
mir_snprintf(szSettingName, "%swidth", dbLastUC_WindowPosPrefix);
- int width = db_get_dw(NULL, MODULENAME, szSettingName, -1);
+ int width = g_plugin.getDword(szSettingName, -1);
int right = rect.left - 6;
if (!IsWindowVisible(g_clistApi.hwndContactList)) right = rect.right;
diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp index 57795570bb..f6f5591ff3 100644 --- a/plugins/RecentContacts/src/options.cpp +++ b/plugins/RecentContacts/src/options.cpp @@ -35,10 +35,10 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP LPNMHDR phdr = (LPNMHDR)(lParam);
if (phdr->idFrom == 0 && phdr->code == PSN_APPLY) {
LastUCOpt.HideOffline = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE);
- db_set_b(NULL, MODULENAME, dbLastUC_HideOfflineContacts, (BYTE)LastUCOpt.HideOffline);
+ g_plugin.setByte(dbLastUC_HideOfflineContacts, (BYTE)LastUCOpt.HideOffline);
LastUCOpt.WindowAutoSize = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_WINDOWAUTOSIZE);
- db_set_b(NULL, MODULENAME, dbLastUC_WindowAutosize, (BYTE)LastUCOpt.WindowAutoSize);
+ g_plugin.setByte(dbLastUC_WindowAutosize, (BYTE)LastUCOpt.WindowAutoSize);
GetDlgItemTextA(hwndDlg, IDC_SHOWNCONTACTS, str, _countof(str));
LastUCOpt.MaxShownContacts= atoi(str);
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index 5bba760a16..d30b7073a6 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -553,8 +553,8 @@ void DisablePlugins() // Disable it
if (name[0] != '\0') {
CharLowerA(name);
- if (db_get_b(NULL, PLUGINDISABLELIST, name, 0) != 1) {
- db_set_b(NULL, PLUGINDISABLELIST, name, 1);
+ if (db_get_b(0, PLUGINDISABLELIST, name, 0) != 1) {
+ db_set_b(0, PLUGINDISABLELIST, name, 1);
}
}
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index ef904f371d..d1cd4d92b8 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -440,7 +440,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (colour) {
mir_snprintf(str, "Font%dCol", i);
- (*colour) = db_get_dw(NULL, SRMMMOD, str, fontOptionsList[0].defColour);
+ (*colour) = db_get_dw(0, SRMMMOD, str, fontOptionsList[0].defColour);
}
if (lf) {
@@ -453,18 +453,18 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) }
mir_snprintf(str, "Font%dSize", i);
- lf->lfHeight = (char)db_get_b(NULL, SRMMMOD, str, fontOptionsList[0].defSize);
+ lf->lfHeight = (char)db_get_b(0, SRMMMOD, str, fontOptionsList[0].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font%dSty", i);
- style = db_get_b(NULL, SRMMMOD, str, fontOptionsList[0].defStyle);
+ style = db_get_b(0, SRMMMOD, str, fontOptionsList[0].defStyle);
lf->lfWeight = style&FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style&FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = 0;
lf->lfStrikeOut = 0;
mir_snprintf(str, "Font%dSet", i);
- lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName));
+ lf->lfCharSet = db_get_b(0, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName));
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index eb4ad3ace6..8bf10ab7a7 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -81,7 +81,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ COLORREF colour = db_get_dw(0, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
prswdWindowData->hBkgBrush = CreateSolidBrush(colour);
}
@@ -98,7 +98,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA LoadMsgDlgFont(MSGFONTID_YOURMSG, nullptr, &colour);
SetTextColor((HDC)wParam, colour);
- SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
+ SetBkColor((HDC)wParam, db_get_dw(0, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
return (INT_PTR)prswdWindowData->hBkgBrush;
}
break;
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 8ce68079e1..ab495836d1 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -107,7 +107,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hWndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ COLORREF colour = db_get_dw(0, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
psswdWindowData->hBkgBrush = CreateSolidBrush(colour);
}
{
@@ -236,7 +236,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARA LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &colour);
SetTextColor((HDC)wParam, colour);
- SetBkColor((HDC)wParam, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
+ SetBkColor((HDC)wParam, db_get_dw(0, SRMMMOD, SRMSGSET_INPBKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));
return((INT_PTR)psswdWindowData->hBkgBrush);
}
break;
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index b042f486f6..f4ad26a11c 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -43,30 +43,30 @@ int myDBWriteStringEncode(MCONTACT hContact, const char *szModule, const char *s void GetFlags()
{
- bSFT = db_get_b(0, MODULENAME, "sft", 0);
- bSOM = db_get_b(0, MODULENAME, "som", 0);
- bASI = db_get_b(0, MODULENAME, "asi", 0);
- bMCD = db_get_b(0, MODULENAME, "mcd", 0);
- bSCM = db_get_b(0, MODULENAME, "scm", 0);
- bDGP = db_get_b(0, MODULENAME, "dgp", 0);
- bAIP = db_get_b(0, MODULENAME, "aip", 0);
- bNOL = db_get_b(0, MODULENAME, "nol", 0);
- bAAK = db_get_b(0, MODULENAME, "aak", 0);
- bMCM = db_get_b(0, MODULENAME, "mcm", 0);
+ bSFT = g_plugin.getByte("sft", 0);
+ bSOM = g_plugin.getByte("som", 0);
+ bASI = g_plugin.getByte("asi", 0);
+ bMCD = g_plugin.getByte("mcd", 0);
+ bSCM = g_plugin.getByte("scm", 0);
+ bDGP = g_plugin.getByte("dgp", 0);
+ bAIP = g_plugin.getByte("aip", 0);
+ bNOL = g_plugin.getByte("nol", 0);
+ bAAK = g_plugin.getByte("aak", 0);
+ bMCM = g_plugin.getByte("mcm", 0);
}
void SetFlags()
{
- db_set_b(0, MODULENAME, "sft", bSFT);
- db_set_b(0, MODULENAME, "som", bSOM);
- db_set_b(0, MODULENAME, "asi", bASI);
- db_set_b(0, MODULENAME, "mcd", bMCD);
- db_set_b(0, MODULENAME, "scm", bSCM);
- db_set_b(0, MODULENAME, "dgp", bDGP);
- db_set_b(0, MODULENAME, "aip", bAIP);
- db_set_b(0, MODULENAME, "nol", bNOL);
- db_set_b(0, MODULENAME, "aak", bAAK);
- db_set_b(0, MODULENAME, "mcm", bMCM);
+ g_plugin.setByte("sft", bSFT);
+ g_plugin.setByte("som", bSOM);
+ g_plugin.setByte("asi", bASI);
+ g_plugin.setByte("mcd", bMCD);
+ g_plugin.setByte("scm", bSCM);
+ g_plugin.setByte("dgp", bDGP);
+ g_plugin.setByte("aip", bAIP);
+ g_plugin.setByte("nol", bNOL);
+ g_plugin.setByte("aak", bAAK);
+ g_plugin.setByte("mcm", bMCM);
}
int msgbox(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index afa18459e0..822f479059 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -89,7 +89,7 @@ BOOL CalculateKeyX(pUinKey ptr, MCONTACT hContact) db_set_blob(hContact, MODULENAME, "offlineKey", buffer, keysize);
// store timeout of key in database (2 days)
- db_set_dw(hContact, MODULENAME, "offlineKeyTimeout", gettime() + (60 * 60 * 24 * db_get_w(0, MODULENAME, "okt", 2)));
+ db_set_dw(hContact, MODULENAME, "offlineKeyTimeout", gettime() + (60 * 60 * 24 * g_plugin.getWord("okt", 2)));
// key exchange is finished
showPopupEC(ptr->hContact);
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 34f9306fde..22d2ec4964 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -5,7 +5,7 @@ LIST<UinKey> arClist(100, NumericKeySortT); void loadSupportedProtocols()
{
- LPSTR szNames = db_get_sa(0, MODULENAME, "protos");
+ LPSTR szNames = g_plugin.getStringA("protos");
if (szNames && strchr(szNames, ':') == nullptr) {
LPSTR tmp = (LPSTR)mir_alloc(2048); int j = 0;
for (int i = 0; szNames[i]; i++) {
@@ -16,7 +16,7 @@ void loadSupportedProtocols() }
tmp[j] = '\0';
SAFE_FREE(szNames); szNames = tmp;
- db_set_s(0, MODULENAME, "protos", szNames);
+ g_plugin.setString("protos", szNames);
}
for (auto &pa : Accounts()) {
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp index 108e8958b9..6017c25719 100644 --- a/plugins/SecureIM/src/crypt_misc.cpp +++ b/plugins/SecureIM/src/crypt_misc.cpp @@ -7,7 +7,7 @@ static void sttWaitForExchange(LPVOID param) if (!ptr)
return;
- for (int i = 0; i < db_get_w(0, MODULENAME, "ket", 10) * 10; i++) {
+ for (int i = 0; i < g_plugin.getWord("ket", 10) * 10; i++) {
Sleep(100);
if (ptr->waitForExchange != 1)
break;
diff --git a/plugins/SecureIM/src/crypt_popups.cpp b/plugins/SecureIM/src/crypt_popups.cpp index c57827c6c7..f50b5e308f 100644 --- a/plugins/SecureIM/src/crypt_popups.cpp +++ b/plugins/SecureIM/src/crypt_popups.cpp @@ -14,25 +14,25 @@ void showPopup(LPCSTR lpzText, MCONTACT hContact, HICON hIcon, UINT type) DBVARIANT dbv;
if (type == 0) {
- colorBack = db_get_dw(0, MODULENAME, "colorKeyb", RGB(230, 230, 255));
- colorText = db_get_dw(0, MODULENAME, "colorKeyt", RGB(0, 0, 0));
- if (!db_get_s(0, MODULENAME, "timeoutKey", &dbv)) {
+ colorBack = g_plugin.getDword("colorKeyb", RGB(230, 230, 255));
+ colorText = g_plugin.getDword("colorKeyt", RGB(0, 0, 0));
+ if (!g_plugin.getString("timeoutKey", &dbv)) {
timeout = atoi(dbv.pszVal);
db_free(&dbv);
}
}
else if (type == 1) {
- colorBack = db_get_dw(0, MODULENAME, "colorSecb", RGB(255, 255, 200));
- colorText = db_get_dw(0, MODULENAME, "colorSect", RGB(0, 0, 0));
- if (!db_get_s(0, MODULENAME, "timeoutSec", &dbv)) {
+ colorBack = g_plugin.getDword("colorSecb", RGB(255, 255, 200));
+ colorText = g_plugin.getDword("colorSect", RGB(0, 0, 0));
+ if (!g_plugin.getString("timeoutSec", &dbv)) {
timeout = atoi(dbv.pszVal);
db_free(&dbv);
}
}
else if (type >= 2) {
- colorBack = db_get_dw(0, MODULENAME, "colorSRb", RGB(200, 255, 200));
- colorText = db_get_dw(0, MODULENAME, "colorSRt", RGB(0, 0, 0));
- if (!db_get_s(0, MODULENAME, "timeoutSR", &dbv)) {
+ colorBack = g_plugin.getDword("colorSRb", RGB(200, 255, 200));
+ colorText = g_plugin.getDword("colorSRt", RGB(0, 0, 0));
+ if (!g_plugin.getString("timeoutSR", &dbv)) {
timeout = atoi(dbv.pszVal);
db_free(&dbv);
}
@@ -54,50 +54,50 @@ void showPopup(LPCSTR lpzText, MCONTACT hContact, HICON hIcon, UINT type) void showPopupDCmsg(MCONTACT hContact, LPCSTR msg)
{
- if (db_get_b(0, MODULENAME, "dc", 1))
+ if (g_plugin.getByte("dc", 1))
showPopup(msg, hContact, g_hPOP[POP_PU_DIS], 1);
}
void showPopupDC(MCONTACT hContact)
{
- if (db_get_b(0, MODULENAME, "dc", 1))
+ if (g_plugin.getByte("dc", 1))
showPopup(sim006, hContact, g_hPOP[POP_PU_DIS], 1);
}
void showPopupEC(MCONTACT hContact)
{
- if (db_get_b(0, MODULENAME, "ec", 1))
+ if (g_plugin.getByte("ec", 1))
showPopup(sim001, hContact, g_hPOP[POP_PU_EST], 1);
}
void showPopupKS(MCONTACT hContact)
{
- if (db_get_b(0, MODULENAME, "ks", 1))
+ if (g_plugin.getByte("ks", 1))
showPopup(sim007, hContact, g_hPOP[POP_PU_PRC], 0);
}
void showPopupKRmsg(MCONTACT hContact, LPCSTR msg)
{
- if (db_get_b(0, MODULENAME, "kr", 1))
+ if (g_plugin.getByte("kr", 1))
showPopup(msg, hContact, g_hPOP[POP_PU_PRC], 0);
}
void showPopupKR(MCONTACT hContact)
{
- if (db_get_b(0, MODULENAME, "kr", 1))
+ if (g_plugin.getByte("kr", 1))
showPopup(sim008, hContact, g_hPOP[POP_PU_PRC], 0);
}
void showPopupSM(MCONTACT hContact)
{
- if (db_get_b(0, MODULENAME, "ss", 0))
+ if (g_plugin.getByte("ss", 0))
showPopup(sim009, hContact, g_hPOP[POP_PU_MSS], 2);
Skin_PlaySound("OutgoingSecureMessage");
}
void showPopupRM(MCONTACT hContact)
{
- if (db_get_b(0, MODULENAME, "sr", 0))
+ if (g_plugin.getByte("sr", 0))
showPopup(sim010, hContact, g_hPOP[POP_PU_MSR], 2);
Skin_PlaySound("IncomingSecureMessage");
}
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 36e6f2067b..297f5eb04e 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -86,25 +86,25 @@ static int onModulesLoaded(WPARAM, LPARAM) char pub_key[4096]; int pub_len;
mir_exp->rsa_get_keypair(CPP_MODE_RSA_4096, (PBYTE)&priv_key, &priv_len, (PBYTE)&pub_key, &pub_len);
- db_set_blob(NULL, MODULENAME, "rsa_priv", priv_key, priv_len);
- db_set_blob(NULL, MODULENAME, "rsa_pub", &pub_key, pub_len);
- db_unset(NULL, MODULENAME, "rsa_priv_2048");
- db_unset(NULL, MODULENAME, "rsa_pub_2048");
+ db_set_blob(0, MODULENAME, "rsa_priv", priv_key, priv_len);
+ db_set_blob(0, MODULENAME, "rsa_pub", &pub_key, pub_len);
+ g_plugin.delSetting("rsa_priv_2048");
+ g_plugin.delSetting("rsa_pub_2048");
rsa_4096 = 1;
}
if (!rsa_4096)
mir_forkthread(sttGenerateRSA);
- mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10));
+ mir_exp->rsa_set_timeout(g_plugin.getWord("ket", 10));
Sent_NetLog("pgp_init");
- bPGP = db_get_b(0, MODULENAME, "pgp", 0);
+ bPGP = g_plugin.getByte("pgp", 0);
if (bPGP) { //PGP
bPGPloaded = pgp_init();
- bUseKeyrings = db_get_b(0, MODULENAME, "ukr", 1);
- LPSTR priv = db_get_sa(0, MODULENAME, "pgpPrivKey");
+ bUseKeyrings = g_plugin.getByte("ukr", 1);
+ LPSTR priv = g_plugin.getStringA("pgpPrivKey");
if (priv) {
bPGPprivkey = true;
if (bPGPloaded)
@@ -118,24 +118,24 @@ static int onModulesLoaded(WPARAM, LPARAM) bPGPkeyrings = pgp_open_keyrings(PubRingPath, SecRingPath);
}
else {
- LPSTR tmp = db_get_sa(0, MODULENAME, "pgpPubRing");
+ LPSTR tmp = g_plugin.getStringA("pgpPubRing");
if (tmp) {
strncpy(PubRingPath, tmp, sizeof(PubRingPath));
mir_free(tmp);
}
- if (tmp = db_get_sa(0, MODULENAME, "pgpSecRing")) {
+ if (tmp = g_plugin.getStringA("pgpSecRing")) {
strncpy(SecRingPath, tmp, sizeof(SecRingPath));
mir_free(tmp);
}
if (PubRingPath[0] && SecRingPath[0]) {
bPGPkeyrings = pgp_open_keyrings(PubRingPath, SecRingPath);
if (bPGPkeyrings) {
- db_set_s(0, MODULENAME, "pgpPubRing", PubRingPath);
- db_set_s(0, MODULENAME, "pgpSecRing", SecRingPath);
+ g_plugin.setString("pgpPubRing", PubRingPath);
+ g_plugin.setString("pgpSecRing", SecRingPath);
}
else {
- db_unset(0, MODULENAME, "pgpPubRing");
- db_unset(0, MODULENAME, "pgpSecRing");
+ g_plugin.delSetting("pgpPubRing");
+ g_plugin.delSetting("pgpSecRing");
}
}
}
@@ -144,32 +144,32 @@ static int onModulesLoaded(WPARAM, LPARAM) Sent_NetLog("gpg_init");
- bGPG = db_get_b(0, MODULENAME, "gpg", 0);
+ bGPG = g_plugin.getByte("gpg", 0);
if (bGPG) { //GPG
bGPGloaded = gpg_init();
char gpgexec[MAX_PATH], gpghome[MAX_PATH];
gpgexec[0] = '\0'; gpghome[0] = '\0';
- LPSTR tmp = db_get_sa(0, MODULENAME, "gpgExec");
+ LPSTR tmp = g_plugin.getStringA("gpgExec");
if (tmp) {
strncpy(gpgexec, tmp, sizeof(gpgexec)-1);
mir_free(tmp);
}
- if (tmp = db_get_sa(0, MODULENAME, "gpgHome")) {
+ if (tmp = g_plugin.getStringA("gpgHome")) {
strncpy(gpghome, tmp, sizeof(gpghome)-1);
mir_free(tmp);
}
- if (db_get_b(0, MODULENAME, "gpgLogFlag", 0)) {
- if (tmp = db_get_sa(0, MODULENAME, "gpgLog")) {
+ if (g_plugin.getByte("gpgLogFlag", 0)) {
+ if (tmp = g_plugin.getStringA("gpgLog")) {
gpg_set_log(tmp);
mir_free(tmp);
}
}
- if (db_get_b(0, MODULENAME, "gpgTmpFlag", 0)) {
- if (tmp = db_get_sa(0, MODULENAME, "gpgTmp")) {
+ if (g_plugin.getByte("gpgTmpFlag", 0)) {
+ if (tmp = g_plugin.getStringA("gpgTmp")) {
gpg_set_tmp(tmp);
mir_free(tmp);
}
@@ -177,17 +177,17 @@ static int onModulesLoaded(WPARAM, LPARAM) bGPGkeyrings = gpg_open_keyrings(gpgexec, gpghome);
if (bGPGkeyrings) {
- db_set_s(0, MODULENAME, "gpgExec", gpgexec);
- db_set_s(0, MODULENAME, "gpgHome", gpghome);
+ g_plugin.setString("gpgExec", gpgexec);
+ g_plugin.setString("gpgHome", gpghome);
}
else {
- db_unset(0, MODULENAME, "gpgExec");
- db_unset(0, MODULENAME, "gpgHome");
+ g_plugin.delSetting("gpgExec");
+ g_plugin.delSetting("gpgHome");
}
- bSavePass = db_get_b(0, MODULENAME, "gpgSaveFlag", 0);
+ bSavePass = g_plugin.getByte("gpgSaveFlag", 0);
if (bSavePass) {
- if (tmp = db_get_sa(0, MODULENAME, "gpgSave")) {
+ if (tmp = g_plugin.getStringA("gpgSave")) {
gpg_set_passphrases(tmp);
mir_free(tmp);
}
@@ -247,10 +247,10 @@ static int onShutdown(WPARAM, LPARAM) {
if (bSavePass) {
LPSTR tmp = gpg_get_passphrases();
- db_set_s(0, MODULENAME, "gpgSave", tmp);
+ g_plugin.setString("gpgSave", tmp);
LocalFree(tmp);
}
- else db_unset(0, MODULENAME, "gpgSave");
+ else g_plugin.delSetting("gpgSave");
if (bPGPloaded) pgp_done();
if (bGPGloaded) gpg_done();
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 02e0eb4e02..e1ba269df9 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -678,8 +678,8 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l PubRingPath[0] = '\0'; SecRingPath[0] = '\0';
bPGPkeyrings = pgp_open_keyrings(PubRingPath, SecRingPath);
if (bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) {
- db_set_s(0, MODULENAME, "pgpPubRing", PubRingPath);
- db_set_s(0, MODULENAME, "pgpSecRing", SecRingPath);
+ g_plugin.setString("pgpPubRing", PubRingPath);
+ g_plugin.setString("pgpSecRing", SecRingPath);
}
SetDlgItemText(hDlg, IDC_KEYRING_STATUS, bPGPkeyrings ? Translate(sim216) : Translate(sim217));
}
@@ -700,11 +700,11 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l if (ShowSelectKeyDlg(hDlg, KeyPath)) {
char *priv = LoadKeys(KeyPath, true);
if (priv) {
- db_set_s(0, MODULENAME, "tpgpPrivKey", priv);
+ g_plugin.setString("tpgpPrivKey", priv);
mir_free(priv);
}
else {
- db_unset(0, MODULENAME, "tpgpPrivKey");
+ g_plugin.delSetting("tpgpPrivKey");
}
}
}
@@ -940,12 +940,12 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) char timeout[10];
// Key Exchange Timeout
- UINT data = db_get_w(0, MODULENAME, "ket", 10);
+ UINT data = g_plugin.getWord("ket", 10);
mir_itoa(data, timeout, 10);
SetDlgItemText(hDlg, IDC_KET, timeout);
// Offline Key Timeout
- data = db_get_w(0, MODULENAME, "okt", 2);
+ data = g_plugin.getWord("okt", 2);
mir_itoa(data, timeout, 10);
SetDlgItemText(hDlg, IDC_OKT, timeout);
@@ -1086,27 +1086,27 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) void RefreshGPGDlg(HWND hDlg, BOOL iInit)
{
- LPSTR path = db_get_sa(0, MODULENAME, "gpgExec");
+ LPSTR path = g_plugin.getStringA("gpgExec");
if (path) {
SetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, path);
mir_free(path);
}
- path = db_get_sa(0, MODULENAME, "gpgHome");
+ path = g_plugin.getStringA("gpgHome");
if (path) {
SetDlgItemText(hDlg, IDC_GPGHOME_EDIT, path);
mir_free(path);
}
- BOOL bGPGLogFlag = db_get_b(0, MODULENAME, "gpgLogFlag", 0);
+ BOOL bGPGLogFlag = g_plugin.getByte("gpgLogFlag", 0);
CheckDlgButton(hDlg, IDC_LOGGINGON_CBOX, (bGPGLogFlag) ? BST_CHECKED : BST_UNCHECKED);
- path = db_get_sa(0, MODULENAME, "gpgLog");
+ path = g_plugin.getStringA("gpgLog");
if (path) {
SetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, path);
mir_free(path);
}
CheckDlgButton(hDlg, IDC_SAVEPASS_CBOX, (bSavePass) ? BST_CHECKED : BST_UNCHECKED);
- BOOL bGPGTmpFlag = db_get_b(0, MODULENAME, "gpgTmpFlag", 0);
+ BOOL bGPGTmpFlag = g_plugin.getByte("gpgTmpFlag", 0);
CheckDlgButton(hDlg, IDC_TMPPATHON_CBOX, (bGPGTmpFlag) ? BST_CHECKED : BST_UNCHECKED);
- path = db_get_sa(0, MODULENAME, "gpgTmp");
+ path = g_plugin.getStringA("gpgTmp");
if (path) {
SetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, path);
mir_free(path);
@@ -1215,15 +1215,15 @@ void ApplyGeneralSettings(HWND hDlg) // Key Exchange Timeout
GetDlgItemText(hDlg, IDC_KET, timeout, 5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- db_set_w(0, MODULENAME, "ket", tmp);
- mir_exp->rsa_set_timeout(db_get_w(0, MODULENAME, "ket", 10));
+ g_plugin.setWord("ket", tmp);
+ mir_exp->rsa_set_timeout(g_plugin.getWord("ket", 10));
mir_itoa(tmp, timeout, 10);
SetDlgItemText(hDlg, IDC_KET, timeout);
// Offline Key Timeout
GetDlgItemText(hDlg, IDC_OKT, timeout, 5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- db_set_w(0, MODULENAME, "okt", tmp);
+ g_plugin.setWord("okt", tmp);
mir_itoa(tmp, timeout, 10);
SetDlgItemText(hDlg, IDC_OKT, timeout);
@@ -1246,12 +1246,12 @@ void ApplyGeneralSettings(HWND hDlg) i = (IsDlgButtonChecked(hDlg, IDC_PGP) == BST_CHECKED);
if (i != bPGP) {
bPGP = i; tmp++;
- db_set_b(0, MODULENAME, "pgp", bPGP);
+ g_plugin.setByte("pgp", bPGP);
}
i = (IsDlgButtonChecked(hDlg, IDC_GPG) == BST_CHECKED);
if (i != bGPG) {
bGPG = i; tmp++;
- db_set_b(0, MODULENAME, "gpg", bGPG);
+ g_plugin.setByte("gpg", bGPG);
}
if (tmp) msgbox1(hDlg, sim224, MODULENAME, MB_OK | MB_ICONINFORMATION);
}
@@ -1305,21 +1305,21 @@ void ApplyProtoSettings(HWND hDlg) i = ListView_GetNextItem(hLV, i, LVNI_ALL);
}
- db_set_s(0, MODULENAME, "protos", szNames);
+ g_plugin.setString("protos", szNames);
}
void ApplyPGPSettings(HWND hDlg)
{
bUseKeyrings = !(IsDlgButtonChecked(hDlg, IDC_NO_KEYRINGS) == BST_CHECKED);
- db_set_b(0, MODULENAME, "ukr", bUseKeyrings);
+ g_plugin.setByte("ukr", bUseKeyrings);
- char *priv = db_get_sa(0, MODULENAME, "tpgpPrivKey");
+ char *priv = g_plugin.getStringA("tpgpPrivKey");
if (priv) {
bPGPprivkey = true;
pgp_set_priv_key(priv);
- db_set_s(0, MODULENAME, "pgpPrivKey", priv);
+ g_plugin.setString("pgpPrivKey", priv);
mir_free(priv);
- db_unset(0, MODULENAME, "tpgpPrivKey");
+ g_plugin.delSetting("tpgpPrivKey");
}
}
@@ -1328,24 +1328,24 @@ void ApplyGPGSettings(HWND hDlg) char tmp[256];
GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, _countof(tmp));
- db_set_s(0, MODULENAME, "gpgExec", tmp);
+ g_plugin.setString("gpgExec", tmp);
GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, _countof(tmp));
- db_set_s(0, MODULENAME, "gpgHome", tmp);
+ g_plugin.setString("gpgHome", tmp);
bSavePass = (IsDlgButtonChecked(hDlg, IDC_SAVEPASS_CBOX) == BST_CHECKED);
- db_set_b(0, MODULENAME, "gpgSaveFlag", bSavePass);
+ g_plugin.setByte("gpgSaveFlag", bSavePass);
BOOL bgpgLogFlag = (IsDlgButtonChecked(hDlg, IDC_LOGGINGON_CBOX) == BST_CHECKED);
- db_set_b(0, MODULENAME, "gpgLogFlag", bgpgLogFlag);
+ g_plugin.setByte("gpgLogFlag", bgpgLogFlag);
GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, _countof(tmp));
- db_set_s(0, MODULENAME, "gpgLog", tmp);
+ g_plugin.setString("gpgLog", tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
else gpg_set_log(nullptr);
BOOL bgpgTmpFlag = (IsDlgButtonChecked(hDlg, IDC_TMPPATHON_CBOX) == BST_CHECKED);
- db_set_b(0, MODULENAME, "gpgTmpFlag", bgpgTmpFlag);
+ g_plugin.setByte("gpgTmpFlag", bgpgTmpFlag);
GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, _countof(tmp));
- db_set_s(0, MODULENAME, "gpgTmp", tmp);
+ g_plugin.setString("gpgTmp", tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
else gpg_set_tmp(nullptr);
@@ -1550,14 +1550,14 @@ void ListView_Sort(HWND hLV, LPARAM lParamSort) char t[32];
mir_snprintf(t, "os%02x", (UINT)lParamSort & 0xF0);
if ((lParamSort & 0x0F) == 0)
- lParamSort = (int)db_get_b(0, MODULENAME, t, lParamSort + 1);
+ lParamSort = (int)g_plugin.getByte(t, lParamSort + 1);
- db_set_b(0, MODULENAME, t, (BYTE)lParamSort);
+ g_plugin.setByte(t, (BYTE)lParamSort);
// restore sort order
mir_snprintf(t, "os%02x", (UINT)lParamSort);
- int m = db_get_b(0, MODULENAME, t, 0);
- if (bChangeSortOrder) { m = !m; db_set_b(0, MODULENAME, t, m); }
+ int m = g_plugin.getByte(t, 0);
+ if (bChangeSortOrder) { m = !m; g_plugin.setByte(t, m); }
ListView_SortItems(hLV, &CompareFunc, lParamSort | (m << 8));
}
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index f7dd998e49..2091d6294c 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -3,22 +3,22 @@ static void RefreshPopupOptionsDlg(HWND hec, HWND hdc, HWND hss, HWND hsr, HWND hks, HWND hkr)
{
// ec checkbox
- SendMessage(hec, BM_SETCHECK, db_get_b(0, MODULENAME, "ec", 1), 0L);
+ SendMessage(hec, BM_SETCHECK, g_plugin.getByte("ec", 1), 0L);
// dc checkbox
- SendMessage(hdc, BM_SETCHECK, db_get_b(0, MODULENAME, "dc", 1), 0L);
+ SendMessage(hdc, BM_SETCHECK, g_plugin.getByte("dc", 1), 0L);
// ks checkbox
- SendMessage(hks, BM_SETCHECK, db_get_b(0, MODULENAME, "ks", 1), 0L);
+ SendMessage(hks, BM_SETCHECK, g_plugin.getByte("ks", 1), 0L);
// kr checkbox
- SendMessage(hkr, BM_SETCHECK, db_get_b(0, MODULENAME, "kr", 1), 0L);
+ SendMessage(hkr, BM_SETCHECK, g_plugin.getByte("kr", 1), 0L);
//ss checkbox
- SendMessage(hss, BM_SETCHECK, db_get_b(0, MODULENAME, "ss", 0), 0L);
+ SendMessage(hss, BM_SETCHECK, g_plugin.getByte("ss", 0), 0L);
//sr checkbox
- SendMessage(hsr, BM_SETCHECK, db_get_b(0, MODULENAME, "sr", 0), 0L);
+ SendMessage(hsr, BM_SETCHECK, g_plugin.getByte("sr", 0), 0L);
}
INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
@@ -41,34 +41,34 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l char *timeout;
//set timeout value for Key
- if (db_get_s(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout = dbv.pszVal;
+ if (g_plugin.getString("timeoutKey", &dbv) == 0) timeout = dbv.pszVal;
else timeout = "0";
SetDlgItemText(hDlg, IDC_TIMEKEY, timeout);
db_free(&dbv);
//set timeout value for SEC
- if (db_get_s(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout = dbv.pszVal;
+ if (g_plugin.getString("timeoutSec", &dbv) == 0) timeout = dbv.pszVal;
else timeout = "0";
SetDlgItemText(hDlg, IDC_TIMESEC, timeout);
db_free(&dbv);
//set timeout value for SR
- if (db_get_s(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout = dbv.pszVal;
+ if (g_plugin.getString("timeoutSR", &dbv) == 0) timeout = dbv.pszVal;
else timeout = "0";
SetDlgItemText(hDlg, IDC_TIMESR, timeout);
db_free(&dbv);
//key color
- SendDlgItemMessage(hDlg, IDC_BACKKEY, CPM_SETCOLOUR, 0, db_get_dw(0, MODULENAME, "colorKeyb", RGB(230, 230, 255)));
- SendDlgItemMessage(hDlg, IDC_TEXTKEY, CPM_SETCOLOUR, 0, db_get_dw(0, MODULENAME, "colorKeyt", RGB(0, 0, 0)));
+ SendDlgItemMessage(hDlg, IDC_BACKKEY, CPM_SETCOLOUR, 0, g_plugin.getDword("colorKeyb", RGB(230, 230, 255)));
+ SendDlgItemMessage(hDlg, IDC_TEXTKEY, CPM_SETCOLOUR, 0, g_plugin.getDword("colorKeyt", RGB(0, 0, 0)));
//Session color
- SendDlgItemMessage(hDlg, IDC_BACKSEC, CPM_SETCOLOUR, 0, db_get_dw(0, MODULENAME, "colorSecb", RGB(255, 255, 200)));
- SendDlgItemMessage(hDlg, IDC_TEXTSEC, CPM_SETCOLOUR, 0, db_get_dw(0, MODULENAME, "colorSect", RGB(0, 0, 0)));
+ SendDlgItemMessage(hDlg, IDC_BACKSEC, CPM_SETCOLOUR, 0, g_plugin.getDword("colorSecb", RGB(255, 255, 200)));
+ SendDlgItemMessage(hDlg, IDC_TEXTSEC, CPM_SETCOLOUR, 0, g_plugin.getDword("colorSect", RGB(0, 0, 0)));
//SR color
- SendDlgItemMessage(hDlg, IDC_BACKSR, CPM_SETCOLOUR, 0, db_get_dw(0, MODULENAME, "colorSRb", RGB(200, 255, 200)));
- SendDlgItemMessage(hDlg, IDC_TEXTSR, CPM_SETCOLOUR, 0, db_get_dw(0, MODULENAME, "colorSRt", RGB(0, 0, 0)));
+ SendDlgItemMessage(hDlg, IDC_BACKSR, CPM_SETCOLOUR, 0, g_plugin.getDword("colorSRb", RGB(200, 255, 200)));
+ SendDlgItemMessage(hDlg, IDC_TEXTSR, CPM_SETCOLOUR, 0, g_plugin.getDword("colorSRt", RGB(0, 0, 0)));
break;
case WM_COMMAND:
@@ -78,22 +78,22 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) {
case IDC_BACKKEY:
- db_set_dw(0, MODULENAME, "colorKeyb", color);
+ g_plugin.setDword("colorKeyb", color);
break;
case IDC_TEXTKEY:
- db_set_dw(0, MODULENAME, "colorKeyt", color);
+ g_plugin.setDword("colorKeyt", color);
break;
case IDC_BACKSEC:
- db_set_dw(0, MODULENAME, "colorSecb", color);
+ g_plugin.setDword("colorSecb", color);
break;
case IDC_TEXTSEC:
- db_set_dw(0, MODULENAME, "colorSect", color);
+ g_plugin.setDword("colorSect", color);
break;
case IDC_BACKSR:
- db_set_dw(0, MODULENAME, "colorSRb", color);
+ g_plugin.setDword("colorSRb", color);
break;
case IDC_TEXTSR:
- db_set_dw(0, MODULENAME, "colorSRt", color);
+ g_plugin.setDword("colorSRt", color);
break;
}
return TRUE;
@@ -108,45 +108,45 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l break;
case IDC_EC:
//set ec checkbox value
- db_set_b(0, MODULENAME, "ec", (BYTE)(SendMessage(hec, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
+ g_plugin.setByte("ec", (BYTE)(SendMessage(hec, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
break;
case IDC_DC:
//set dc checkbox value
- db_set_b(0, MODULENAME, "dc", (BYTE)(SendMessage(hdc, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
+ g_plugin.setByte("dc", (BYTE)(SendMessage(hdc, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
break;
case IDC_SS:
//set ss checkbox value
- db_set_b(0, MODULENAME, "ss", (BYTE)(SendMessage(hss, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
+ g_plugin.setByte("ss", (BYTE)(SendMessage(hss, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
break;
case IDC_SR:
//set sr checkbox value
- db_set_b(0, MODULENAME, "sr", (BYTE)(SendMessage(hsr, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
+ g_plugin.setByte("sr", (BYTE)(SendMessage(hsr, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
break;
case IDC_KS:
//set indicator checkbox value
- db_set_b(0, MODULENAME, "ks", (BYTE)(SendMessage(hks, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
+ g_plugin.setByte("ks", (BYTE)(SendMessage(hks, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
break;
case IDC_KR:
//set indicator checkbox value
- db_set_b(0, MODULENAME, "kr", (BYTE)(SendMessage(hkr, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
+ g_plugin.setByte("kr", (BYTE)(SendMessage(hkr, BM_GETCHECK, 0L, 0L) == BST_CHECKED));
break;
case IDC_TIMEKEY:
//set timeout value
GetDlgItemText(hDlg, IDC_TIMEKEY, getTimeout, _countof(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
- db_set_s(0, MODULENAME, "timeoutKey", getTimeout);
+ g_plugin.setString("timeoutKey", getTimeout);
break;
case IDC_TIMESEC:
//set timeout value
GetDlgItemText(hDlg, IDC_TIMESEC, getTimeout, _countof(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
- db_set_s(0, MODULENAME, "timeoutSec", getTimeout);
+ g_plugin.setString("timeoutSec", getTimeout);
break;
case IDC_TIMESR:
//set timeout value
GetDlgItemText(hDlg, IDC_TIMESR, getTimeout, _countof(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
- db_set_s(0, MODULENAME, "timeoutSR", getTimeout);
+ g_plugin.setString("timeoutSR", getTimeout);
break;
}
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index 7388d55bb2..c44f546ffe 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -9,8 +9,8 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) LPSTR out = (LPSTR)mir_alloc(len * 2);
LPSTR buf = out;
- WORD msg_id = db_get_w(0, MODULENAME, "msgid", 0) + 1;
- db_set_w(0, MODULENAME, "msgid", msg_id);
+ WORD msg_id = g_plugin.getWord("msgid", 0) + 1;
+ g_plugin.setWord("msgid", msg_id);
size_t part_all = (len + iLen - 1) / iLen;
for (size_t part_num = 0; part_num<part_all; part_num++) {
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 307cc38921..1663cc6aec 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -151,8 +151,8 @@ void sttGenerateRSA(LPVOID) mir_exp->rsa_gen_keypair(CPP_MODE_RSA_4096);
mir_exp->rsa_get_keypair(CPP_MODE_RSA_4096, (PBYTE)&priv_key, &priv_len, (PBYTE)&pub_key, &pub_len);
- db_set_blob(NULL, MODULENAME, "rsa_priv", priv_key, priv_len);
- db_set_blob(NULL, MODULENAME, "rsa_pub", pub_key, pub_len);
+ db_set_blob(0, MODULENAME, "rsa_priv", priv_key, priv_len);
+ db_set_blob(0, MODULENAME, "rsa_pub", pub_key, pub_len);
rsa_4096 = 1;
}
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 750f8ee3a8..befb0be96e 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -34,7 +34,7 @@ char* BuildSetting(int historyLast) void HistoryWrite(MCONTACT hContact)
{
- int historyMax = db_get_w(NULL, S_MOD, "HistoryMax", 10);
+ int historyMax = db_get_w(0, S_MOD, "HistoryMax", 10);
if (historyMax < 0)
historyMax = 0;
else if (historyMax > 99)
@@ -68,7 +68,7 @@ void HistoryWrite(MCONTACT hContact) void LoadHistoryList(MCONTACT hContact, HWND hwnd, int nList)
{
SendDlgItemMessage(hwnd, nList, LB_RESETCONTENT, 0, 0);
- int historyMax = db_get_w(NULL, S_MOD, "HistoryMax", 10);
+ int historyMax = db_get_w(0, S_MOD, "HistoryMax", 10);
if (historyMax < 0)
historyMax = 0;
else if (historyMax > 99)
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 12f4ab156b..0882cee00f 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -69,13 +69,13 @@ void UninitHistoryDialog(void); static int MainInit(WPARAM, LPARAM)
{
- if (g_bFileActive = db_get_b(NULL, S_MOD, "FileOutput", 0))
+ if (g_bFileActive = db_get_b(0, S_MOD, "FileOutput", 0))
InitFileOutput();
- if (db_get_b(NULL, S_MOD, "MenuItem", 1))
+ if (db_get_b(0, S_MOD, "MenuItem", 1))
InitMenuitem();
- if (db_get_b(NULL, S_MOD, "UserinfoTab", 1))
+ if (db_get_b(0, S_MOD, "UserinfoTab", 1))
ehuserinfo = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit);
if (ServiceExists(MS_TIPPER_ADDTRANSLATION))
@@ -102,9 +102,9 @@ int CMPlugin::Load() HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues);
HookEvent(ME_PROTO_ACK, ModeChange);
- includeIdle = (BOOL)db_get_b(NULL, S_MOD, "IdleSupport", 1);
+ includeIdle = (BOOL)db_get_b(0, S_MOD, "IdleSupport", 1);
- if (db_get_b(NULL, S_MOD, "MissedOnes", 0))
+ if (db_get_b(0, S_MOD, "MissedOnes", 0))
ehmissed_proto = HookEvent(ME_PROTO_ACK, ModeChange_mo);
LoadWatchedProtos();
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 7127318474..40c673ce79 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -37,7 +37,7 @@ INT_PTR MenuitemClicked(WPARAM hContact, LPARAM) int BuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = GetContactProto(hContact);
- if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(NULL, S_MOD, "MenuItem", 1)) {
+ if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(0, S_MOD, "MenuItem", 1)) {
Menu_ShowItem(hmenuitem, false);
return 0;
}
@@ -57,7 +57,7 @@ int BuildContactMenu(WPARAM hContact, LPARAM) else
flags |= CMIF_HIDDEN;
}
- else if (db_get_b(NULL, S_MOD, "ShowIcon", 1)) {
+ else if (db_get_b(0, S_MOD, "ShowIcon", 1)) {
int isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1);
hIcon = Skin_LoadProtoIcon(szProto, isetting | 0x8000);
}
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index aef95a6350..b39024baa0 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -108,7 +108,7 @@ int ShowMissed(void) CMStringW buf;
for (int loop = 0; loop < mcs.count; loop++) {
buf.Append(Clist_GetContactDisplayName(mcs.wpcontact[loop]));
- if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0))
+ if (db_get_b(0, S_MOD, "MissedOnes_Count", 0))
buf.AppendFormat(L" [%i]", mcs.times[loop]);
buf.AppendChar('\n');
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 4dc20f51ec..f9bf061943 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -97,7 +97,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp ShowWindow(GetDlgItem(hdlg, IDC_LABTEXT), hasPopups ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_LABTTITLE), hasPopups ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups ? SW_SHOW : SW_HIDE);
- CheckDlgButton(hdlg, IDC_POPUPS, (db_get_b(NULL, S_MOD, "UsePopups", 0) & hasPopups) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_POPUPS, (db_get_b(0, S_MOD, "UsePopups", 0) & hasPopups) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hdlg, IDC_POPUPS), hasPopups);
hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS);
EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups);
@@ -105,7 +105,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
char szSetting[100];
mir_snprintf(szSetting, "Col_%d", i - ID_STATUS_OFFLINE);
- DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[i - ID_STATUS_OFFLINE]);
+ DWORD sett = db_get_dw(0, S_MOD, szSetting, StatusColors15bits[i - ID_STATUS_OFFLINE]);
COLORREF back, text;
GetColorsFromDWord(&back, &text, sett);
@@ -187,14 +187,14 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "PopupStamp", szstamp);
+ db_set_ws(0, S_MOD, "PopupStamp", szstamp);
GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "PopupStampText", szstamp);
+ db_set_ws(0, S_MOD, "PopupStampText", szstamp);
bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_POPUPS);
- if (db_get_b(NULL, S_MOD, "UsePopups", 0) != bchecked)
- db_set_b(NULL, S_MOD, "UsePopups", bchecked);
+ if (db_get_b(0, S_MOD, "UsePopups", 0) != bchecked)
+ db_set_b(0, S_MOD, "UsePopups", bchecked);
for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
COLORREF back = SendDlgItemMessage(hdlg, i, CPM_GETCOLOUR, 0, 0);
@@ -204,7 +204,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp char szSetting[100];
mir_snprintf(szSetting, "Col_%d", i - ID_STATUS_OFFLINE);
if (sett != StatusColors15bits[i - ID_STATUS_OFFLINE])
- db_set_dw(NULL, S_MOD, szSetting, sett);
+ db_set_dw(0, S_MOD, szSetting, sett);
else
db_unset(NULL, S_MOD, szSetting);
}
@@ -227,15 +227,15 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- CheckDlgButton(hdlg, IDC_MENUITEM, db_get_b(NULL, S_MOD, "MenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_USERINFO, db_get_b(NULL, S_MOD, "UserinfoTab", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_MENUITEM, db_get_b(0, S_MOD, "MenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_USERINFO, db_get_b(0, S_MOD, "UserinfoTab", 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg, IDC_FILE, g_bFileActive ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_HISTORY, db_get_b(NULL, S_MOD, "KeepHistory", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_IGNOREOFFLINE, db_get_b(NULL, S_MOD, "IgnoreOffline", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_MISSEDONES, db_get_b(NULL, S_MOD, "MissedOnes", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_SHOWICON, db_get_b(NULL, S_MOD, "ShowIcon", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_COUNT, db_get_b(NULL, S_MOD, "MissedOnes_Count", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_IDLESUPPORT, db_get_b(NULL, S_MOD, "IdleSupport", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_HISTORY, db_get_b(0, S_MOD, "KeepHistory", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_IGNOREOFFLINE, db_get_b(0, S_MOD, "IgnoreOffline", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_MISSEDONES, db_get_b(0, S_MOD, "MissedOnes", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_SHOWICON, db_get_b(0, S_MOD, "ShowIcon", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_COUNT, db_get_b(0, S_MOD, "MissedOnes_Count", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_IDLESUPPORT, db_get_b(0, S_MOD, "IdleSupport", 1) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hdlg, IDC_MENUSTAMP), IsDlgButtonChecked(hdlg, IDC_MENUITEM));
EnableWindow(GetDlgItem(hdlg, IDC_SHOWICON), IsDlgButtonChecked(hdlg, IDC_MENUITEM));
@@ -276,7 +276,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM }
else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, DEFAULT_HISTORYSTAMP);
- SetDlgItemInt(hdlg, IDC_HISTORYSIZE, db_get_w(NULL, S_MOD, "HistoryMax", 10 - 1) - 1, FALSE);
+ SetDlgItemInt(hdlg, IDC_HISTORYSIZE, db_get_w(0, S_MOD, "HistoryMax", 10 - 1) - 1, FALSE);
// load protocol list
SetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST), GWL_STYLE) | TVS_CHECKBOXES);
@@ -344,32 +344,32 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM switch (((LPNMHDR)lparam)->code) {
case PSN_APPLY:
GetDlgItemText(hdlg, IDC_MENUSTAMP, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "MenuStamp", szstamp);
+ db_set_ws(0, S_MOD, "MenuStamp", szstamp);
GetDlgItemText(hdlg, IDC_USERSTAMP, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "UserStamp", szstamp);
+ db_set_ws(0, S_MOD, "UserStamp", szstamp);
GetDlgItemText(hdlg, IDC_FILESTAMP, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "FileStamp", szstamp);
+ db_set_ws(0, S_MOD, "FileStamp", szstamp);
GetDlgItemText(hdlg, IDC_FILENAME, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "FileName", szstamp);
+ db_set_ws(0, S_MOD, "FileName", szstamp);
GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, _countof(szstamp));
- db_set_ws(NULL, S_MOD, "HistoryStamp", szstamp);
+ db_set_ws(0, S_MOD, "HistoryStamp", szstamp);
- db_set_w(NULL, S_MOD, "HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, nullptr, FALSE) + 1));
+ db_set_w(0, S_MOD, "HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, nullptr, FALSE) + 1));
BOOL bchecked = IsDlgButtonChecked(hdlg, IDC_MENUITEM);
- if (db_get_b(NULL, S_MOD, "MenuItem", 1) != bchecked) {
- db_set_b(NULL, S_MOD, "MenuItem", bchecked);
+ if (db_get_b(0, S_MOD, "MenuItem", 1) != bchecked) {
+ db_set_b(0, S_MOD, "MenuItem", bchecked);
if (hmenuitem == nullptr && bchecked)
InitMenuitem();
}
bchecked = IsDlgButtonChecked(hdlg, IDC_USERINFO);
- if (db_get_b(NULL, S_MOD, "UserinfoTab", 1) != bchecked) {
- db_set_b(NULL, S_MOD, "UserinfoTab", bchecked);
+ if (db_get_b(0, S_MOD, "UserinfoTab", 1) != bchecked) {
+ db_set_b(0, S_MOD, "UserinfoTab", bchecked);
if (bchecked)
ehuserinfo = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit);
else
@@ -379,7 +379,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM bchecked = IsDlgButtonChecked(hdlg, IDC_FILE);
if (g_bFileActive != bchecked) {
g_bFileActive = bchecked;
- db_set_b(NULL, S_MOD, "FileOutput", bchecked);
+ db_set_b(0, S_MOD, "FileOutput", bchecked);
if (bchecked)
InitFileOutput();
else
@@ -387,16 +387,16 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM }
bchecked = IsDlgButtonChecked(hdlg, IDC_HISTORY);
- if (db_get_b(NULL, S_MOD, "KeepHistory", 0) != bchecked)
- db_set_b(NULL, S_MOD, "KeepHistory", bchecked);
+ if (db_get_b(0, S_MOD, "KeepHistory", 0) != bchecked)
+ db_set_b(0, S_MOD, "KeepHistory", bchecked);
bchecked = IsDlgButtonChecked(hdlg, IDC_IGNOREOFFLINE);
- if (db_get_b(NULL, S_MOD, "IgnoreOffline", 1) != bchecked)
- db_set_b(NULL, S_MOD, "IgnoreOffline", bchecked);
+ if (db_get_b(0, S_MOD, "IgnoreOffline", 1) != bchecked)
+ db_set_b(0, S_MOD, "IgnoreOffline", bchecked);
bchecked = IsDlgButtonChecked(hdlg, IDC_MISSEDONES);
- if (db_get_b(NULL, S_MOD, "MissedOnes", 0) != bchecked) {
- db_set_b(NULL, S_MOD, "MissedOnes", bchecked);
+ if (db_get_b(0, S_MOD, "MissedOnes", 0) != bchecked) {
+ db_set_b(0, S_MOD, "MissedOnes", bchecked);
if (bchecked)
ehmissed_proto = HookEvent(ME_PROTO_ACK, ModeChange_mo);
else
@@ -404,16 +404,16 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM }
bchecked = IsDlgButtonChecked(hdlg, IDC_SHOWICON);
- if (db_get_b(NULL, S_MOD, "ShowIcon", 1) != bchecked)
- db_set_b(NULL, S_MOD, "ShowIcon", bchecked);
+ if (db_get_b(0, S_MOD, "ShowIcon", 1) != bchecked)
+ db_set_b(0, S_MOD, "ShowIcon", bchecked);
bchecked = IsDlgButtonChecked(hdlg, IDC_COUNT);
- if (db_get_b(NULL, S_MOD, "MissedOnes_Count", 0) != bchecked)
- db_set_b(NULL, S_MOD, "MissedOnes_Count", bchecked);
+ if (db_get_b(0, S_MOD, "MissedOnes_Count", 0) != bchecked)
+ db_set_b(0, S_MOD, "MissedOnes_Count", bchecked);
includeIdle = IsDlgButtonChecked(hdlg, IDC_IDLESUPPORT);
- if (db_get_b(NULL, S_MOD, "IdleSupport", 1) != includeIdle)
- db_set_b(NULL, S_MOD, "IdleSupport", (BYTE)includeIdle);
+ if (db_get_b(0, S_MOD, "IdleSupport", 1) != includeIdle)
+ db_set_b(0, S_MOD, "IdleSupport", (BYTE)includeIdle);
// save protocol list
HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST);
@@ -439,7 +439,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM }
hItem = TreeView_GetNextSibling(hwndTreeView, hItem);
}
- db_set_s(NULL, S_MOD, "WatchedAccounts", watchedProtocols);
+ db_set_s(0, S_MOD, "WatchedAccounts", watchedProtocols);
UnloadWatchedProtos();
LoadWatchedProtos();
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 4a74383b56..626b77ba3a 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -33,7 +33,7 @@ void LoadWatchedProtos() if (szProtosOld != NULL) {
CMStringA tmp(szProtosOld);
tmp.Replace(" ", "\n");
- db_set_s(NULL, S_MOD, "WatchedAccounts", tmp.c_str());
+ db_set_s(0, S_MOD, "WatchedAccounts", tmp.c_str());
db_unset(NULL, S_MOD, "WatchedProtocols");
}
@@ -471,13 +471,13 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus) if (!ServiceExists(MS_POPUP_QUERY))
return;
- if (!db_get_b(NULL, S_MOD, "UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0))
+ if (!db_get_b(0, S_MOD, "UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0))
return;
DBVARIANT dbv;
char szSetting[10];
mir_snprintf(szSetting, "Col_%d", newStatus - ID_STATUS_OFFLINE);
- DWORD sett = db_get_dw(NULL, S_MOD, szSetting, StatusColors15bits[newStatus - ID_STATUS_OFFLINE]);
+ DWORD sett = db_get_dw(0, S_MOD, szSetting, StatusColors15bits[newStatus - ID_STATUS_OFFLINE]);
POPUPDATAT ppd = { 0 };
GetColorsFromDWord(&ppd.colorBack, &ppd.colorText, sett);
@@ -582,24 +582,24 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) char str[MAXMODULELABELLENGTH + 9];
mir_snprintf(str, "OffTime-%s", szProto);
- DWORD t = db_get_dw(NULL, S_MOD, str, 0);
+ DWORD t = db_get_dw(0, S_MOD, str, 0);
if (!t)
t = time(0);
DBWriteTimeTS(t, hContact);
}
- if (!db_get_b(NULL, S_MOD, "IgnoreOffline", 1)) {
+ if (!db_get_b(0, S_MOD, "IgnoreOffline", 1)) {
if (g_bFileActive)
FileWrite(hContact);
char *sProto = GetContactProto(hContact);
if (Proto_GetStatus(sProto) > ID_STATUS_OFFLINE) {
myPlaySound(hContact, ID_STATUS_OFFLINE, prevStatus);
- if (db_get_b(NULL, S_MOD, "UsePopups", 0))
+ if (db_get_b(0, S_MOD, "UsePopups", 0))
ShowPopup(hContact, sProto, ID_STATUS_OFFLINE);
}
- if (db_get_b(NULL, S_MOD, "KeepHistory", 0))
+ if (db_get_b(0, S_MOD, "KeepHistory", 0))
HistoryWrite(hContact);
if (db_get_b(hContact, S_MOD, "OnlineAlert", 0))
@@ -615,11 +615,11 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if (g_bFileActive) FileWrite(hContact);
if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus);
- if (db_get_b(NULL, S_MOD, "UsePopups", 0))
+ if (db_get_b(0, S_MOD, "UsePopups", 0))
if (prevStatus != cws->value.wVal)
ShowPopup(hContact, GetContactProto(hContact), cws->value.wVal | 0x8000);
- if (db_get_b(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact);
+ if (db_get_b(0, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact);
if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) ShowHistory(hContact, 1);
db_set_b(hContact, S_MOD, "Offline", 0);
}
@@ -685,7 +685,7 @@ int ModeChange(WPARAM, LPARAM lparam) isetting = ID_STATUS_OFFLINE;
if ((isetting > ID_STATUS_OFFLINE) && ((UINT_PTR)ack->hProcess <= ID_STATUS_OFFLINE)) {
//we have just loged-in
- db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
+ db_set_dw(0, "UserOnline", ack->szModule, GetTickCount());
if (!Miranda_IsTerminated() && IsWatchedProtocol(ack->szModule)) {
logthread_info *info = (logthread_info *)mir_alloc(sizeof(logthread_info));
mir_strncpy(info->sProtoName, courProtoName, _countof(info->sProtoName));
@@ -703,14 +703,14 @@ int ModeChange(WPARAM, LPARAM lparam) time(&t);
mir_snprintf(str, "OffTime-%s", ack->szModule);
- db_set_dw(NULL, S_MOD, str, t);
+ db_set_dw(0, S_MOD, str, t);
}
}
- if (isetting == db_get_w(NULL, S_MOD, courProtoName, ID_STATUS_OFFLINE))
+ if (isetting == db_get_w(0, S_MOD, courProtoName, ID_STATUS_OFFLINE))
return 0;
- db_set_w(NULL, S_MOD, courProtoName, isetting);
+ db_set_w(0, S_MOD, courProtoName, isetting);
if (g_bFileActive)
FileWrite(NULL);
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 9b7efd9d0c..2a56920e60 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -715,52 +715,52 @@ TfrmMain::~TfrmMain() void TfrmMain::LoadOptions(void) { - DWORD rgb = db_get_dw(NULL, MODULENAME, "AlphaColor", 16777215); + DWORD rgb = g_plugin.getDword("AlphaColor", 16777215); m_AlphaColor.rgbRed = GetRValue(rgb); m_AlphaColor.rgbGreen = GetGValue(rgb); m_AlphaColor.rgbBlue = GetBValue(rgb); m_AlphaColor.rgbReserved = 0; - m_opt_edtQuality = db_get_b(NULL, MODULENAME, "JpegQuality", 75); + m_opt_edtQuality = g_plugin.getByte("JpegQuality", 75); - m_opt_tabCapture = db_get_b(NULL, MODULENAME, "Capture", 0); - m_opt_chkIndirectCapture = db_get_b(NULL, MODULENAME, "IndirectCapture", 0); - m_opt_chkClientArea = db_get_b(NULL, MODULENAME, "ClientArea", 0); - m_opt_cboxDesktop = db_get_b(NULL, MODULENAME, "Desktop", 0); + m_opt_tabCapture = g_plugin.getByte("Capture", 0); + m_opt_chkIndirectCapture = g_plugin.getByte("IndirectCapture", 0); + m_opt_chkClientArea = g_plugin.getByte("ClientArea", 0); + m_opt_cboxDesktop = g_plugin.getByte("Desktop", 0); - m_opt_chkTimed = db_get_b(NULL, MODULENAME, "TimedCap", 0); - m_opt_edtTimed = db_get_b(NULL, MODULENAME, "CapTime", 3); - m_opt_cboxFormat = db_get_b(NULL, MODULENAME, "OutputFormat", 0); - m_opt_cboxSendBy = db_get_b(NULL, MODULENAME, "SendBy", 0); + m_opt_chkTimed = g_plugin.getByte("TimedCap", 0); + m_opt_edtTimed = g_plugin.getByte("CapTime", 3); + m_opt_cboxFormat = g_plugin.getByte("OutputFormat", 0); + m_opt_cboxSendBy = g_plugin.getByte("SendBy", 0); - m_opt_btnDesc = db_get_b(NULL, MODULENAME, "AutoDescription", 1); - m_opt_btnDeleteAfterSend = db_get_b(NULL, MODULENAME, "DelAfterSend", 1) != 0; - m_opt_chkEditor = db_get_b(NULL, MODULENAME, "Preview", 0); - m_opt_chkOpenAgain = db_get_b(NULL, MODULENAME, "OpenAgain", 0); + m_opt_btnDesc = g_plugin.getByte("AutoDescription", 1); + m_opt_btnDeleteAfterSend = g_plugin.getByte("DelAfterSend", 1) != 0; + m_opt_chkEditor = g_plugin.getByte("Preview", 0); + m_opt_chkOpenAgain = g_plugin.getByte("OpenAgain", 0); } void TfrmMain::SaveOptions(void) { if (m_bOnExitSave) { - db_set_dw(NULL, MODULENAME, "AlphaColor", + g_plugin.setDword("AlphaColor", (DWORD)RGB(m_AlphaColor.rgbRed, m_AlphaColor.rgbGreen, m_AlphaColor.rgbBlue)); - db_set_b(NULL, MODULENAME, "JpegQuality", m_opt_edtQuality); + g_plugin.setByte("JpegQuality", m_opt_edtQuality); - db_set_b(NULL, MODULENAME, "Capture", m_opt_tabCapture); - db_set_b(NULL, MODULENAME, "IndirectCapture", m_opt_chkIndirectCapture); - db_set_b(NULL, MODULENAME, "ClientArea", m_opt_chkClientArea); - db_set_b(NULL, MODULENAME, "Desktop", m_opt_cboxDesktop); + g_plugin.setByte("Capture", m_opt_tabCapture); + g_plugin.setByte("IndirectCapture", m_opt_chkIndirectCapture); + g_plugin.setByte("ClientArea", m_opt_chkClientArea); + g_plugin.setByte("Desktop", m_opt_cboxDesktop); - db_set_b(NULL, MODULENAME, "TimedCap", m_opt_chkTimed); - db_set_b(NULL, MODULENAME, "CapTime", m_opt_edtTimed); - db_set_b(NULL, MODULENAME, "OutputFormat", m_opt_cboxFormat); - db_set_b(NULL, MODULENAME, "SendBy", m_opt_cboxSendBy); + g_plugin.setByte("TimedCap", m_opt_chkTimed); + g_plugin.setByte("CapTime", m_opt_edtTimed); + g_plugin.setByte("OutputFormat", m_opt_cboxFormat); + g_plugin.setByte("SendBy", m_opt_cboxSendBy); - db_set_b(NULL, MODULENAME, "AutoDescription", m_opt_btnDesc); - db_set_b(NULL, MODULENAME, "DelAfterSend", m_opt_btnDeleteAfterSend); - db_set_b(NULL, MODULENAME, "Preview", m_opt_chkEditor); - db_set_b(NULL, MODULENAME, "OpenAgain", m_opt_chkOpenAgain); + g_plugin.setByte("AutoDescription", m_opt_btnDesc); + g_plugin.setByte("DelAfterSend", m_opt_btnDeleteAfterSend); + g_plugin.setByte("Preview", m_opt_chkEditor); + g_plugin.setByte("OpenAgain", m_opt_chkOpenAgain); } } @@ -935,7 +935,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) return 1; // generate file name - unsigned FileNumber = db_get_dw(NULL, MODULENAME, "FileNumber", 0) + 1; + unsigned FileNumber = g_plugin.getDword("FileNumber", 0) + 1; if (FileNumber > 99999) FileNumber = 1; @@ -1023,7 +1023,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP *dib) if (!ret) return 1; - db_set_dw(NULL, MODULENAME, "FileNumber", FileNumber); + g_plugin.setDword("FileNumber", FileNumber); replaceStrW(m_pszFile, wszFileName); if (!IsWindowEnabled(GetDlgItem(m_hWnd, ID_chkDesc)) || !m_opt_btnDesc) diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index 5603dca892..1eb23a1c59 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -654,8 +654,8 @@ INT_PTR MsgBoxService(WPARAM, LPARAM lParam) if (!(pMsgBox->uType & (MB_INFOBAR | MB_NOPOPUP)) // message box can be a popup? && ServiceExists(MS_POPUP_ADDPOPUPT) // popups exist? && myGlobals.PopupActionsExist == 1 // popup support ext stuct? - && (db_get_dw(NULL, "Popup", "Actions", 0) & 1) // popup++ actions on? - && db_get_b(NULL, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups? + && (db_get_dw(0, "Popup", "Actions", 0) & 1) // popup++ actions on? + && db_get_b(0, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups? return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam); return DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam); diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index defae68111..4498daeb9b 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -95,13 +95,13 @@ INT_PTR CALLBACK ExitDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) SavePosition(hdlg, "ExitDlg");
SaveSessionDate();
SaveSessionHandles(0, 0);
- db_set_b(NULL, MODULENAME, "lastempty", 0);
+ g_plugin.setByte("lastempty", 0);
DestroyWindow(hdlg);
break;
case IDCANCEL:
SavePosition(hdlg, "ExitDlg");
- db_set_b(NULL, MODULENAME, "lastempty", 1);
+ g_plugin.setByte("lastempty", 1);
DestroyWindow(hdlg);
break;
}
@@ -261,7 +261,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
{
- int iDelay = db_get_w(NULL, MODULENAME, "StartupModeDelay", 1500);
+ int iDelay = g_plugin.getWord("StartupModeDelay", 1500);
if (g_hghostw == TRUE)
SetTimer(hdlg, TIMERID_LOAD, iDelay, nullptr);
else {
@@ -426,7 +426,7 @@ int SaveSessionHandles(WPARAM, LPARAM lparam) }
if (lparam == 1) {
g_ses_count++;
- db_set_b(0, MODULENAME, "UserSessionsCount", (BYTE)g_ses_count);
+ g_plugin.setByte("UserSessionsCount", (BYTE)g_ses_count);
}
return 0;
}
@@ -450,8 +450,8 @@ INT_PTR OpenSessionsManagerWindow(WPARAM, LPARAM) }
ptrW
- tszSession(db_get_wsa(NULL, MODULENAME, "SessionDate_0")),
- tszUserSession(db_get_wsa(NULL, MODULENAME, "UserSessionDsc_0"));
+ tszSession(g_plugin.getWStringA("SessionDate_0")),
+ tszUserSession(g_plugin.getWStringA("UserSessionDsc_0"));
if (g_bIncompletedSave || tszSession || tszUserSession) {
g_hDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
return 0;
@@ -479,9 +479,9 @@ int SaveSessionDate() char szSetting[256];
mir_snprintf(szSetting, "%s_%d", "SessionDate", 0);
- wchar_t *ptszSaveSessionDate = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *ptszSaveSessionDate = g_plugin.getWStringA(szSetting);
- db_set_ws(NULL, MODULENAME, szSetting, szSessionTime);
+ g_plugin.setWString(szSetting, szSessionTime);
mir_free(szSessionTime);
if (ptszSaveSessionDate)
@@ -493,7 +493,7 @@ int SaveSessionDate() mir_free(szDateBuf);
}
if (g_bCrashRecovery)
- db_set_b(NULL, MODULENAME, "lastSaveCompleted", 1);
+ g_plugin.setByte("lastSaveCompleted", 1);
return 0;
}
@@ -504,11 +504,11 @@ int SaveUserSessionName(wchar_t *szUSessionName) char szSetting[256];
mir_snprintf(szSetting, "%s_%u", "UserSessionDsc", 0);
- wchar_t *ptszUserSessionName = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *ptszUserSessionName = g_plugin.getWStringA(szSetting);
if (ptszUserSessionName)
ResaveSettings("UserSessionDsc", 1, 255, ptszUserSessionName);
- db_set_ws(NULL, MODULENAME, szSetting, szUSessionName);
+ g_plugin.setWString(szSetting, szUSessionName);
return 0;
}
@@ -590,30 +590,30 @@ int DelUserDefSession(int ses_count) char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", ses_count);
- db_unset(NULL, MODULENAME, szSessionName);
+ g_plugin.delSetting(szSessionName);
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", ses_count);
- db_unset(NULL, MODULENAME, szSessionName);
+ g_plugin.delSetting(szSessionName);
for (int i = ses_count + 1;; i++) {
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", i);
- ptrW szSessionNameBuf(db_get_wsa(NULL, MODULENAME, szSessionName));
+ ptrW szSessionNameBuf(g_plugin.getWStringA(szSessionName));
mir_snprintf(szSessionName, "%s_%u", "UserSessionDsc", i - 1);
if (szSessionNameBuf) {
MarkUserDefSession(i - 1, IsMarkedUserDefSession(i));
- db_set_ws(NULL, MODULENAME, szSessionName, szSessionNameBuf);
+ g_plugin.setWString(szSessionName, szSessionNameBuf);
}
else {
- db_unset(NULL, MODULENAME, szSessionName);
+ g_plugin.delSetting(szSessionName);
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", i - 1);
- db_unset(NULL, MODULENAME, szSessionName);
+ g_plugin.delSetting(szSessionName);
break;
}
}
g_ses_count--;
- db_set_b(0, MODULENAME, "UserSessionsCount", (BYTE)g_ses_count);
+ g_plugin.setByte("UserSessionsCount", (BYTE)g_ses_count);
return 0;
}
@@ -626,17 +626,17 @@ int DeleteAutoSession(int ses_count) char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "SessionDate", ses_count);
- db_unset(NULL, MODULENAME, szSessionName);
+ g_plugin.delSetting(szSessionName);
for (int i = ses_count + 1;; i++) {
mir_snprintf(szSessionName, "%s_%u", "SessionDate", i);
- ptrW szSessionNameBuf(db_get_wsa(NULL, MODULENAME, szSessionName));
+ ptrW szSessionNameBuf(g_plugin.getWStringA(szSessionName));
mir_snprintf(szSessionName, "%s_%u", "SessionDate", i - 1);
if (szSessionNameBuf)
- db_set_ws(NULL, MODULENAME, szSessionName, szSessionNameBuf);
+ g_plugin.setWString(szSessionName, szSessionNameBuf);
else {
- db_unset(NULL, MODULENAME, szSessionName);
+ g_plugin.delSetting(szSessionName);
break;
}
}
@@ -651,23 +651,23 @@ int SessionPreShutdown(WPARAM, LPARAM) if (g_hDlg) DestroyWindow(g_hDlg);
if (g_hSDlg) DestroyWindow(g_hSDlg);
- db_set_b(NULL, MODULENAME, "lastSaveCompleted", 1);
+ g_plugin.setByte("lastSaveCompleted", 1);
return 0;
}
int OkToExit(WPARAM, LPARAM)
{
- int exitmode = db_get_b(NULL, MODULENAME, "ShutdownMode", 2);
+ int exitmode = g_plugin.getByte("ShutdownMode", 2);
DONT = 1;
if (exitmode == 2 && session_list[0] != 0) {
SaveSessionDate();
SaveSessionHandles(0, 0);
- db_set_b(NULL, MODULENAME, "lastempty", 0);
+ g_plugin.setByte("lastempty", 0);
}
else if (exitmode == 1 && session_list[0] != 0) {
DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXDIALOG), nullptr, ExitDlgProc);
}
- else db_set_b(NULL, MODULENAME, "lastempty", 1);
+ else g_plugin.setByte("lastempty", 1);
return 0;
}
@@ -731,7 +731,7 @@ static int CreateButtons(WPARAM, LPARAM) static void CALLBACK LaunchSessions()
{
- int startup = db_get_b(NULL, MODULENAME, "StartupMode", 3);
+ int startup = g_plugin.getByte("StartupMode", 3);
if (startup == 1 || (startup == 3 && isLastTRUE == TRUE)) {
StartUp = TRUE;
g_hDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_WLCMDIALOG), nullptr, LoadSessionDlgProc);
@@ -815,15 +815,15 @@ int CMPlugin::Load() Miranda_WaitOnHandle(LaunchSessions);
- g_ses_count = db_get_b(NULL, MODULENAME, "UserSessionsCount", 0);
- g_ses_limit = db_get_b(NULL, MODULENAME, "TrackCount", 10);
- g_bExclHidden = db_get_b(NULL, MODULENAME, "ExclHidden", 0) != 0;
- g_bWarnOnHidden = db_get_b(NULL, MODULENAME, "WarnOnHidden", 0) != 0;
- g_bOtherWarnings = db_get_b(NULL, MODULENAME, "OtherWarnings", 1) != 0;
- g_bCrashRecovery = db_get_b(NULL, MODULENAME, "CrashRecovery", 0) != 0;
+ g_ses_count = g_plugin.getByte("UserSessionsCount", 0);
+ g_ses_limit = g_plugin.getByte("TrackCount", 10);
+ g_bExclHidden = g_plugin.getByte("ExclHidden", 0) != 0;
+ g_bWarnOnHidden = g_plugin.getByte("WarnOnHidden", 0) != 0;
+ g_bOtherWarnings = g_plugin.getByte("OtherWarnings", 1) != 0;
+ g_bCrashRecovery = g_plugin.getByte("CrashRecovery", 0) != 0;
if (g_bCrashRecovery)
- g_bIncompletedSave = db_get_b(NULL, MODULENAME, "lastSaveCompleted", 0) == 0;
+ g_bIncompletedSave = g_plugin.getByte("lastSaveCompleted", 0) == 0;
if (g_bIncompletedSave) {
int i = 0;
@@ -837,9 +837,9 @@ int CMPlugin::Load() if (!session_list_recovered[0])
g_bIncompletedSave = false;
- db_set_b(NULL, MODULENAME, "lastSaveCompleted", 0);
+ g_plugin.setByte("lastSaveCompleted", 0);
- if (!db_get_b(NULL, MODULENAME, "lastempty", 1) || g_bIncompletedSave)
+ if (!g_plugin.getByte("lastempty", 1) || g_bIncompletedSave)
isLastTRUE = true;
HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 6aab0f3f35..aaa987388a 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -160,19 +160,19 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l hIcon = (bChecked = IsMarkedUserDefSession(opses_count)) ? hMarked : hNotMarked;
- SetDlgItemInt(hdlg, IDC_TRACK, g_ses_limit = db_get_b(NULL, MODULENAME, "TrackCount", 10), FALSE);
+ SetDlgItemInt(hdlg, IDC_TRACK, g_ses_limit = g_plugin.getByte("TrackCount", 10), FALSE);
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE));
SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
- SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODULENAME, "StartupModeDelay", 1500), FALSE);
- int startupmode = db_get_b(NULL, MODULENAME, "StartupMode", 3);
- int exitmode = db_get_b(NULL, MODULENAME, "ShutdownMode", 2);
+ SetDlgItemInt(hdlg, IDC_STARTDELAY, g_plugin.getWord("StartupModeDelay", 1500), FALSE);
+ int startupmode = g_plugin.getByte("StartupMode", 3);
+ int exitmode = g_plugin.getByte("ShutdownMode", 2);
- g_bExclHidden = db_get_b(NULL, MODULENAME, "ExclHidden", 0) != 0;
- g_bWarnOnHidden = db_get_b(NULL, MODULENAME, "WarnOnHidden", 0) != 0;
- g_bOtherWarnings = db_get_b(NULL, MODULENAME, "OtherWarnings", 1) != 0;
- g_bCrashRecovery = db_get_b(NULL, MODULENAME, "CrashRecovery", 0) != 0;
+ g_bExclHidden = g_plugin.getByte("ExclHidden", 0) != 0;
+ g_bWarnOnHidden = g_plugin.getByte("WarnOnHidden", 0) != 0;
+ g_bOtherWarnings = g_plugin.getByte("OtherWarnings", 1) != 0;
+ g_bCrashRecovery = g_plugin.getByte("CrashRecovery", 0) != 0;
CheckDlgButton(hdlg, IDC_EXCLHIDDEN, g_bExclHidden ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg, IDC_LASTHIDDENWARN, g_bWarnOnHidden ? BST_CHECKED : BST_UNCHECKED);
@@ -242,30 +242,30 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l case PSN_APPLY:
{
int iDelay = GetDlgItemInt(hdlg, IDC_STARTDELAY, nullptr, FALSE);
- db_set_w(0, MODULENAME, "StartupModeDelay", (WORD)iDelay);
- db_set_b(0, MODULENAME, "TrackCount", (BYTE)(g_ses_limit = GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE)));
+ g_plugin.setWord("StartupModeDelay", (WORD)iDelay);
+ g_plugin.setByte("TrackCount", (BYTE)(g_ses_limit = GetDlgItemInt(hdlg, IDC_TRACK, nullptr, FALSE)));
if (IsDlgButtonChecked(hdlg, IDC_REXSAVE))
- db_set_b(NULL, MODULENAME, "ShutdownMode", 2);
+ g_plugin.setByte("ShutdownMode", 2);
else if (IsDlgButtonChecked(hdlg, IDC_REXDSAVE))
- db_set_b(NULL, MODULENAME, "ShutdownMode", 0);
+ g_plugin.setByte("ShutdownMode", 0);
else if (IsDlgButtonChecked(hdlg, IDC_REXASK))
- db_set_b(NULL, MODULENAME, "ShutdownMode", 1);
+ g_plugin.setByte("ShutdownMode", 1);
if (IsDlgButtonChecked(hdlg, IDC_STARTDIALOG)) {
if (BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
- db_set_b(NULL, MODULENAME, "StartupMode", 1);
+ g_plugin.setByte("StartupMode", 1);
else
- db_set_b(NULL, MODULENAME, "StartupMode", 3);
+ g_plugin.setByte("StartupMode", 3);
}
else if (IsDlgButtonChecked(hdlg, IDC_RLOADLAST))
- db_set_b(NULL, MODULENAME, "StartupMode", 2);
+ g_plugin.setByte("StartupMode", 2);
else if (IsDlgButtonChecked(hdlg, IDC_RNOTHING))
- db_set_b(NULL, MODULENAME, "StartupMode", 0);
+ g_plugin.setByte("StartupMode", 0);
- db_set_b(NULL, MODULENAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
- db_set_b(NULL, MODULENAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
- db_set_b(NULL, MODULENAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
- db_set_b(NULL, MODULENAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
+ g_plugin.setByte("ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
+ g_plugin.setByte("WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
+ g_plugin.setByte("OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
+ g_plugin.setByte("CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
}
return 1;
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 36bdeae375..4142bb80aa 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -231,8 +231,8 @@ BOOL ResaveSettings(char *szName, int iFirst, int iLimit, wchar_t *szBuffer) char szNameBuf[256];
mir_snprintf(szNameBuf, "%s_%u", szName, i);
- wchar_t *ptszTemp = db_get_wsa(NULL, MODULENAME, szNameBuf);
- db_set_ws(NULL, MODULENAME, szNameBuf, szBuffer);
+ wchar_t *ptszTemp = g_plugin.getWStringA(szNameBuf);
+ g_plugin.setWString(szNameBuf, szBuffer);
mir_free(szBuffer);
BYTE marked = IsMarkedUserDefSession(i);
@@ -298,7 +298,7 @@ int LoadSessionToCombobox(HWND hdlg, BOOL mode, int iLimit, char* pszSetting, in for (int i = 0; i < iLimit; i++) {
mir_snprintf(szBuffer, "%s_%u", pszSetting, i);
- wchar_t *pszBuffer = db_get_wsa(NULL, MODULENAME, szBuffer);
+ wchar_t *pszBuffer = g_plugin.getWStringA(szBuffer);
if (pszBuffer) {
if (!IsMarkedUserDefSession(i + iFirstNum) || mode == 1) {
index = SendDlgItemMessage(hdlg, IDC_LIST, CB_ADDSTRING, 0, (LPARAM)pszBuffer);
@@ -327,7 +327,7 @@ int FillFavoritesMenu(HMENU hMenu, int iLimit) if (IsMarkedUserDefSession(i)) {
char szBuffer[256];
mir_snprintf(szBuffer, "%s_%u", "UserSessionDsc", i);
- wchar_t *pszBuffer = db_get_wsa(NULL, MODULENAME, szBuffer);
+ wchar_t *pszBuffer = g_plugin.getWStringA(szBuffer);
if (pszBuffer) {
AppendMenu(hMenu, MF_STRING, i + 1, pszBuffer);
iItems++;
@@ -362,14 +362,14 @@ void RenameUserDefSession(int ses_count, wchar_t* ptszNewName) {
char szSession[256];
mir_snprintf(szSession, "%s_%u", "UserSessionDsc", ses_count);
- db_set_ws(NULL, MODULENAME, szSession, ptszNewName);
+ g_plugin.setWString(szSession, ptszNewName);
}
int MarkUserDefSession(int ses_count, BYTE bCheck)
{
char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", ses_count);
- db_set_b(NULL, MODULENAME, szSessionName, bCheck);
+ g_plugin.setByte(szSessionName, bCheck);
return 0;
}
@@ -377,7 +377,7 @@ BYTE IsMarkedUserDefSession(int ses_count) {
char szSessionName[256];
mir_snprintf(szSessionName, "%s_%u", "FavUserSession", ses_count);
- return db_get_b(NULL, MODULENAME, szSessionName, 0);
+ return g_plugin.getByte(szSessionName, 0);
}
void SavePosition(HWND hwnd, char *wndName)
@@ -386,17 +386,17 @@ void SavePosition(HWND hwnd, char *wndName) GetWindowRect(hwnd, &rc);
char buffer[512];
mir_snprintf(buffer, "%sPosX", wndName);
- db_set_dw(0, MODULENAME, buffer, rc.left);
+ g_plugin.setDword(buffer, rc.left);
mir_snprintf(buffer, "%sPosY", wndName);
- db_set_dw(0, MODULENAME, buffer, rc.top);
+ g_plugin.setDword(buffer, rc.top);
}
void LoadPosition(HWND hWnd, char *wndName)
{
char buffer[512];
mir_snprintf(buffer, "%sPosX", wndName);
- int x = db_get_dw(0, MODULENAME, buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2) - 130);
+ int x = g_plugin.getDword(buffer, ((GetSystemMetrics(SM_CXSCREEN)) / 2) - 130);
mir_snprintf(buffer, "%sPosY", wndName);
- int y = db_get_dw(0, MODULENAME, buffer, ((GetSystemMetrics(SM_CYSCREEN)) / 2) - 80);
+ int y = g_plugin.getDword(buffer, ((GetSystemMetrics(SM_CYSCREEN)) / 2) - 80);
SetWindowPos(hWnd, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOSIZE);
}
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 4b96392d79..8744d20e6f 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -55,8 +55,8 @@ CMPlugin::CMPlugin() : INT_PTR ToggleEnable(WPARAM, LPARAM)
{
- BOOL fEnabled = !db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
- db_set_b(NULL, MODULENAME, KEY_ENABLED, fEnabled);
+ BOOL fEnabled = !g_plugin.getByte(KEY_ENABLED, 1);
+ g_plugin.setByte(KEY_ENABLED, fEnabled);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
@@ -90,12 +90,12 @@ INT OnPreBuildContactMenu(WPARAM hContact, LPARAM) INT CheckDefaults(WPARAM, LPARAM)
{
- interval = db_get_w(NULL, MODULENAME, KEY_REPEATINTERVAL, 300);
+ interval = g_plugin.getWord(KEY_REPEATINTERVAL, 300);
- wchar_t *ptszVal = db_get_wsa(NULL, MODULENAME, KEY_HEADING);
+ wchar_t *ptszVal = g_plugin.getWStringA(KEY_HEADING);
if (ptszVal == nullptr)
// Heading not set
- db_set_ws(NULL, MODULENAME, KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
+ g_plugin.setWString(KEY_HEADING, TranslateT("Dear %user%, the owner left the following message:"));
else
mir_free(ptszVal);
@@ -105,7 +105,7 @@ INT CheckDefaults(WPARAM, LPARAM) else {
char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", c);
- ptszVal = db_get_wsa(NULL, MODULENAME, szStatus);
+ ptszVal = g_plugin.getWStringA(szStatus);
if (ptszVal == nullptr) {
wchar_t *ptszDefault;
if (c < ID_STATUS_FREECHAT)
@@ -116,7 +116,7 @@ INT CheckDefaults(WPARAM, LPARAM) else
ptszDefault = nullptr;
if (ptszDefault)
- db_set_ws(NULL, MODULENAME, szStatus, TranslateW(ptszDefault));
+ g_plugin.setWString(szStatus, TranslateW(ptszDefault));
}
else
mir_free(ptszVal);
@@ -126,7 +126,7 @@ INT CheckDefaults(WPARAM, LPARAM) if (ServiceExists(MS_VARS_FORMATSTRING))
gbVarsServiceExist = TRUE;
- BOOL fEnabled = db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
+ BOOL fEnabled = g_plugin.getByte(KEY_ENABLED, 1);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
else
@@ -136,7 +136,7 @@ INT CheckDefaults(WPARAM, LPARAM) INT addEvent(WPARAM hContact, LPARAM hDBEvent)
{
- BOOL fEnabled = db_get_b(NULL, MODULENAME, KEY_ENABLED, 1);
+ BOOL fEnabled = g_plugin.getByte(KEY_ENABLED, 1);
if (!fEnabled || !hContact || !hDBEvent)
return FALSE; /// unspecifyed error
@@ -180,7 +180,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) char szStatus[6] = { 0 };
mir_snprintf(szStatus, "%d", status);
- ptszVal = db_get_wsa(NULL, MODULENAME, szStatus);
+ ptszVal = g_plugin.getWStringA(szStatus);
if (ptszVal) {
if (*ptszVal) {
CMStringW ptszTemp;
@@ -193,7 +193,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) msgLen += mir_wstrlen(ptszVal);
- wchar_t *ptszHead = db_get_wsa(NULL, MODULENAME, KEY_HEADING);
+ wchar_t *ptszHead = g_plugin.getWStringA(KEY_HEADING);
if (ptszHead != nullptr) {
ptszTemp = ptszHead;
ptszTemp.Replace(L"%user%", ptszNick);
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index 42fefe82aa..6fd17f3adb 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -11,11 +11,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara {
char tszStatus[6] = { 0 };
- CheckDlgButton(hwndDlg, IDC_ENABLEREPLIER, db_get_b(NULL, MODULENAME, KEY_ENABLED, 1) == 1 ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_INTERVAL, db_get_w(NULL, MODULENAME, KEY_REPEATINTERVAL, 300) / 60, FALSE);
+ CheckDlgButton(hwndDlg, IDC_ENABLEREPLIER, g_plugin.getByte(KEY_ENABLED, 1) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_INTERVAL, g_plugin.getWord(KEY_REPEATINTERVAL, 300) / 60, FALSE);
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, KEY_HEADING, &dbv)) {
+ if (!g_plugin.getWString(KEY_HEADING, &dbv)) {
SetDlgItemText(hwndDlg, IDC_HEADING, dbv.pwszVal);
db_free(&dbv);
}
@@ -28,7 +28,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara else {
SendDlgItemMessage(hwndDlg, IDC_STATUSMODE, CB_ADDSTRING, 0, (LPARAM)pszStatus);
- if (!db_get_ws(NULL, MODULENAME, tszStatus, &dbv)) {
+ if (!g_plugin.getWString(tszStatus, &dbv)) {
if (c < ID_STATUS_FREECHAT)
ptszMessage[c - ID_STATUS_ONLINE - 1] = wcsdup(dbv.pwszVal);
else if (c > ID_STATUS_INVISIBLE)
@@ -80,7 +80,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara BOOL translated;
BOOL fEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLEREPLIER) == 1;
- db_set_b(NULL, MODULENAME, KEY_ENABLED, (BYTE)fEnabled);
+ g_plugin.setByte(KEY_ENABLED, (BYTE)fEnabled);
if (fEnabled)
Menu_ModifyItem(hEnableMenu, LPGENW("Disable Auto&reply"), iconList[0].hIcolib);
@@ -88,12 +88,12 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara Menu_ModifyItem(hEnableMenu, LPGENW("Enable Auto&reply"), iconList[1].hIcolib);
GetDlgItemText(hwndDlg, IDC_HEADING, ptszText, _countof(ptszText));
- db_set_ws(NULL, MODULENAME, KEY_HEADING, ptszText);
+ g_plugin.setWString(KEY_HEADING, ptszText);
INT size = GetDlgItemInt(hwndDlg, IDC_INTERVAL, &translated, FALSE);
if (translated)
interval = size * 60;
- db_set_w(NULL, MODULENAME, KEY_REPEATINTERVAL, interval);
+ g_plugin.setWord(KEY_REPEATINTERVAL, interval);
size = SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETTEXTLENGTH, 0, 0) + 1;
GetDlgItemText(hwndDlg, IDC_MESSAGE, ptszMessage[lastIndex], size);
@@ -106,11 +106,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara mir_snprintf(szStatus, "%d", c);
if (c<ID_STATUS_FREECHAT && ptszMessage[c - ID_STATUS_ONLINE - 1])
- db_set_ws(NULL, MODULENAME, szStatus, ptszMessage[c - ID_STATUS_ONLINE - 1]);
+ g_plugin.setWString(szStatus, ptszMessage[c - ID_STATUS_ONLINE - 1]);
else if (c>ID_STATUS_INVISIBLE && ptszMessage[c - ID_STATUS_ONLINE - 3])
- db_set_ws(NULL, MODULENAME, szStatus, ptszMessage[c - ID_STATUS_ONLINE - 3]);
+ g_plugin.setWString(szStatus, ptszMessage[c - ID_STATUS_ONLINE - 3]);
else
- db_unset(NULL, MODULENAME, szStatus);
+ g_plugin.delSetting(szStatus);
}
}
return TRUE;
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 95fc4dcff0..d67efcbb51 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -113,7 +113,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) wchar_t substituteStr[1024], *msg = mir_wstrdup(in);
for (int i = 0; msg[i]; i++) {
- if (msg[i] == 0x0D && db_get_b(NULL, MODULENAME, "RemoveCR", 0)) {
+ if (msg[i] == 0x0D && g_plugin.getByte("RemoveCR", 0)) {
wchar_t *p = msg + i;
if (i + 1 <= 1024 && msg[i + 1]) {
if (msg[i + 1] == 0x0A) {
@@ -140,7 +140,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME))
- && db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1)) {
+ && g_plugin.getByte("AmpLeaveTitle", 1)) {
ptszWinampTitle = mir_wstrdup(g_ptszWinampSong);
}
else
@@ -219,7 +219,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) BOOL rmark[25];
for (k = 0; k < _countof(rmark); k++) rmark[k] = FALSE;
- int maxk = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ int maxk = g_plugin.getByte("MaxHist", 10);
if (maxk == 0) rmark[0] = TRUE;
while (!rmark[0]) {
@@ -231,7 +231,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) mir_snprintf(buff, "SMsg%d", k);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(buff);
if (tszStatusMsg == nullptr)
continue;
@@ -261,7 +261,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) BOOL rmark[25];
for (k = 0; k < _countof(rmark); k++) rmark[k] = FALSE;
- int maxk = db_get_w(NULL, MODULENAME, "DefMsgCount", 0);
+ int maxk = g_plugin.getWord("DefMsgCount", 0);
if (maxk == 0) rmark[0] = TRUE;
while (!rmark[0]) {
@@ -273,7 +273,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) mir_snprintf(buff, "DefMsg%d", k);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(buff);
if (tszStatusMsg == nullptr)
continue;
@@ -305,7 +305,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) if (szProto) {
char szSetting[80];
mir_snprintf(szSetting, "Proto%sMaxLen", szProto);
- size_t len = db_get_w(NULL, MODULENAME, szSetting, 1024);
+ size_t len = g_plugin.getWord(szSetting, 1024);
if (len < mir_wstrlen(msg)) {
msg = (wchar_t *)mir_realloc(msg, len * sizeof(wchar_t));
msg[len] = 0;
@@ -317,7 +317,7 @@ wchar_t* InsertBuiltinVarsIntoMsg(wchar_t *in, const char *szProto, int) wchar_t* InsertVarsIntoMsg(wchar_t *tszMsg, const char *szProto, int iStatus, MCONTACT hContact)
{
- if (ServiceExists(MS_VARS_FORMATSTRING) && db_get_b(NULL, MODULENAME, "EnableVariables", 1)) {
+ if (ServiceExists(MS_VARS_FORMATSTRING) && g_plugin.getByte("EnableVariables", 1)) {
wchar_t *tszVarsMsg = variables_parse(tszMsg, nullptr, hContact);
if (tszVarsMsg != nullptr) {
wchar_t *format = InsertBuiltinVarsIntoMsg(tszVarsMsg, szProto, iStatus);
@@ -335,7 +335,7 @@ static wchar_t* GetAwayMessageFormat(int iStatus, const char *szProto) wchar_t *format;
mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
- int flags = db_get_b(NULL, MODULENAME, StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
+ int flags = g_plugin.getByte(StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
if (flags & STATUS_EMPTY_MSG) {
return mir_wstrdup(L"");
@@ -354,11 +354,11 @@ static wchar_t* GetAwayMessageFormat(int iStatus, const char *szProto) else
mir_snprintf(szSetting, "LastMsg");
- char *szLastMsg = db_get_sa(NULL, MODULENAME, szSetting);
+ char *szLastMsg = g_plugin.getStringA(szSetting);
if (szLastMsg == nullptr)
return nullptr; //mir_wstrdup(L"");
- format = db_get_wsa(NULL, MODULENAME, szLastMsg);
+ format = g_plugin.getWStringA(szLastMsg);
mir_free(szLastMsg);
}
else if (flags & STATUS_THIS_MSG) {
@@ -380,9 +380,9 @@ static wchar_t* GetAwayMessageFormat(int iStatus, const char *szProto) void DBWriteMessage(char *szSetting, wchar_t *tszMsg)
{
if (tszMsg && mir_wstrlen(tszMsg))
- db_set_ws(NULL, MODULENAME, szSetting, tszMsg);
+ g_plugin.setWString(szSetting, tszMsg);
else
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
}
void SaveMessageToDB(const char *szProto, wchar_t *tszMsg, BOOL bIsFormat)
@@ -430,7 +430,7 @@ void SaveStatusAsCurrent(const char *szProto, int iStatus) {
char szSetting[80];
mir_snprintf(szSetting, "Cur%sStatus", szProto);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)iStatus);
+ g_plugin.setWord(szSetting, (WORD)iStatus);
}
static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, MCONTACT hContact)
@@ -440,7 +440,7 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar if ((!iStatus || iStatus == ID_STATUS_CURRENT) && szProto) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- format = db_get_wsa(NULL, MODULENAME, szSetting);
+ format = g_plugin.getWStringA(szSetting);
}
else {
if (!iStatus || iStatus == ID_STATUS_CURRENT)
@@ -450,17 +450,17 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar return nullptr;
mir_snprintf(szSetting, "Proto%sFlags", szProto ? szProto : "");
- int flags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int flags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (flags & PROTO_THIS_MSG) {
mir_snprintf(szSetting, "Proto%sDefault", szProto);
- format = db_get_wsa(NULL, MODULENAME, szSetting);
+ format = g_plugin.getWStringA(szSetting);
if (format == nullptr)
format = mir_wstrdup(L"");
}
else if (flags & PROTO_NOCHANGE && szProto) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- format = db_get_wsa(NULL, MODULENAME, szSetting);
+ format = g_plugin.getWStringA(szSetting);
}
else if (flags & PROTO_POPUPDLG)
format = GetAwayMessageFormat(iStatus, szProto);
@@ -482,10 +482,10 @@ static wchar_t *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVar int CheckProtoSettings(const char *szProto, int iInitialStatus)
{
- int iSetting = db_get_w(NULL, szProto, "LeaveStatus", -1); //GG settings
+ int iSetting = db_get_w(0, szProto, "LeaveStatus", -1); //GG settings
if (iSetting != -1)
return iSetting ? iSetting : iInitialStatus;
- iSetting = db_get_w(NULL, szProto, "OfflineMessageOption", -1); //TLEN settings
+ iSetting = db_get_w(0, szProto, "OfflineMessageOption", -1); //TLEN settings
if (iSetting != -1) {
switch (iSetting) {
case 1: return ID_STATUS_ONLINE;
@@ -530,7 +530,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus {
char szSetting[80];
mir_snprintf(szSetting, "Proto%sFlags", szProto);
- int flags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int flags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG) {
Proto_SetStatus(szProto, iInitialStatus, iStatus, nullptr);
@@ -540,7 +540,7 @@ int HasProtoStaticStatusMsg(const char *szProto, int iInitialStatus, int iStatus }
else if (flags & PROTO_THIS_MSG) {
mir_snprintf(szSetting, "Proto%sDefault", szProto);
- wchar_t *szSimpleStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *szSimpleStatusMsg = g_plugin.getWStringA(szSetting);
if (szSimpleStatusMsg != nullptr) {
SaveMessageToDB(szProto, szSimpleStatusMsg, TRUE);
wchar_t *msg = InsertVarsIntoMsg(szSimpleStatusMsg, szProto, iStatus, NULL);
@@ -574,7 +574,7 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam) if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
if (wParam == ID_STATUS_CURRENT || wParam == 0)
@@ -663,18 +663,18 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wcha if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (!bOnStartup && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (!bOnStartup && db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
if (iProfileStatus) {
int iProfileNumber = iStatus - 40083;
char szSetting[128];
mir_snprintf(szSetting, "%d_%s", iProfileNumber, pa->szModuleName);
- iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
+ iStatus = db_get_w(0, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
if (iStatus == ID_STATUS_IDLE) // the same as ID_STATUS_LAST in StartupStatus
{
mir_snprintf(szSetting, "last_%s", pa->szModuleName);
- iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
+ iStatus = db_get_w(0, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
}
else if (iStatus == ID_STATUS_CURRENT)
iStatus = GetCurrentStatus(pa->szModuleName);
@@ -877,7 +877,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) char szSetting[80];
mir_snprintf(szSetting, "%sFlags", szProto ? szProto : "");
- int iDlgFlags = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
+ int iDlgFlags = g_plugin.getByte((char *)StatusModeToDbSetting(iStatus, szSetting), STATUS_DEFAULT);
BOOL bShowDlg = iDlgFlags & STATUS_SHOW_DLG || bOnStartup;
BOOL bScreenSaverRunning = IsScreenSaverRunning();
@@ -902,14 +902,14 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) }
mir_snprintf(szSetting, "Proto%sFlags", szProto);
- iProtoFlags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ iProtoFlags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG) {
if (HasProtoStaticStatusMsg(szProto, iStatus, iStatus))
return 1;
}
else if (iProtoFlags & PROTO_NOCHANGE && !bOnStartup) {
mir_snprintf(szSetting, "FCur%sMsg", szProto);
- wchar_t *msg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *msg = g_plugin.getWStringA(szSetting);
#ifdef _DEBUG
g_plugin.debugLogA("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, szProto);
@@ -954,7 +954,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (iStatus == ID_STATUS_OFFLINE || (!(accounts->statusMsgFlags & Proto_Status2Flag(iStatus)) && iStatus != ID_STATUS_CURRENT))
return 0;
- int iProtoFlags = db_get_b(NULL, MODULENAME, "ProtoFlags", PROTO_DEFAULT);
+ int iProtoFlags = g_plugin.getByte("ProtoFlags", PROTO_DEFAULT);
if (!bShowDlg || bScreenSaverRunning || (iProtoFlags & PROTO_NOCHANGE && !bOnStartup)) {
for (int i = 0; i < accounts->count; ++i) {
auto *pa = accounts->pa[i];
@@ -964,7 +964,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
@@ -974,7 +974,7 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) wchar_t *msg;
if (iProtoFlags & PROTO_NOCHANGE) {
mir_snprintf(szSetting, "FCur%sMsg", pa->szModuleName);
- msg = db_get_wsa(NULL, MODULENAME, szSetting);
+ msg = g_plugin.getWStringA(szSetting);
}
else
msg = GetAwayMessageFormat(iStatus, nullptr);
@@ -1047,7 +1047,7 @@ int SetStartupStatus(int i) }
mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
- int flags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int flags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG || flags & PROTO_THIS_MSG) {
if (HasProtoStaticStatusMsg(pa->szModuleName, ID_STATUS_OFFLINE, iStatus))
return 0;
@@ -1056,7 +1056,7 @@ int SetStartupStatus(int i) }
else if (flags & PROTO_NOCHANGE) {
mir_snprintf(szSetting, "FCur%sMsg", pa->szModuleName);
- fmsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ fmsg = g_plugin.getWStringA(szSetting);
}
else
fmsg = GetAwayMessageFormat(iStatus, pa->szModuleName);
@@ -1110,12 +1110,12 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) }
// popup status msg dialog at startup?
- if (db_get_b(NULL, MODULENAME, "StartupPopupDlg", 1) && accounts->statusMsgFlags) {
+ if (g_plugin.getByte("StartupPopupDlg", 1) && accounts->statusMsgFlags) {
if (globalstatus)
ChangeStatusMessage(status_mode, (LPARAM)"SimpleStatusMsgGlobalStartupStatus");
else {
// pseudo-currentDesiredStatusMode ;-)
- db_set_w(NULL, MODULENAME, "StartupStatus", (WORD)temp_status_mode);
+ g_plugin.setWord("StartupStatus", (WORD)temp_status_mode);
ChangeStatusMessage(ID_STATUS_CURRENT, (LPARAM)"SimpleStatusMsgGlobalStartupStatus");
}
return;
@@ -1164,7 +1164,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) {
MIRANDA_IDLE_INFO mii;
Idle_GetInfo(mii);
- if (db_get_b(NULL, MODULENAME, "NoUpdateOnIdle", 1) && mii.idleType)
+ if (g_plugin.getByte("NoUpdateOnIdle", 1) && mii.idleType)
return;
if (!hwndSAMsgDialog) {
@@ -1188,7 +1188,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) continue;
mir_snprintf(szBuffer, "FCur%sMsg", pa->szModuleName);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szBuffer);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szBuffer);
if (tszStatusMsg == nullptr)
continue;
@@ -1197,7 +1197,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_snprintf(szBuffer, "Cur%sMsg", pa->szModuleName);
- tszStatusMsg = db_get_wsa(NULL, MODULENAME, szBuffer);
+ tszStatusMsg = g_plugin.getWStringA(szBuffer);
if ((tszMsg && tszStatusMsg && !mir_wstrcmp(tszMsg, tszStatusMsg)) || (!tszMsg && !tszStatusMsg)) {
mir_free(tszStatusMsg);
mir_free(tszMsg);
@@ -1268,7 +1268,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
- if (!db_get_b(NULL, MODULENAME, "ShowStatusMenuItem", 1))
+ if (!g_plugin.getByte("ShowStatusMenuItem", 1))
mi.flags |= CMIF_HIDDEN;
mi.hIcolibItem = GetIconHandle(IDI_CSMSG);
mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT;
@@ -1295,7 +1295,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) char szSetting[80];
mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
- int iProtoFlags = db_get_b(NULL, MODULENAME, szSetting, PROTO_DEFAULT);
+ int iProtoFlags = g_plugin.getByte(szSetting, PROTO_DEFAULT);
if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG)
continue;
@@ -1335,7 +1335,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) if (!pa->IsEnabled())
continue;
- if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0))
continue;
int iStatusBits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
@@ -1351,7 +1351,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) if (iCurrentStatus < ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_INVISIBLE)
continue;
- if ((lParam & IDF_ISIDLE && (db_get_b(NULL, "AutoAway", pa->szModuleName, 0) ||
+ if ((lParam & IDF_ISIDLE && (db_get_b(0, "AutoAway", pa->szModuleName, 0) ||
iCurrentStatus == ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_FREECHAT)) ||
(!(lParam & IDF_ISIDLE) && !mii.aaLock)) {
if (!(lParam & IDF_ISIDLE))
@@ -1400,15 +1400,15 @@ static int CSStatusChange(WPARAM wParam, LPARAM iCount) #ifdef _DEBUG
g_plugin.debugLogA("CSStatusChange(): Set \"%s\" status message for %s.", ps[i]->m_szMsg, ps[i]->m_szName);
#endif
- int max_hist_msgs = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ int max_hist_msgs = g_plugin.getByte("MaxHist", 10);
for (int j = 1; j <= max_hist_msgs; j++) {
mir_snprintf(buff, "SMsg%d", j);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(buff);
if (tszStatusMsg != nullptr) {
if (!mir_wstrcmp(tszStatusMsg, szMsgW)) {
found = true;
mir_snprintf(szSetting, "Last%sMsg", ps[i]->m_szName);
- db_set_s(NULL, MODULENAME, szSetting, buff);
+ g_plugin.setString(szSetting, buff);
mir_free(tszStatusMsg);
break;
}
@@ -1420,12 +1420,12 @@ static int CSStatusChange(WPARAM wParam, LPARAM iCount) if (!found) {
mir_snprintf(buff, "FCur%sMsg", ps[i]->m_szName);
mir_snprintf(szSetting, "Last%sMsg", ps[i]->m_szName);
- db_set_s(NULL, MODULENAME, szSetting, buff);
+ g_plugin.setString(szSetting, buff);
}
mir_snprintf(szSetting, "%sMsg", ps[i]->m_szName);
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
msg = InsertVarsIntoMsg(szMsgW, ps[i]->m_szName, status_mode, NULL);
SaveMessageToDB(ps[i]->m_szName, szMsgW, TRUE);
mir_free(szMsgW);
@@ -1450,7 +1450,7 @@ static wchar_t *ParseWinampSong(ARGUMENTSINFO *ai) mir_free(g_ptszWinampSong);
g_ptszWinampSong = mir_wstrdup(ptszWinampTitle);
}
- else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) && db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1))
+ else if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) && g_plugin.getByte("AmpLeaveTitle", 1))
ptszWinampTitle = mir_wstrdup(g_ptszWinampSong);
return ptszWinampTitle;
@@ -1487,7 +1487,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) g_plugin.debugLogA("OnICQStatusMsgRequest(): UIN: %d on %s", (int)lParam, (char *)lMirParam);
#endif
- if (db_get_b(NULL, MODULENAME, "NoUpdateOnICQReq", 1))
+ if (g_plugin.getByte("NoUpdateOnICQReq", 1))
return 0;
char *szProto = (char *)lMirParam;
@@ -1579,7 +1579,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) tr.szHelpText = LPGEN("External Applications") "\t" LPGEN("retrieves song name of the song currently playing in Winamp (Simple Status Message compatible)");
CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM)&tr);
- if (db_get_b(NULL, MODULENAME, "ExclDateToken", 0) != 0) {
+ if (g_plugin.getByte("ExclDateToken", 0) != 0) {
tr.szTokenString.w = L"date";
tr.parseFunctionW = ParseDate;
tr.szHelpText = LPGEN("Miranda Related") "\t" LPGEN("get the date (Simple Status Message compatible)");
@@ -1587,12 +1587,12 @@ static int OnModulesLoaded(WPARAM, LPARAM) }
}
- g_ptszWinampSong = db_get_wsa(NULL, MODULENAME, "AmpLastTitle");
+ g_ptszWinampSong = g_plugin.getWStringA("AmpLastTitle");
if (g_ptszWinampSong == nullptr)
g_ptszWinampSong = mir_wstrdup(TEXT(MODULENAME));
- if (db_get_b(NULL, MODULENAME, "UpdateMsgOn", 1))
- g_uUpdateMsgTimer = SetTimer(nullptr, 0, db_get_w(NULL, MODULENAME, "UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
+ if (g_plugin.getByte("UpdateMsgOn", 1))
+ g_uUpdateMsgTimer = SetTimer(nullptr, 0, g_plugin.getWord("UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc);
HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange);
@@ -1600,8 +1600,8 @@ static int OnModulesLoaded(WPARAM, LPARAM) return 0;
if (!ServiceExists(MS_SS_GETPROFILECOUNT)) {
- if (db_get_b(NULL, MODULENAME, "GlobalStatusDelay", 1))
- SetTimer(nullptr, 0, db_get_w(NULL, MODULENAME, "SetStatusDelay", 300), SetStartupStatusGlobal);
+ if (g_plugin.getByte("GlobalStatusDelay", 1))
+ SetTimer(nullptr, 0, g_plugin.getWord("SetStatusDelay", 300), SetStartupStatusGlobal);
else {
g_uSetStatusTimer = (UINT_PTR *)mir_alloc(sizeof(UINT_PTR) * accounts->count);
for (int i = 0; i < accounts->count; ++i) {
@@ -1614,7 +1614,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) char szSetting[80];
mir_snprintf(szSetting, "Set%sStatusDelay", pa->szModuleName);
- g_uSetStatusTimer[i] = SetTimer(nullptr, 0, db_get_w(NULL, MODULENAME, szSetting, 300), SetStartupStatusProc);
+ g_uSetStatusTimer[i] = SetTimer(nullptr, 0, g_plugin.getWord(szSetting, 300), SetStartupStatusProc);
}
}
}
@@ -1636,10 +1636,10 @@ static int OnOkToExit(WPARAM, LPARAM) continue;
mir_snprintf(szSetting, "Last%sStatus", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, Proto_GetStatus(pa->szModuleName));
+ g_plugin.setWord(szSetting, Proto_GetStatus(pa->szModuleName));
}
- if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) /*&& db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1)*/)
+ if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, TEXT(MODULENAME)) /*&& g_plugin.getByte("AmpLeaveTitle", 1)*/)
DBWriteMessage("AmpLastTitle", g_ptszWinampSong);
}
@@ -1674,7 +1674,7 @@ int CMPlugin::Load() hwndSAMsgDialog = nullptr;
accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS));
- db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+ db_set_w(0, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
HookEvent(ME_OPT_INITIALISE, InitOptions);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 70a53b2bd5..b47581c636 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -229,7 +229,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) else cbei.mask = CBEIF_LPARAM | CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE; - int j = db_get_w(NULL, MODULENAME, "LMMsg", 1); + int j = g_plugin.getWord("LMMsg", 1); for (int i = 1; i <= data->max_hist_msgs; ++i) { // history messages @@ -238,7 +238,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) mir_snprintf(buff, "SMsg%d", j); j--; - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff); + wchar_t *tszStatusMsg = g_plugin.getWStringA(buff); if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { found = TRUE; @@ -332,7 +332,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) for (int i = 1; i <= data->num_def_msgs; ++i) { // predefined messages mir_snprintf(buff, "DefMsg%d", i); - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff); + wchar_t *tszStatusMsg = g_plugin.getWStringA(buff); if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { cbei.iItem = -1; @@ -353,7 +353,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) } } - if (db_get_b(NULL, MODULENAME, "PutDefInList", 0)) { + if (g_plugin.getByte("PutDefInList", 0)) { cbei.iItem = -1; cbei.pszText = (LPTSTR)GetDefaultMessage(data->m_iStatus); if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { @@ -640,9 +640,9 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) for (i = 1; i <= data->max_hist_msgs; i++) { mir_snprintf(text, "SMsg%d", i); - db_set_ws(NULL, MODULENAME, text, L""); + g_plugin.setWString(text, L""); } - db_set_s(NULL, MODULENAME, "LastMsg", ""); + g_plugin.setString("LastMsg", ""); for (i = 0; i < accounts->count; i++) { auto *pa = accounts->pa[i]; if (!pa->IsEnabled()) @@ -655,9 +655,9 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) continue; mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, buff2, ""); + g_plugin.setString(buff2, ""); } - db_set_w(NULL, MODULENAME, "LMMsg", (WORD)data->max_hist_msgs); + g_plugin.setWord("LMMsg", (WORD)data->max_hist_msgs); SendMessage(data->recent_cbex, CB_SETCURSEL, -1, 0); num_items = SendMessage(data->recent_cbex, CB_GETCOUNT, 0, 0); if (num_items == CB_ERR) @@ -685,7 +685,7 @@ void DisplayCharsCount(struct MsgBoxData *dlg_data, HWND hwndDlg) return; len = GetDlgItemText(hwndDlg, IDC_EDIT1, msg, _countof(msg)); - if (db_get_b(NULL, MODULENAME, "RemoveCR", 0)) { + if (g_plugin.getByte("RemoveCR", 0)) { int index, num_lines = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_GETLINECOUNT, 0, 0); for (int i = 1; i < num_lines; ++i) { index = SendDlgItemMessage(hwndDlg, IDC_EDIT1, EM_LINEINDEX, (WPARAM)i, 0); @@ -706,7 +706,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) num_start -= data->num_def_msgs + 1; mir_snprintf(setting, "%sFlags", data->m_szProto ? data->m_szProto : ""); - flags = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT); + flags = g_plugin.getByte((char *)StatusModeToDbSetting(iStatus, setting), STATUS_DEFAULT); if (flags & STATUS_LAST_MSG) { if (data->m_szProto) @@ -714,10 +714,10 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else mir_snprintf(setting, "LastMsg"); - char *szSetting = db_get_sa(NULL, MODULENAME, setting); + char *szSetting = g_plugin.getStringA(setting); if (szSetting != nullptr) { if (*szSetting != '\0') { - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting); + wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting); if (tszStatusMsg != nullptr) { if (*tszStatusMsg != '\0') { SetDlgItemText(hwndDlg, IDC_EDIT1, tszStatusMsg); @@ -734,7 +734,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) else if (flags & STATUS_DEFAULT_MSG) { SetDlgItemText(hwndDlg, IDC_EDIT1, GetDefaultMessage(iStatus)); - if (db_get_b(NULL, MODULENAME, "PutDefInList", 0)) { + if (g_plugin.getByte("PutDefInList", 0)) { fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)GetDefaultMessage(iStatus)); if (fcursel != CB_ERR) SendMessage(data->recent_cbex, CB_SETCURSEL, (WPARAM)fcursel, 0); @@ -932,9 +932,9 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, DM_SIMPAWAY_SHUTDOWN); HookEventMessage(ME_SKIN2_ICONSCHANGED, hwndDlg, DM_SIMPAWAY_CHANGEICONS); - copy_init_data->num_def_msgs = db_get_w(NULL, MODULENAME, "DefMsgCount", 0); - copy_init_data->max_hist_msgs = db_get_b(NULL, MODULENAME, "MaxHist", 10); - copy_init_data->m_iDlgFlags = db_get_b(NULL, MODULENAME, "DlgFlags", DLG_SHOW_DEFAULT); + copy_init_data->num_def_msgs = g_plugin.getWord("DefMsgCount", 0); + copy_init_data->max_hist_msgs = g_plugin.getByte("MaxHist", 10); + copy_init_data->m_iDlgFlags = g_plugin.getByte("DlgFlags", DLG_SHOW_DEFAULT); copy_init_data->m_szProto = init_data->m_szProto; copy_init_data->m_iStatus = init_data->m_iStatus; copy_init_data->m_iStatusModes = init_data->m_iStatusModes; @@ -1045,8 +1045,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } } - if (db_get_b(NULL, MODULENAME, "AutoClose", 1) && init_data->m_bOnEvent) { - copy_init_data->m_iCountdown = db_get_b(NULL, MODULENAME, "DlgTime", 5); + if (g_plugin.getByte("AutoClose", 1) && init_data->m_bOnEvent) { + copy_init_data->m_iCountdown = g_plugin.getByte("DlgTime", 5); SendMessage(hwndDlg, WM_TIMER, 0, 0); SetTimer(hwndDlg, 1, 1000, nullptr); } @@ -1068,15 +1068,15 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA mir_free(init_data); - if (!db_get_b(NULL, MODULENAME, "WinCentered", 1)) { + if (!g_plugin.getByte("WinCentered", 1)) { WINDOWPLACEMENT wp; int x, y; wp.length = sizeof(wp); GetWindowPlacement(hwndDlg, &wp); - x = (int)db_get_dw(NULL, MODULENAME, "Winx", -1); - y = (int)db_get_dw(NULL, MODULENAME, "Winy", -1); + x = (int)g_plugin.getDword("Winx", -1); + y = (int)g_plugin.getDword("Winy", -1); if (x != -1) { OffsetRect(&wp.rcNormalPosition, x - wp.rcNormalPosition.left, y - wp.rcNormalPosition.top); @@ -1127,13 +1127,13 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA char szSetting[80]; if (msgbox_data->m_szProto) { mir_snprintf(szSetting, "Last%sMsg", msgbox_data->m_szProto); - db_set_s(NULL, MODULENAME, szSetting, ""); + g_plugin.setString(szSetting, ""); mir_snprintf(szSetting, "%sMsg", msgbox_data->m_szProto); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), L""); + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, szSetting), L""); } else { - db_set_s(NULL, MODULENAME, "LastMsg", ""); + g_plugin.setString("LastMsg", ""); for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled()) @@ -1142,21 +1142,21 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) + if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) continue; if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; mir_snprintf(szSetting, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, szSetting, ""); + g_plugin.setString(szSetting, ""); mir_snprintf(szSetting, "%sMsg", pa->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), L""); + db_set_ws(0, "SRAway", StatusModeToDbSetting(iStatus, szSetting), L""); } - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), L""); // for compatibility with some plugins + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), L""); // for compatibility with some plugins } if (bCurrentStatus) @@ -1172,19 +1172,19 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA for (int i = 1; i <= msgbox_data->max_hist_msgs; i++) { mir_snprintf(buff, "SMsg%d", i); - wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, buff); + wchar_t *tszStatusMsg = g_plugin.getWStringA(buff); if (tszStatusMsg != nullptr) { if (!mir_wstrcmp(tszStatusMsg, tszMsg)) { found = true; if (msgbox_data->m_szProto) { mir_snprintf(buff2, "Last%sMsg", msgbox_data->m_szProto); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", msgbox_data->m_szProto); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); } else { - db_set_s(NULL, MODULENAME, "LastMsg", buff); + g_plugin.setString("LastMsg", buff); for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled()) @@ -1193,18 +1193,18 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) + if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) continue; if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", pa->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); } } mir_free(tszStatusMsg); @@ -1215,7 +1215,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA } if (!found) { - int last_modified_msg = db_get_w(NULL, MODULENAME, "LMMsg", msgbox_data->max_hist_msgs); + int last_modified_msg = g_plugin.getWord("LMMsg", msgbox_data->max_hist_msgs); if (last_modified_msg == msgbox_data->max_hist_msgs) last_modified_msg = 1; @@ -1223,17 +1223,17 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA last_modified_msg++; mir_snprintf(buff, "SMsg%d", last_modified_msg); - db_set_ws(NULL, MODULENAME, buff, tszMsg); + g_plugin.setWString(buff, tszMsg); if (msgbox_data->m_szProto) { mir_snprintf(buff2, "Last%sMsg", msgbox_data->m_szProto); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", msgbox_data->m_szProto); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, buff2), tszMsg); } else { - db_set_s(NULL, MODULENAME, "LastMsg", buff); + g_plugin.setString("LastMsg", buff); for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled()) @@ -1242,25 +1242,25 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) + if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) continue; if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); - db_set_s(NULL, MODULENAME, buff2, buff); + g_plugin.setString(buff2, buff); mir_snprintf(buff2, "%sMsg", pa->szModuleName); iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); + db_set_ws(0, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); } } - db_set_w(NULL, MODULENAME, "LMMsg", (WORD)last_modified_msg); + g_plugin.setWord("LMMsg", (WORD)last_modified_msg); } if (!msgbox_data->m_szProto) - db_set_ws(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), tszMsg); // for compatibility with some plugins + db_set_ws(0, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), tszMsg); // for compatibility with some plugins if (bCurrentStatus) SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, ID_STATUS_CURRENT, tszMsg, msgbox_data->m_bOnStartup); @@ -1387,7 +1387,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(histitem.lParam) == HISTORY_MSG) { char szSetting[16]; mir_snprintf(szSetting, "SMsg%d", (int)HIWORD(histitem.lParam)); - db_set_ws(NULL, MODULENAME, szSetting, L""); + g_plugin.setWString(szSetting, L""); SendMessage(msgbox_data->recent_cbex, CBEM_DELETEITEM, (WPARAM)msgbox_data->curr_sel_msg, 0); } if (LOWORD(histitem.lParam) == PREDEFINED_MSG) { @@ -1499,7 +1499,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (LOWORD(histitem.lParam) == HISTORY_MSG) { mir_snprintf(buff, "SMsg%d", (int)HIWORD(histitem.lParam)); - db_set_ws(NULL, MODULENAME, buff, L""); + g_plugin.setWString(buff, L""); } else if (LOWORD(histitem.lParam) == PREDEFINED_MSG) msgbox_data->m_bPredefChanged = TRUE; @@ -1570,8 +1570,8 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA WINDOWPLACEMENT wp; wp.length = sizeof(wp); GetWindowPlacement(hwndDlg, &wp); - db_set_dw(NULL, MODULENAME, "Winx", wp.rcNormalPosition.left); - db_set_dw(NULL, MODULENAME, "Winy", wp.rcNormalPosition.top); + g_plugin.setDword("Winx", wp.rcNormalPosition.left); + g_plugin.setDword("Winy", wp.rcNormalPosition.top); if (msgbox_data->m_bPredefChanged) { int i, num_items, new_num_def_msgs = 0; @@ -1591,13 +1591,13 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA mir_snprintf(buff, "DefMsg%d", i); if (LOWORD(cbitem.lParam) == PREDEFINED_MSG) { new_num_def_msgs++; - db_set_ws(NULL, MODULENAME, buff, text); + g_plugin.setWString(buff, text); } else - db_unset(NULL, MODULENAME, buff); + g_plugin.delSetting(buff); num_items--; } - db_set_w(NULL, MODULENAME, "DefMsgCount", (WORD)new_num_def_msgs); + g_plugin.setWord("DefMsgCount", (WORD)new_num_def_msgs); } ImageList_Destroy(msgbox_data->status_icons); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 1652e32181..e208c19ca8 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -131,7 +131,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i - ID_STATUS_ONLINE);
- val = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
+ val = g_plugin.getByte((char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
ptrW text(db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default")));
mir_wstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
@@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l continue;
mir_snprintf(setting, "%sFlags", pa->szModuleName);
- val = db_get_b(NULL, MODULENAME, (char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
+ val = g_plugin.getByte((char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE] = val;
mir_snprintf(setting, "%sDefault", pa->szModuleName);
text = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
@@ -174,7 +174,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (index != CB_ERR && index != CB_ERRSPACE) {
data->proto_msg[0].msg = nullptr;
- val = db_get_b(NULL, MODULENAME, "ProtoFlags", PROTO_DEFAULT);
+ val = g_plugin.getByte("ProtoFlags", PROTO_DEFAULT);
data->proto_msg[0].flags = val;
data->proto_msg[0].max_length = 0;
SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, (WPARAM)index, 0);
@@ -193,14 +193,14 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l // SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, index, (LPARAM)i + 1);
if (index != CB_ERR && index != CB_ERRSPACE) {
mir_snprintf(setting, "Proto%sDefault", pa->szModuleName);
- data->proto_msg[i + 1].msg = db_get_wsa(NULL, MODULENAME, setting);
+ data->proto_msg[i + 1].msg = g_plugin.getWStringA(setting);
mir_snprintf(setting, "Proto%sFlags", pa->szModuleName);
- val = db_get_b(NULL, MODULENAME, setting, PROTO_DEFAULT);
+ val = g_plugin.getByte(setting, PROTO_DEFAULT);
data->proto_msg[i + 1].flags = val;
mir_snprintf(setting, "Proto%sMaxLen", pa->szModuleName);
- val = db_get_w(NULL, MODULENAME, setting, 1024);
+ val = g_plugin.getWord(setting, 1024);
data->proto_msg[i + 1].max_length = val;
SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i + 1);
}
@@ -216,7 +216,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_CBOPTPROTO, CBN_SELCHANGE), (LPARAM)GetDlgItem(hwndDlg, IDC_CBOPTPROTO));
}
- if (db_get_b(NULL, MODULENAME, "PutDefInList", 0))
+ if (g_plugin.getByte("PutDefInList", 0))
CheckDlgButton(hwndDlg, IDC_COPTMSG2, BST_CHECKED);
if (ServiceExists(MS_VARS_FORMATSTRING)) {
@@ -417,9 +417,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg && mir_wstrlen(tszStatusMsg)) {
if (tszStatusMsg && mir_wstrlen(tszStatusMsg))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -554,9 +554,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting != nullptr) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg) {
if (tszStatusMsg[0])
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -639,9 +639,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(setting, "LastMsg");
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting != nullptr) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg) {
if (tszStatusMsg[0])
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -741,9 +741,9 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_OPTEDIT1, L"");
- char *szSetting = db_get_sa(NULL, MODULENAME, setting);
+ char *szSetting = g_plugin.getStringA(setting);
if (szSetting != nullptr) {
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg) {
if (tszStatusMsg[0])
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, tszStatusMsg);
@@ -907,8 +907,8 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l char szSetting[80];
for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
if (accounts->statusMsgFlags & Proto_Status2Flag(i)) {
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
- db_set_b(NULL, MODULENAME, StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
+ g_plugin.setByte(StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
for (int j = 0; j < accounts->count; j++) {
auto *pa = accounts->pa[j];
@@ -920,19 +920,19 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i)) {
mir_snprintf(szSetting, "%sDefault", pa->szModuleName);
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
+ db_set_ws(0, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
mir_snprintf(szSetting, "%sFlags", pa->szModuleName);
- db_set_b(NULL, MODULENAME, StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
+ g_plugin.setByte(StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
}
}
- db_set_b(NULL, MODULENAME, "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
+ g_plugin.setByte("PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
if (data->proto_ok) {
- db_set_b(NULL, MODULENAME, "ProtoFlags", (BYTE)data->proto_msg[0].flags);
+ g_plugin.setByte("ProtoFlags", (BYTE)data->proto_msg[0].flags);
for (int i = 0; i < accounts->count; i++) {
auto *pa = accounts->pa[i];
@@ -947,15 +947,15 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_snprintf(szSetting, "Proto%sDefault", pa->szModuleName);
if (data->proto_msg[i + 1].msg && (data->proto_msg[i + 1].flags & PROTO_THIS_MSG))
- db_set_ws(NULL, MODULENAME, szSetting, data->proto_msg[i + 1].msg);
+ g_plugin.setWString(szSetting, data->proto_msg[i + 1].msg);
// else
- // db_unset(NULL, MODULENAME, szSetting);
+ // g_plugin.delSetting(szSetting);
mir_snprintf(szSetting, "Proto%sMaxLen", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)data->proto_msg[i + 1].max_length);
+ g_plugin.setWord(szSetting, (WORD)data->proto_msg[i + 1].max_length);
mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
- db_set_b(NULL, MODULENAME, szSetting, (BYTE)data->proto_msg[i + 1].flags);
+ g_plugin.setByte(szSetting, (BYTE)data->proto_msg[i + 1].flags);
}
}
RebuildStatusMenu();
@@ -987,16 +987,16 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ESECUPDTMSG), 0);
SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETRANGE32, 1, 999);
- SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)db_get_w(NULL, MODULENAME, "UpdateMsgInt", 10), 0));
+ SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)g_plugin.getWord("UpdateMsgInt", 10), 0));
SendDlgItemMessage(hwndDlg, IDC_ESECUPDTMSG, EM_LIMITTEXT, 3, 0);
- CheckDlgButton(hwndDlg, IDC_CUPDATEMSG, db_get_b(NULL, MODULENAME, "UpdateMsgOn", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNOIDLE, db_get_b(NULL, MODULENAME, "NoUpdateOnIdle", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNOICQREQ, db_get_b(NULL, MODULENAME, "NoUpdateOnICQReq", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLEAVEWINAMP, db_get_b(NULL, MODULENAME, "AmpLeaveTitle", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CUPDATEMSG, g_plugin.getByte("UpdateMsgOn", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNOIDLE, g_plugin.getByte("NoUpdateOnIdle", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNOICQREQ, g_plugin.getByte("NoUpdateOnICQReq", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLEAVEWINAMP, g_plugin.getByte("AmpLeaveTitle", 1) ? BST_CHECKED : BST_UNCHECKED);
if (ServiceExists(MS_VARS_FORMATSTRING)) {
- CheckDlgButton(hwndDlg, IDC_CVARIABLES, db_get_b(NULL, MODULENAME, "EnableVariables", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CDATEPARSING, db_get_b(NULL, MODULENAME, "ExclDateToken", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CVARIABLES, g_plugin.getByte("EnableVariables", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CDATEPARSING, g_plugin.getByte("ExclDateToken", 0) ? BST_CHECKED : BST_UNCHECKED);
}
else {
EnableWindow(GetDlgItem(hwndDlg, IDC_CVARIABLES), FALSE);
@@ -1046,22 +1046,22 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM KillTimer(nullptr, g_uUpdateMsgTimer);
int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
- db_set_w(NULL, MODULENAME, "UpdateMsgInt", (WORD)val);
+ g_plugin.setWord("UpdateMsgInt", (WORD)val);
if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val) {
- db_set_b(NULL, MODULENAME, "UpdateMsgOn", (BYTE)1);
+ g_plugin.setByte("UpdateMsgOn", (BYTE)1);
g_uUpdateMsgTimer = SetTimer(nullptr, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
}
else {
- db_set_b(NULL, MODULENAME, "UpdateMsgOn", (BYTE)0);
+ g_plugin.setByte("UpdateMsgOn", (BYTE)0);
}
- db_set_b(NULL, MODULENAME, "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
+ g_plugin.setByte("NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
+ g_plugin.setByte("NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
+ g_plugin.setByte("AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
if (ServiceExists(MS_VARS_FORMATSTRING)) {
- db_set_b(NULL, MODULENAME, "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
+ g_plugin.setByte("EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
+ g_plugin.setByte("ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
}
return TRUE;
}
@@ -1073,12 +1073,12 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM static bool IsHistoryMsgsFound(HWND, int histMax)
{
char szSetting[16];
- int j = db_get_w(NULL, MODULENAME, "LMMsg", 1);
+ int j = g_plugin.getWord("LMMsg", 1);
for (int i = 1; i <= histMax; ++i, --j) {
if (j < 1)
j = histMax;
mir_snprintf(szSetting, "SMsg%d", j);
- wchar_t *tszStatusMsg = db_get_wsa(NULL, MODULENAME, szSetting);
+ wchar_t *tszStatusMsg = g_plugin.getWStringA(szSetting);
if (tszStatusMsg != nullptr) {
if (*tszStatusMsg != '\0') {
mir_free(tszStatusMsg);
@@ -1110,7 +1110,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_SETITEMDATA, (WPARAM)i_btndownflat, DLG_SHOW_BUTTONS_FLAT);
SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_SETITEMDATA, (WPARAM)i_btnlist, DLG_SHOW_BUTTONS_INLIST);
- settingValue = db_get_b(NULL, MODULENAME, "DlgFlags", DLG_SHOW_DEFAULT);
+ settingValue = g_plugin.getByte("DlgFlags", DLG_SHOW_DEFAULT);
CheckDlgButton(hwndDlg, IDC_CSTATUSLIST, settingValue & DLG_SHOW_STATUS ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CPROFILES, settingValue & DLG_SHOW_STATUS_PROFILES ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CICONS1, settingValue & DLG_SHOW_STATUS_ICONS ? BST_CHECKED : BST_UNCHECKED);
@@ -1139,7 +1139,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w }
// Misc.
- settingValue = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ settingValue = g_plugin.getByte("MaxHist", 10);
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_EMAXHIST), 0);
SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETRANGE32, 0, 25);
@@ -1150,17 +1150,17 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), IsHistoryMsgsFound(hwndDlg, settingValue));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), db_get_w(NULL, MODULENAME, "DefMsgCount", 0) != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), g_plugin.getWord("DefMsgCount", 0) != 0);
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ETIMEOUT), 0);
SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETRANGE32, 1, 60);
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)db_get_b(NULL, MODULENAME, "DlgTime", 5), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)g_plugin.getByte("DlgTime", 5), 0));
SendDlgItemMessage(hwndDlg, IDC_ETIMEOUT, EM_LIMITTEXT, 2, 0);
- CheckDlgButton(hwndDlg, IDC_CCLOSEWND, db_get_b(NULL, MODULENAME, "AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CRPOSWND, !db_get_b(NULL, MODULENAME, "WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CREMOVECR, db_get_b(NULL, MODULENAME, "RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, db_get_b(NULL, MODULENAME, "ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CCLOSEWND, g_plugin.getByte("AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CRPOSWND, !g_plugin.getByte("WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CREMOVECR, g_plugin.getByte("RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, g_plugin.getByte("ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED);
SendMessage(hwndDlg, WM_USER + 2, 0, 0);
return TRUE;
@@ -1222,14 +1222,14 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- int max_hist_msgs = db_get_b(NULL, MODULENAME, "MaxHist", 10);
+ int max_hist_msgs = g_plugin.getByte("MaxHist", 10);
for (int i = 1; i <= max_hist_msgs; i++) {
char text[8];
mir_snprintf(text, "SMsg%d", i);
- db_set_ws(NULL, MODULENAME, text, L"");
+ g_plugin.setWString(text, L"");
}
- db_set_s(NULL, MODULENAME, "LastMsg", "");
+ g_plugin.setString("LastMsg", "");
for (int i = 0; i < accounts->count; i++) {
auto *pa = accounts->pa[i];
@@ -1244,9 +1244,9 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w char setting[80];
mir_snprintf(setting, "Last%sMsg", pa->szModuleName);
- db_set_s(NULL, MODULENAME, setting, "");
+ g_plugin.setString(setting, "");
}
- db_set_w(NULL, MODULENAME, "LMMsg", (WORD)max_hist_msgs);
+ g_plugin.setWord("LMMsg", (WORD)max_hist_msgs);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
}
return 0;
@@ -1256,13 +1256,13 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (hwndSAMsgDialog)
DestroyWindow(hwndSAMsgDialog);
- int nDefMSgCount = db_get_w(NULL, MODULENAME, "DefMsgCount", 0);
+ int nDefMSgCount = g_plugin.getWord("DefMsgCount", 0);
for (int i = 1; i <= nDefMSgCount; i++) {
char szSetting[16];
mir_snprintf(szSetting, "DefMsg%d", i);
- db_unset(NULL, MODULENAME, szSetting);
+ g_plugin.delSetting(szSetting);
}
- db_set_w(NULL, MODULENAME, "DefMsgCount", 0);
+ g_plugin.setWord("DefMsgCount", 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
}
return 0;
@@ -1288,15 +1288,15 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w if (curSel != CB_ERR)
flags |= SendDlgItemMessage(hwndDlg, IDC_CBOPTBUTTONS, CB_GETITEMDATA, (WPARAM)curSel, 0);
- db_set_b(NULL, MODULENAME, "DlgFlags", (BYTE)flags);
+ g_plugin.setByte("DlgFlags", (BYTE)flags);
// Misc.
- db_set_b(NULL, MODULENAME, "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
- db_set_b(NULL, MODULENAME, "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
- db_set_b(NULL, MODULENAME, "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
+ g_plugin.setByte("MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, nullptr, FALSE));
+ g_plugin.setByte("AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
+ g_plugin.setByte("DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE));
+ g_plugin.setByte("WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
+ g_plugin.setByte("RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
+ g_plugin.setByte("ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
RebuildStatusMenu();
return TRUE;
@@ -1335,22 +1335,22 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa if (index != LB_ERR && index != LB_ERRSPACE) {
char setting[80];
mir_snprintf(setting, "Startup%sStatus", pa->szModuleName);
- data->status[i] = db_get_w(NULL, MODULENAME, setting, ID_STATUS_CURRENT);
+ data->status[i] = g_plugin.getWord(setting, ID_STATUS_CURRENT);
mir_snprintf(setting, "Set%sStatusDelay", pa->szModuleName);
- data->setdelay[i] = db_get_w(NULL, MODULENAME, setting, 300);
+ data->setdelay[i] = g_plugin.getWord(setting, 300);
SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
}
SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_SETCURSEL, 0, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LISTPROTO, LBN_SELCHANGE), (LPARAM)GetDlgItem(hwndDlg, IDC_LISTPROTO));
- data->setglobaldelay = db_get_w(NULL, MODULENAME, "SetStatusDelay", 300);
+ data->setglobaldelay = g_plugin.getWord("SetStatusDelay", 300);
SendDlgItemMessage(hwndDlg, IDC_SSETSTATUS, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_ESETSTATUS), 0);
SendDlgItemMessage(hwndDlg, IDC_SSETSTATUS, UDM_SETRANGE32, 0, 9000);
SendDlgItemMessage(hwndDlg, IDC_ESETSTATUS, EM_LIMITTEXT, 4, 0);
- if (!db_get_b(NULL, MODULENAME, "GlobalStatusDelay", 1)) {
+ if (!g_plugin.getByte("GlobalStatusDelay", 1)) {
CheckDlgButton(hwndDlg, IDC_SPECSET, BST_CHECKED);
int i = SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_GETCURSEL, 0, 0), 0);
SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
@@ -1360,7 +1360,7 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
}
- if (db_get_b(NULL, MODULENAME, "StartupPopupDlg", 1)) {
+ if (g_plugin.getByte("StartupPopupDlg", 1)) {
CheckDlgButton(hwndDlg, IDC_POPUPDLG, BST_CHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED) {
CheckDlgButton(hwndDlg, IDC_SPECSET, BST_UNCHECKED);
@@ -1499,14 +1499,14 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa char szSetting[80];
mir_snprintf(szSetting, "Startup%sStatus", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)data->status[i]);
+ g_plugin.setWord(szSetting, (WORD)data->status[i]);
mir_snprintf(szSetting, "Set%sStatusDelay", pa->szModuleName);
- db_set_w(NULL, MODULENAME, szSetting, (WORD)data->setdelay[i]);
+ g_plugin.setWord(szSetting, (WORD)data->setdelay[i]);
}
- db_set_w(NULL, MODULENAME, "SetStatusDelay", (WORD)data->setglobaldelay);
- db_set_b(NULL, MODULENAME, "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
- db_set_b(NULL, MODULENAME, "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
+ g_plugin.setWord("SetStatusDelay", (WORD)data->setglobaldelay);
+ g_plugin.setByte("GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
+ g_plugin.setByte("StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
return TRUE;
}
break;
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index aaeaf1eb47..00e507f834 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -135,7 +135,7 @@ int GetCurrentStatus(const char *szProto) if (szProto) {
char szSetting[80];
mir_snprintf(szSetting, "Cur%sStatus", szProto);
- return (int)db_get_w(NULL, MODULENAME, szSetting, ID_STATUS_OFFLINE);
+ return (int)g_plugin.getWord(szSetting, ID_STATUS_OFFLINE);
}
return CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
@@ -148,13 +148,13 @@ int GetStartupStatus(const char *szProto) char szSetting[80];
mir_snprintf(szSetting, "Startup%sStatus", szProto);
- status_mode = db_get_w(NULL, MODULENAME, szSetting, ID_STATUS_CURRENT);
+ status_mode = g_plugin.getWord(szSetting, ID_STATUS_CURRENT);
if (status_mode == ID_STATUS_CURRENT) {
// load status used for this proto last time
mir_snprintf(szSetting, "Last%sStatus", szProto);
- status_mode = db_get_w(NULL, MODULENAME, szSetting, ID_STATUS_OFFLINE);
+ status_mode = g_plugin.getWord(szSetting, ID_STATUS_OFFLINE);
}
return status_mode;
}
- return (int)db_get_w(NULL, MODULENAME, "StartupStatus", ID_STATUS_OFFLINE);
+ return (int)g_plugin.getWord("StartupStatus", ID_STATUS_OFFLINE);
}
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 8933288e97..0ba2f7e92b 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -523,63 +523,63 @@ void OptionsDialogType::ShowSmileyPreview(void) void OptionsType::Save(void)
{
- db_set_b(NULL, MODULENAME, "EnforceSpaces", EnforceSpaces);
- db_set_b(NULL, MODULENAME, "ScaleToTextheight", ScaleToTextheight);
- db_set_b(NULL, MODULENAME, "UseOneForAll", UseOneForAll);
- db_set_b(NULL, MODULENAME, "UsePhysProto", UsePhysProto);
- db_set_b(NULL, MODULENAME, "SurroundSmileyWithSpaces", SurroundSmileyWithSpaces);
- db_set_b(NULL, MODULENAME, "ScaleAllSmileys", ScaleAllSmileys);
- db_set_b(NULL, MODULENAME, "IEViewStyle", IEViewStyle);
- db_set_b(NULL, MODULENAME, "AnimateSel", AnimateSel);
- db_set_b(NULL, MODULENAME, "AnimateDlg", AnimateDlg);
- db_set_b(NULL, MODULENAME, "InputSmileys", InputSmileys);
- db_set_b(NULL, MODULENAME, "DCursorSmiley", DCursorSmiley);
- db_set_b(NULL, MODULENAME, "DisableCustom", DisableCustom);
- db_set_b(NULL, MODULENAME, "HQScaling", HQScaling);
- db_set_dw(NULL, MODULENAME, "MaxCustomSmileySize", MaxCustomSmileySize);
- db_set_dw(NULL, MODULENAME, "MinSmileySize", MinSmileySize);
- db_set_b(NULL, MODULENAME, "HorizontalSorting", HorizontalSorting);
+ g_plugin.setByte("EnforceSpaces", EnforceSpaces);
+ g_plugin.setByte("ScaleToTextheight", ScaleToTextheight);
+ g_plugin.setByte("UseOneForAll", UseOneForAll);
+ g_plugin.setByte("UsePhysProto", UsePhysProto);
+ g_plugin.setByte("SurroundSmileyWithSpaces", SurroundSmileyWithSpaces);
+ g_plugin.setByte("ScaleAllSmileys", ScaleAllSmileys);
+ g_plugin.setByte("IEViewStyle", IEViewStyle);
+ g_plugin.setByte("AnimateSel", AnimateSel);
+ g_plugin.setByte("AnimateDlg", AnimateDlg);
+ g_plugin.setByte("InputSmileys", InputSmileys);
+ g_plugin.setByte("DCursorSmiley", DCursorSmiley);
+ g_plugin.setByte("DisableCustom", DisableCustom);
+ g_plugin.setByte("HQScaling", HQScaling);
+ g_plugin.setDword("MaxCustomSmileySize", MaxCustomSmileySize);
+ g_plugin.setDword("MinSmileySize", MinSmileySize);
+ g_plugin.setByte("HorizontalSorting", HorizontalSorting);
}
void OptionsType::Load(void)
{
- EnforceSpaces = db_get_b(NULL, MODULENAME, "EnforceSpaces", FALSE) != 0;
- ScaleToTextheight = db_get_b(NULL, MODULENAME, "ScaleToTextheight", FALSE) != 0;
- UseOneForAll = db_get_b(NULL, MODULENAME, "UseOneForAll", TRUE) != 0;
- UsePhysProto = db_get_b(NULL, MODULENAME, "UsePhysProto", FALSE) != 0;
- SurroundSmileyWithSpaces = db_get_b(NULL, MODULENAME, "SurroundSmileyWithSpaces", FALSE) != 0;
- ScaleAllSmileys = db_get_b(NULL, MODULENAME, "ScaleAllSmileys", FALSE) != 0;
- IEViewStyle = db_get_b(NULL, MODULENAME, "IEViewStyle", FALSE) != 0;
- AnimateSel = db_get_b(NULL, MODULENAME, "AnimateSel", TRUE) != 0;
- AnimateDlg = db_get_b(NULL, MODULENAME, "AnimateDlg", TRUE) != 0;
- InputSmileys = db_get_b(NULL, MODULENAME, "InputSmileys", TRUE) != 0;
- DCursorSmiley = db_get_b(NULL, MODULENAME, "DCursorSmiley", FALSE) != 0;
- DisableCustom = db_get_b(NULL, MODULENAME, "DisableCustom", FALSE) != 0;
- HQScaling = db_get_b(NULL, MODULENAME, "HQScaling", FALSE) != 0;
-
- SelWndBkgClr = db_get_dw(NULL, MODULENAME, "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
- MaxCustomSmileySize = db_get_dw(NULL, MODULENAME, "MaxCustomSmileySize", 0);
- MinSmileySize = db_get_dw(NULL, MODULENAME, "MinSmileySize", 0);
- HorizontalSorting = db_get_b(NULL, MODULENAME, "HorizontalSorting", 1) != 0;
+ EnforceSpaces = g_plugin.getByte("EnforceSpaces", FALSE) != 0;
+ ScaleToTextheight = g_plugin.getByte("ScaleToTextheight", FALSE) != 0;
+ UseOneForAll = g_plugin.getByte("UseOneForAll", TRUE) != 0;
+ UsePhysProto = g_plugin.getByte("UsePhysProto", FALSE) != 0;
+ SurroundSmileyWithSpaces = g_plugin.getByte("SurroundSmileyWithSpaces", FALSE) != 0;
+ ScaleAllSmileys = g_plugin.getByte("ScaleAllSmileys", FALSE) != 0;
+ IEViewStyle = g_plugin.getByte("IEViewStyle", FALSE) != 0;
+ AnimateSel = g_plugin.getByte("AnimateSel", TRUE) != 0;
+ AnimateDlg = g_plugin.getByte("AnimateDlg", TRUE) != 0;
+ InputSmileys = g_plugin.getByte("InputSmileys", TRUE) != 0;
+ DCursorSmiley = g_plugin.getByte("DCursorSmiley", FALSE) != 0;
+ DisableCustom = g_plugin.getByte("DisableCustom", FALSE) != 0;
+ HQScaling = g_plugin.getByte("HQScaling", FALSE) != 0;
+
+ SelWndBkgClr = g_plugin.getDword("SelWndBkgClr", GetSysColor(COLOR_WINDOW));
+ MaxCustomSmileySize = g_plugin.getDword("MaxCustomSmileySize", 0);
+ MinSmileySize = g_plugin.getDword("MinSmileySize", 0);
+ HorizontalSorting = g_plugin.getByte("HorizontalSorting", 1) != 0;
}
void OptionsType::ReadPackFileName(CMStringW &filename, const CMStringW &name, const CMStringW &defaultFilename)
{
CMStringW settingKey = name + L"-filename";
- ptrW tszValue(db_get_wsa(NULL, MODULENAME, _T2A(settingKey.c_str())));
+ ptrW tszValue(g_plugin.getWStringA(_T2A(settingKey.c_str())));
filename = (tszValue != NULL) ? (wchar_t*)tszValue : defaultFilename;
}
void OptionsType::WritePackFileName(const CMStringW &filename, const CMStringW &name)
{
CMStringW settingKey = name + L"-filename";
- db_set_ws(NULL, MODULENAME, _T2A(settingKey.c_str()), filename.c_str());
+ g_plugin.setWString(_T2A(settingKey.c_str()), filename.c_str());
}
void OptionsType::ReadCustomCategories(CMStringW &cats)
{
- ptrW tszValue(db_get_wsa(NULL, MODULENAME, "CustomCategories"));
+ ptrW tszValue(g_plugin.getWStringA("CustomCategories"));
if (tszValue != NULL)
cats = tszValue;
}
@@ -587,9 +587,9 @@ void OptionsType::ReadCustomCategories(CMStringW &cats) void OptionsType::WriteCustomCategories(const CMStringW &cats)
{
if (cats.IsEmpty())
- db_unset(NULL, MODULENAME, "CustomCategories");
+ g_plugin.delSetting("CustomCategories");
else
- db_set_ws(NULL, MODULENAME, "CustomCategories", cats.c_str());
+ g_plugin.setWString("CustomCategories", cats.c_str());
}
void OptionsType::ReadContactCategory(MCONTACT hContact, CMStringW &cats)
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 441b491af7..6e9a38f698 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -438,6 +438,6 @@ int DbSettingChanged(WPARAM hContact, LPARAM lParam) int ReloadColour(WPARAM, LPARAM)
{
- opt.SelWndBkgClr = db_get_dw(NULL, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
+ opt.SelWndBkgClr = db_get_dw(0, "SmileyAdd", "SelWndBkgClr", GetSysColor(COLOR_WINDOW));
return 0;
}
\ No newline at end of file diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 8f2761300f..83e8a1c4b4 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -19,7 +19,7 @@ wchar_t* _getMOptS(wchar_t *buf, unsigned int buflen, const char* module, const wchar_t* tmp;
DBVARIANT dbv = {0};
wcsnset(buf, 0, buflen);
- if (db_get_s(NULL, module, option, &dbv) != 0)
+ if (db_get_s(0, module, option, &dbv) != 0)
wcsncpy(buf, def, min(buflen, mir_wstrlen(def)+1));
else if (dbv.type == DBVT_WCHAR) {
wcsncpy(buf, dbv.pwszVal, min(buflen, mir_wstrlen(dbv.pwszVal)+1));
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index 4b7c517c93..d804b2336a 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -777,7 +777,7 @@ void GetDictsInfo(LIST<Dictionary> &dicts) char lang[128]; WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), nullptr, nullptr); - if (!db_get_ws(NULL, MODULENAME, lang, &dbv)) { + if (!g_plugin.getWString(lang, &dbv)) { mir_wstrncpy(dict->localized_name, dbv.pwszVal, _countof(dict->localized_name)); db_free(&dbv); } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 8188bad73a..0c2f526f6a 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -84,7 +84,7 @@ void LoadOptions() }
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "DefaultLanguage", &dbv)) {
+ if (!g_plugin.getWString("DefaultLanguage", &dbv)) {
mir_wstrncpy(opts.default_language, dbv.pwszVal, _countof(opts.default_language));
db_free(&dbv);
}
@@ -201,7 +201,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int sel = SendDlgItemMessage(hwndDlg, IDC_DEF_LANG, CB_GETCURSEL, 0, 0);
if (sel >= languages.getCount())
sel = 0;
- db_set_ws(NULL, MODULENAME, "DefaultLanguage",
+ g_plugin.setWString("DefaultLanguage",
(wchar_t *)languages[sel]->language);
mir_wstrcpy(opts.default_language, languages[sel]->language);
}
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 217e95daad..aa11ff39e0 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -769,7 +769,7 @@ void GetContactLanguage(Dialog *dlg) dlg->lang_name[0] = '\0';
if (dlg->hContact == NULL) {
- if (!db_get_ws(NULL, MODULENAME, dlg->name, &dbv)) {
+ if (!g_plugin.getWString(dlg->name, &dbv)) {
mir_wstrncpy(dlg->lang_name, dbv.pwszVal, _countof(dlg->lang_name));
db_free(&dbv);
}
@@ -1203,7 +1203,7 @@ BOOL HandleMenuSelection(Dialog *dlg, unsigned selection) SetNoUnderline(dlg);
if (dlg->hContact == NULL)
- db_set_ws(NULL, MODULENAME, dlg->name,
+ g_plugin.setWString(dlg->name,
languages[selection - LANGUAGE_MENU_ID_BASE]->language);
else
db_set_ws(dlg->hContact, MODULENAME, "TalkLanguage",
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 08b15eb9b6..403e9a7d04 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -77,14 +77,14 @@ void SplashMain() if (bstartup & (options.active == 1)) {
DBVARIANT dbv = { 0 };
- if (!db_get_ws(NULL, MODULENAME, "VersionPrefix", &dbv)) {
+ if (!g_plugin.getWString("VersionPrefix", &dbv)) {
mir_wstrcpy(szPrefix, dbv.pwszVal);
db_free(&dbv);
}
else
mir_wstrcpy(szPrefix, L"");
- if (!db_get_ws(NULL, MODULENAME, "Path", &dbv)) {
+ if (!g_plugin.getWString("Path", &dbv)) {
mir_wstrcpy(inBuf, dbv.pwszVal);
db_free(&dbv);
}
@@ -101,7 +101,7 @@ void SplashMain() else
mir_wstrcpy(szSplashFile, inBuf);
- if (!db_get_ws(NULL, MODULENAME, "Sound", &dbv)) {
+ if (!g_plugin.getWString("Sound", &dbv)) {
mir_wstrcpy(inBuf, dbv.pwszVal);
db_free(&dbv);
}
@@ -192,10 +192,10 @@ int PlugDisableHook(WPARAM wParam, LPARAM lParam) if (options.inheritGS) {
if (!strcmp(cws->szModule, "Skin") && !strcmp(cws->szSetting, "UseSound"))
- db_set_b(NULL, MODULENAME, "PlaySound", cws->value.bVal);
+ g_plugin.setByte("PlaySound", cws->value.bVal);
if (!strcmp(cws->szModule, "PluginDisable") && !strcmp(cws->szSetting, _T2A(szDllName)))
- db_set_b(NULL, MODULENAME, "Active", cws->value.bVal);
+ g_plugin.setByte("Active", cws->value.bVal);
}
return 0;
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 37758b59e5..8925965151 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -24,16 +24,16 @@ wchar_t szPath2Spash[MAX_PATH], szSoundFilePath[MAX_PATH]; // Reads values from db
void ReadDbConfig()
{
- options.active = db_get_b(NULL, MODULENAME, "Active", 1);
- options.playsnd = db_get_b(NULL, MODULENAME, "PlaySound", 0);
- options.fadein = db_get_b(NULL, MODULENAME, "FadeIn", 1);
- options.fadeout = db_get_b(NULL, MODULENAME, "FadeOut", 1);
- options.showtime = db_get_dw(NULL, MODULENAME, "TimeToShow", 2000);
- options.fisteps = db_get_dw(NULL, MODULENAME, "FadeinSpeed", 5);
- options.fosteps = db_get_dw(NULL, MODULENAME, "FadeoutSpeed", 5);
- options.inheritGS = db_get_b(NULL, MODULENAME, "InheritGlobalSound", 1);
- options.showversion = db_get_b(NULL, MODULENAME, "ShowVersion", 0);
- options.random = db_get_b(NULL, MODULENAME, "Random", 0);
+ options.active = g_plugin.getByte("Active", 1);
+ options.playsnd = g_plugin.getByte("PlaySound", 0);
+ options.fadein = g_plugin.getByte("FadeIn", 1);
+ options.fadeout = g_plugin.getByte("FadeOut", 1);
+ options.showtime = g_plugin.getDword("TimeToShow", 2000);
+ options.fisteps = g_plugin.getDword("FadeinSpeed", 5);
+ options.fosteps = g_plugin.getDword("FadeoutSpeed", 5);
+ options.inheritGS = g_plugin.getByte("InheritGlobalSound", 1);
+ options.showversion = g_plugin.getByte("ShowVersion", 0);
+ options.random = g_plugin.getByte("Random", 0);
}
BOOL Exists(LPCTSTR strName)
@@ -53,21 +53,21 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t inBuf[80];
{
DBVARIANT dbv = { 0 };
- if (!db_get_ws(NULL, MODULENAME, "Path", &dbv)) {
+ if (!g_plugin.getWString("Path", &dbv)) {
mir_wstrcpy(inBuf, dbv.pwszVal);
db_free(&dbv);
}
else mir_wstrcpy(inBuf, L"splash\\splash.png");
SetDlgItemText(hwndDlg, IDC_SPLASHPATH, inBuf);
- if (!db_get_ws(NULL, MODULENAME, "Sound", &dbv)) {
+ if (!g_plugin.getWString("Sound", &dbv)) {
mir_wstrcpy(inBuf, dbv.pwszVal);
db_free(&dbv);
}
else mir_wstrcpy(inBuf, L"sounds\\startup.wav");
SetDlgItemText(hwndDlg, IDC_SNDPATH, inBuf);
- if (!db_get_ws(NULL, MODULENAME, "VersionPrefix", &dbv)) {
+ if (!g_plugin.getWString("VersionPrefix", &dbv)) {
mir_wstrcpy(inBuf, dbv.pwszVal);
db_free(&dbv);
}
@@ -243,86 +243,86 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, _countof(tmp));
- db_set_ws(NULL, MODULENAME, "Path", tmp);
+ g_plugin.setWString("Path", tmp);
GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, _countof(tmp));
- db_set_ws(NULL, MODULENAME, "Sound", tmp);
+ g_plugin.setWString("Sound", tmp);
GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp));
- db_set_ws(NULL, MODULENAME, "VersionPrefix", tmp);
+ g_plugin.setWString("VersionPrefix", tmp);
mir_wstrcpy(szPrefix, tmp);
GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp));
- db_set_dw(NULL, MODULENAME, "TimeToShow", _wtoi(tmp));
+ g_plugin.setDword("TimeToShow", _wtoi(tmp));
options.showtime = _wtoi(tmp);
GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, _countof(tmp));
- db_set_dw(NULL, MODULENAME, "FadeinSpeed", _wtoi(tmp));
+ g_plugin.setDword("FadeinSpeed", _wtoi(tmp));
options.fisteps = _wtoi(tmp);
GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, _countof(tmp));
- db_set_dw(NULL, MODULENAME, "FadeoutSpeed", _wtoi(tmp));
+ g_plugin.setDword("FadeoutSpeed", _wtoi(tmp));
options.fosteps = _wtoi(tmp);
if (IsDlgButtonChecked(hwndDlg, IDC_ACTIVE)) {
- db_set_b(NULL, MODULENAME, "Active", 1);
+ g_plugin.setByte("Active", 1);
options.active = 1;
}
else {
- db_set_b(NULL, MODULENAME, "Active", 0);
+ g_plugin.setByte("Active", 0);
options.active = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND)) {
- db_set_b(NULL, MODULENAME, "PlaySound", 1);
+ g_plugin.setByte("PlaySound", 1);
options.playsnd = 1;
- db_set_b(NULL, MODULENAME, "InheritGlobalSound", 1);
+ g_plugin.setByte("InheritGlobalSound", 1);
options.inheritGS = 1;
}
else {
- db_set_b(NULL, MODULENAME, "PlaySound", 0);
+ g_plugin.setByte("PlaySound", 0);
options.playsnd = 0;
- db_set_b(NULL, MODULENAME, "InheritGlobalSound", 0);
+ g_plugin.setByte("InheritGlobalSound", 0);
options.inheritGS = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND) == BST_INDETERMINATE) {
- db_set_b(NULL, MODULENAME, "PlaySound", 1);
+ g_plugin.setByte("PlaySound", 1);
options.playsnd = 1;
- db_set_b(NULL, MODULENAME, "InheritGlobalSound", 0);
+ g_plugin.setByte("InheritGlobalSound", 0);
options.inheritGS = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN)) {
- db_set_b(NULL, MODULENAME, "FadeIn", 1);
+ g_plugin.setByte("FadeIn", 1);
options.fadein = 1;
}
else {
- db_set_b(NULL, MODULENAME, "FadeIn", 0);
+ g_plugin.setByte("FadeIn", 0);
options.fadein = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT)) {
- db_set_b(NULL, MODULENAME, "FadeOut", 1);
+ g_plugin.setByte("FadeOut", 1);
options.fadeout = 1;
}
else {
- db_set_b(NULL, MODULENAME, "FadeOut", 0);
+ g_plugin.setByte("FadeOut", 0);
options.fadeout = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_RANDOM)) {
- db_set_b(NULL, MODULENAME, "Random", 1);
+ g_plugin.setByte("Random", 1);
options.random = 1;
}
else {
- db_set_b(NULL, MODULENAME, "Random", 0);
+ g_plugin.setByte("Random", 0);
options.random = 0;
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWVERSION)) {
- db_set_b(NULL, MODULENAME, "ShowVersion", 1);
+ g_plugin.setByte("ShowVersion", 1);
options.showversion = 1;
}
else {
- db_set_b(NULL, MODULENAME, "ShowVersion", 0);
+ g_plugin.setByte("ShowVersion", 0);
options.showversion = 0;
}
return TRUE;
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 03b9b5e43c..74da60d7f8 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -89,7 +89,7 @@ static void __cdecl AdvSt(void*) if ((Enabled == 1)) {
POPUPDATAT ppd = { 0 };
wchar_t *lptzText = L"";
- db_set_b(NULL, "Skin", "UseSound", 0);
+ db_set_b(0, "Skin", "UseSound", 0);
EnablePopupModule();
if (PopUp == 1) {
@@ -114,9 +114,9 @@ static void __cdecl AdvSt(void*) PUAddPopupT(&ppd);
}
if (DefEnabled == 1) { //predefined sound setting
- db_set_b(NULL, "Skin", "UseSound", DefSound);
+ db_set_b(0, "Skin", "UseSound", DefSound);
}
- else db_set_b(NULL, "Skin", "UseSound", 1); //or enable sounds every starts
+ else db_set_b(0, "Skin", "UseSound", 1); //or enable sounds every starts
}
}
@@ -163,7 +163,7 @@ void InitSettings() mir_snprintf(NonStatusAllowComp, "%s_NonStatusAllow", hostname);
}
//first run on the host, initial setting
- if (!(delay = db_get_dw(NULL, MODULENAME, DelayComp, 0)))
+ if (!(delay = db_get_dw(0, MODULENAME, DelayComp, 0)))
DefSettings();
//or load host settings
else LoadSettings();
@@ -171,31 +171,31 @@ void InitSettings() void DefSettings()
{
- db_set_dw(NULL, MODULENAME, DelayComp, 20);
- db_set_b(NULL, MODULENAME, EnabledComp, 1);
- db_set_b(NULL, MODULENAME, PopUpComp, 1);
- db_set_dw(NULL, MODULENAME, PopUpTimeComp, 5);
- db_set_b(NULL, MODULENAME, MenuitemComp, 1);
- db_set_b(NULL, MODULENAME, TTBButtonsComp, 0);
- db_set_b(NULL, MODULENAME, DefSoundComp, 1);
- db_set_b(NULL, MODULENAME, DefPopupComp, 0);
- db_set_b(NULL, MODULENAME, DefEnabledComp, 0);
- db_set_b(NULL, MODULENAME, NonStatusAllowComp, 1);
+ g_plugin.setDword(DelayComp, 20);
+ g_plugin.setByte(EnabledComp, 1);
+ g_plugin.setByte(PopUpComp, 1);
+ g_plugin.setDword(PopUpTimeComp, 5);
+ g_plugin.setByte(MenuitemComp, 1);
+ g_plugin.setByte(TTBButtonsComp, 0);
+ g_plugin.setByte(DefSoundComp, 1);
+ g_plugin.setByte(DefPopupComp, 0);
+ g_plugin.setByte(DefEnabledComp, 0);
+ g_plugin.setByte(NonStatusAllowComp, 1);
LoadSettings();
}
void LoadSettings()
{
- Enabled = db_get_b(NULL, MODULENAME, EnabledComp, 0);
- delay = db_get_dw(NULL, MODULENAME, DelayComp, 0);
- PopUp = db_get_b(NULL, MODULENAME, PopUpComp, 0);
- PopUpTime = db_get_dw(NULL, MODULENAME, PopUpTimeComp, 0);
- MenuItem = db_get_b(NULL, MODULENAME, MenuitemComp, 0);
- TTBButtons = db_get_b(NULL, MODULENAME, TTBButtonsComp, 0);
- DefSound = db_get_b(NULL, MODULENAME, DefSoundComp, 0);
- DefPopup = db_get_b(NULL, MODULENAME, DefPopupComp, 0);
- DefEnabled = db_get_b(NULL, MODULENAME, DefEnabledComp, 0);
- NonStatusAllow = db_get_b(NULL, MODULENAME, NonStatusAllowComp, 0);
+ Enabled = g_plugin.getByte(EnabledComp, 0);
+ delay = g_plugin.getDword(DelayComp, 0);
+ PopUp = g_plugin.getByte(PopUpComp, 0);
+ PopUpTime = g_plugin.getDword(PopUpTimeComp, 0);
+ MenuItem = g_plugin.getByte(MenuitemComp, 0);
+ TTBButtons = g_plugin.getByte(TTBButtonsComp, 0);
+ DefSound = g_plugin.getByte(DefSoundComp, 0);
+ DefPopup = g_plugin.getByte(DefPopupComp, 0);
+ DefEnabled = g_plugin.getByte(DefEnabledComp, 0);
+ NonStatusAllow = g_plugin.getByte(NonStatusAllowComp, 0);
if (PopUpTime < 1)
PopUpTime = (DWORD)1;
if (PopUpTime > 30)
@@ -204,15 +204,15 @@ void LoadSettings() delay = (DWORD)10;
if (delay > 300)
delay = (DWORD)300;
- db_set_dw(NULL, MODULENAME, DelayComp, delay);
- db_set_dw(NULL, MODULENAME, PopUpTimeComp, PopUpTime);
+ g_plugin.setDword(DelayComp, delay);
+ g_plugin.setDword(PopUpTimeComp, PopUpTime);
}
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR StartupSilenceEnabled(WPARAM, LPARAM)
{
- db_set_b(NULL, MODULENAME, EnabledComp, !Enabled);
+ g_plugin.setByte(EnabledComp, !Enabled);
LoadSettings();
if (MenuItem == 1)
UpdateMenu();
@@ -334,7 +334,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP min = GetDlgItemInt(hwndDlg, IDC_SSTIME, nullptr, FALSE);
if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SSTIME)))
SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_SETPOS, 0, MAKELONG((short)1, 0));
- delay = (DWORD)db_set_dw(NULL, MODULENAME, DelayComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_GETPOS, 0, 0)));
+ delay = (DWORD)db_set_dw(0, MODULENAME, DelayComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN, UDM_GETPOS, 0, 0)));
break;
case IDC_SSPOPUPTIME:
@@ -342,7 +342,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP min = GetDlgItemInt(hwndDlg, IDC_SSPOPUPTIME, nullptr, FALSE);
if (min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SSPOPUPTIME)))
SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_SETPOS, 0, MAKELONG((short)1, 0));
- PopUpTime = (DWORD)db_set_dw(NULL, MODULENAME, PopUpTimeComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_GETPOS, 0, 0)));
+ PopUpTime = (DWORD)db_set_dw(0, MODULENAME, PopUpTimeComp, (DWORD)(SendDlgItemMessage(hwndDlg, IDC_SSSPIN2, UDM_GETPOS, 0, 0)));
break;
case IDC_DELAY:
@@ -353,42 +353,42 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!ServiceExists(MS_POPUP_QUERY)) {
MessageBox(nullptr, NEEDPOPUP, NOTICE, MB_OK);
CheckDlgButton(hwndDlg, IDC_DELAY2, BST_UNCHECKED);
- PopUp = (BYTE)db_set_b(NULL, MODULENAME, PopUpComp, 0);
+ PopUp = (BYTE)db_set_b(0, MODULENAME, PopUpComp, 0);
}
- else PopUp = (BYTE)db_set_b(NULL, MODULENAME, PopUpComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DELAY2) == BST_CHECKED ? 1 : 0));
+ else PopUp = (BYTE)db_set_b(0, MODULENAME, PopUpComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DELAY2) == BST_CHECKED ? 1 : 0));
break;
case IDC_MENU:
- MenuItem = (BYTE)db_set_b(NULL, MODULENAME, MenuitemComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_MENU) == BST_CHECKED ? 1 : 0));
+ MenuItem = (BYTE)db_set_b(0, MODULENAME, MenuitemComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_MENU) == BST_CHECKED ? 1 : 0));
break;
case IDC_TTB:
if (!hTTBarloaded) {
MessageBox(nullptr, NEEDTTBMOD, NOTICE, MB_OK);
CheckDlgButton(hwndDlg, IDC_TTB, BST_UNCHECKED);
- TTBButtons = (BYTE)db_set_b(NULL, MODULENAME, TTBButtonsComp, 0);
+ TTBButtons = (BYTE)db_set_b(0, MODULENAME, TTBButtonsComp, 0);
}
- else TTBButtons = (BYTE)db_set_b(NULL, MODULENAME, TTBButtonsComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_TTB) == BST_CHECKED ? 1 : 0));
+ else TTBButtons = (BYTE)db_set_b(0, MODULENAME, TTBButtonsComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_TTB) == BST_CHECKED ? 1 : 0));
break;
case IDC_DEFPOPUP:
- db_set_b(NULL, MODULENAME, DefPopupComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DEFPOPUP) == BST_CHECKED ? 1 : 0));
- DefPopup = db_get_b(NULL, MODULENAME, DefPopupComp, 0);
+ db_set_b(0, MODULENAME, DefPopupComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DEFPOPUP) == BST_CHECKED ? 1 : 0));
+ DefPopup = db_get_b(0, MODULENAME, DefPopupComp, 0);
break;
case IDC_DEFSOUNDS:
- db_set_b(NULL, MODULENAME, DefSoundComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DEFSOUNDS) == BST_CHECKED ? 1 : 0));
- DefSound = db_get_b(NULL, MODULENAME, DefSoundComp, 0);
+ db_set_b(0, MODULENAME, DefSoundComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DEFSOUNDS) == BST_CHECKED ? 1 : 0));
+ DefSound = db_get_b(0, MODULENAME, DefSoundComp, 0);
break;
case IDC_RESTORE:
- db_set_b(NULL, MODULENAME, DefEnabledComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_RESTORE) == BST_CHECKED ? 1 : 0));
- DefEnabled = db_get_b(NULL, MODULENAME, DefEnabledComp, 0);
+ db_set_b(0, MODULENAME, DefEnabledComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_RESTORE) == BST_CHECKED ? 1 : 0));
+ DefEnabled = db_get_b(0, MODULENAME, DefEnabledComp, 0);
break;
case IDC_NONSTATUSES:
- db_set_b(NULL, MODULENAME, NonStatusAllowComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NONSTATUSES) == BST_CHECKED ? 1 : 0));
- NonStatusAllow = db_get_b(NULL, MODULENAME, NonStatusAllowComp, 0);
+ db_set_b(0, MODULENAME, NonStatusAllowComp, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_NONSTATUSES) == BST_CHECKED ? 1 : 0));
+ NonStatusAllow = db_get_b(0, MODULENAME, NonStatusAllowComp, 0);
break;
case IDC_RESETDEFAULT:
diff --git a/plugins/StatusChange/src/main.cpp b/plugins/StatusChange/src/main.cpp index 580d8bb631..0e4c3e44f4 100644 --- a/plugins/StatusChange/src/main.cpp +++ b/plugins/StatusChange/src/main.cpp @@ -32,23 +32,23 @@ CMPlugin::CMPlugin() : void LoadOptions()
{
memset(&Options, 0, sizeof(Options));
- Options.MessageRead = (BOOL)db_get_b(NULL, MODULENAME, "MessageRead", FALSE);
- Options.MessageSend = (BOOL)db_get_b(NULL, MODULENAME, "MessageSend", TRUE);
- Options.UrlRead = (BOOL)db_get_b(NULL, MODULENAME, "UrlRead", FALSE);
- Options.UrlSend = (BOOL)db_get_b(NULL, MODULENAME, "UrlSend", TRUE);
- Options.FileRead = (BOOL)db_get_b(NULL, MODULENAME, "FileRead", FALSE);
- Options.FileSend = (BOOL)db_get_b(NULL, MODULENAME, "FileSend", TRUE);
- Options.ChangeTo = (INT)db_get_dw(NULL, MODULENAME, "ChangeTo", ID_STATUS_ONLINE);
- Options.IfOffline = (BOOL)db_get_b(NULL, MODULENAME, "IfOffline", FALSE);
- Options.IfOnline = (BOOL)db_get_b(NULL, MODULENAME, "IfOnline", FALSE);
- Options.IfAway = (BOOL)db_get_b(NULL, MODULENAME, "IfAway", TRUE);
- Options.IfNA = (BOOL)db_get_b(NULL, MODULENAME, "IfNA", TRUE);
- Options.IfOccupied = (BOOL)db_get_b(NULL, MODULENAME, "IfOccupied", FALSE);
- Options.IfDND = (BOOL)db_get_b(NULL, MODULENAME, "IfDND", FALSE);
- Options.IfFreeforchat = (BOOL)db_get_b(NULL, MODULENAME, "IfFreeforchat", FALSE);
- Options.IfInvisible = (BOOL)db_get_b(NULL, MODULENAME, "IfInvisible", FALSE);
- Options.IfOnthephone = (BOOL)db_get_b(NULL, MODULENAME, "IfOnthephone", FALSE);
- Options.IfOuttolunch = (BOOL)db_get_b(NULL, MODULENAME, "IfOuttolunch", FALSE);
+ Options.MessageRead = (BOOL)g_plugin.getByte("MessageRead", FALSE);
+ Options.MessageSend = (BOOL)g_plugin.getByte("MessageSend", TRUE);
+ Options.UrlRead = (BOOL)g_plugin.getByte("UrlRead", FALSE);
+ Options.UrlSend = (BOOL)g_plugin.getByte("UrlSend", TRUE);
+ Options.FileRead = (BOOL)g_plugin.getByte("FileRead", FALSE);
+ Options.FileSend = (BOOL)g_plugin.getByte("FileSend", TRUE);
+ Options.ChangeTo = (INT)g_plugin.getDword("ChangeTo", ID_STATUS_ONLINE);
+ Options.IfOffline = (BOOL)g_plugin.getByte("IfOffline", FALSE);
+ Options.IfOnline = (BOOL)g_plugin.getByte("IfOnline", FALSE);
+ Options.IfAway = (BOOL)g_plugin.getByte("IfAway", TRUE);
+ Options.IfNA = (BOOL)g_plugin.getByte("IfNA", TRUE);
+ Options.IfOccupied = (BOOL)g_plugin.getByte("IfOccupied", FALSE);
+ Options.IfDND = (BOOL)g_plugin.getByte("IfDND", FALSE);
+ Options.IfFreeforchat = (BOOL)g_plugin.getByte("IfFreeforchat", FALSE);
+ Options.IfInvisible = (BOOL)g_plugin.getByte("IfInvisible", FALSE);
+ Options.IfOnthephone = (BOOL)g_plugin.getByte("IfOnthephone", FALSE);
+ Options.IfOuttolunch = (BOOL)g_plugin.getByte("IfOuttolunch", FALSE);
}
static int StatusChangeGetMessage(WPARAM, LPARAM hDbEvent)
@@ -283,23 +283,23 @@ static INT_PTR CALLBACK DlgProcStatusChangeOpts(HWND hwndDlg, UINT msg, WPARAM w return TRUE;
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "MessageRead", (BYTE)Options.MessageRead);
- db_set_b(NULL, MODULENAME, "MessageSend", (BYTE)Options.MessageSend);
- db_set_b(NULL, MODULENAME, "UrlRead", (BYTE)Options.UrlRead);
- db_set_b(NULL, MODULENAME, "UrlSend", (BYTE)Options.UrlSend);
- db_set_b(NULL, MODULENAME, "FileRead", (BYTE)Options.FileRead);
- db_set_b(NULL, MODULENAME, "FileSend", (BYTE)Options.FileSend);
- db_set_dw(NULL, MODULENAME, "ChangeTo", (DWORD)Options.ChangeTo);
- db_set_b(NULL, MODULENAME, "IfOffline", (BYTE)Options.IfOffline);
- db_set_b(NULL, MODULENAME, "IfOnline", (BYTE)Options.IfOnline);
- db_set_b(NULL, MODULENAME, "IfAway", (BYTE)Options.IfAway);
- db_set_b(NULL, MODULENAME, "IfNA", (BYTE)Options.IfNA);
- db_set_b(NULL, MODULENAME, "IfDND", (BYTE)Options.IfDND);
- db_set_b(NULL, MODULENAME, "IfOccupied", (BYTE)Options.IfOccupied);
- db_set_b(NULL, MODULENAME, "IfFreeforchat", (BYTE)Options.IfFreeforchat);
- db_set_b(NULL, MODULENAME, "IfInvisible", (BYTE)Options.IfInvisible);
- db_set_b(NULL, MODULENAME, "IfOnthephone", (BYTE)Options.IfOnthephone);
- db_set_b(NULL, MODULENAME, "IfOuttolunch", (BYTE)Options.IfOuttolunch);
+ g_plugin.setByte("MessageRead", (BYTE)Options.MessageRead);
+ g_plugin.setByte("MessageSend", (BYTE)Options.MessageSend);
+ g_plugin.setByte("UrlRead", (BYTE)Options.UrlRead);
+ g_plugin.setByte("UrlSend", (BYTE)Options.UrlSend);
+ g_plugin.setByte("FileRead", (BYTE)Options.FileRead);
+ g_plugin.setByte("FileSend", (BYTE)Options.FileSend);
+ g_plugin.setDword("ChangeTo", (DWORD)Options.ChangeTo);
+ g_plugin.setByte("IfOffline", (BYTE)Options.IfOffline);
+ g_plugin.setByte("IfOnline", (BYTE)Options.IfOnline);
+ g_plugin.setByte("IfAway", (BYTE)Options.IfAway);
+ g_plugin.setByte("IfNA", (BYTE)Options.IfNA);
+ g_plugin.setByte("IfDND", (BYTE)Options.IfDND);
+ g_plugin.setByte("IfOccupied", (BYTE)Options.IfOccupied);
+ g_plugin.setByte("IfFreeforchat", (BYTE)Options.IfFreeforchat);
+ g_plugin.setByte("IfInvisible", (BYTE)Options.IfInvisible);
+ g_plugin.setByte("IfOnthephone", (BYTE)Options.IfOnthephone);
+ g_plugin.setByte("IfOuttolunch", (BYTE)Options.IfOuttolunch);
return TRUE;
}
break;
diff --git a/plugins/StatusManager/src/options.cpp b/plugins/StatusManager/src/options.cpp index ee375493df..366d834b81 100644 --- a/plugins/StatusManager/src/options.cpp +++ b/plugins/StatusManager/src/options.cpp @@ -81,7 +81,7 @@ static bool IsSubPluginEnabled(const char *name) void InitCommonOptions() { // if this options dialog was never filled, apply default options - if (db_get_b(0, MODULENAME, AAAMODULENAME "_enabled", -1) == -1) { + if (g_plugin.getByte(AAAMODULENAME "_enabled", -1) == -1) { g_AAAEnabled = IsSubPluginEnabled(AAAMODULENAME); g_KSEnabled = IsSubPluginEnabled(KSMODULENAME); g_SSEnabled = IsSubPluginEnabled(SSMODULENAME); diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 71d7e9e2dc..f5bdfe4fc1 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -83,33 +83,33 @@ extern wstring DBGetContactSettingStringPAN(MCONTACT hContact, char const * szMo void InitVars()
{
- gbSpammersGroup = DBGetContactSettingStringPAN(NULL, MODULENAME, "SpammersGroup", L"Spammers");
- gbAnswer = DBGetContactSettingStringPAN(NULL, MODULENAME, "answer", L"nospam");
- gbInfTalkProtection = db_get_b(NULL, MODULENAME, "infTalkProtection", 0);
- gbAddPermanent = db_get_b(NULL, MODULENAME, "addPermanent", 0);
- gbMaxQuestCount = db_get_dw(NULL, MODULENAME, "maxQuestCount", 5);
- gbHandleAuthReq = db_get_b(NULL, MODULENAME, "handleAuthReq", 1);
- gbQuestion = DBGetContactSettingStringPAN(NULL, MODULENAME, "question", TranslateW(defQuestion));
- gbAnswer = DBGetContactSettingStringPAN(NULL, MODULENAME, "answer", L"nospam");
- gbCongratulation = DBGetContactSettingStringPAN(NULL, MODULENAME, "congratulation", TranslateW(defCongrats));
- gbAuthRepl = DBGetContactSettingStringPAN(NULL, MODULENAME, "authrepl", TranslateW(defAuthReply));
- gbSpecialGroup = db_get_b(NULL, MODULENAME, "SpecialGroup", 0);
- gbHideContacts = db_get_b(NULL, MODULENAME, "HideContacts", 0);
- gbIgnoreContacts = db_get_b(NULL, MODULENAME, "IgnoreContacts", 0);
- gbExclude = db_get_b(NULL, MODULENAME, "ExcludeContacts", 1);
- gbDelExcluded = db_get_b(NULL, MODULENAME, "DelExcluded", 0);
- gbDelAllTempory = db_get_b(NULL, MODULENAME, "DelAllTempory", 0);
- gbCaseInsensitive = db_get_b(NULL, MODULENAME, "CaseInsensitive", 0);
- gbRegexMatch = db_get_b(NULL, MODULENAME, "RegexMatch", 0);
- gbInvisDisable = db_get_b(NULL, MODULENAME, "DisableInInvis", 0);
- gbIgnoreURL = db_get_b(NULL, MODULENAME, "IgnoreURL", 0);
- gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, MODULENAME, "AutoAuthGroup", L"Not Spammers");
- gbAutoAuth = db_get_b(NULL, MODULENAME, "AutoAuth", 0);
- gbAutoAddToServerList = db_get_b(NULL, MODULENAME, "AutoAddToServerList", 0);
- gbAutoReqAuth = db_get_b(NULL, MODULENAME, "AutoReqAuth", 0);
- gbLogToFile = db_get_b(NULL, MODULENAME, "LogSpamToFile", 0);
- gbHistoryLog = db_get_b(NULL, MODULENAME, "HistoryLog", 0);
- gbMathExpression = db_get_b(NULL, MODULENAME, "MathExpression", 0);
+ gbSpammersGroup = DBGetContactSettingStringPAN(0, MODULENAME, "SpammersGroup", L"Spammers");
+ gbAnswer = DBGetContactSettingStringPAN(0, MODULENAME, "answer", L"nospam");
+ gbInfTalkProtection = g_plugin.getByte("infTalkProtection", 0);
+ gbAddPermanent = g_plugin.getByte("addPermanent", 0);
+ gbMaxQuestCount = g_plugin.getDword("maxQuestCount", 5);
+ gbHandleAuthReq = g_plugin.getByte("handleAuthReq", 1);
+ gbQuestion = DBGetContactSettingStringPAN(0, MODULENAME, "question", TranslateW(defQuestion));
+ gbAnswer = DBGetContactSettingStringPAN(0, MODULENAME, "answer", L"nospam");
+ gbCongratulation = DBGetContactSettingStringPAN(0, MODULENAME, "congratulation", TranslateW(defCongrats));
+ gbAuthRepl = DBGetContactSettingStringPAN(0, MODULENAME, "authrepl", TranslateW(defAuthReply));
+ gbSpecialGroup = g_plugin.getByte("SpecialGroup", 0);
+ gbHideContacts = g_plugin.getByte("HideContacts", 0);
+ gbIgnoreContacts = g_plugin.getByte("IgnoreContacts", 0);
+ gbExclude = g_plugin.getByte("ExcludeContacts", 1);
+ gbDelExcluded = g_plugin.getByte("DelExcluded", 0);
+ gbDelAllTempory = g_plugin.getByte("DelAllTempory", 0);
+ gbCaseInsensitive = g_plugin.getByte("CaseInsensitive", 0);
+ gbRegexMatch = g_plugin.getByte("RegexMatch", 0);
+ gbInvisDisable = g_plugin.getByte("DisableInInvis", 0);
+ gbIgnoreURL = g_plugin.getByte("IgnoreURL", 0);
+ gbAutoAuthGroup = DBGetContactSettingStringPAN(0, MODULENAME, "AutoAuthGroup", L"Not Spammers");
+ gbAutoAuth = g_plugin.getByte("AutoAuth", 0);
+ gbAutoAddToServerList = g_plugin.getByte("AutoAddToServerList", 0);
+ gbAutoReqAuth = g_plugin.getByte("AutoReqAuth", 0);
+ gbLogToFile = g_plugin.getByte("LogSpamToFile", 0);
+ gbHistoryLog = g_plugin.getByte("HistoryLog", 0);
+ gbMathExpression = g_plugin.getByte("MathExpression", 0);
}
static int OnSystemModulesLoaded(WPARAM, LPARAM)
diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index 9bfcf9a0d2..b7f8fc1274 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -48,13 +48,13 @@ public: bool OnApply() override
{
- db_set_dw(NULL, MODULENAME, "maxQuestCount", gbMaxQuestCount = edit_MAXQUESTCOUNT.GetInt());
- db_set_b(NULL, MODULENAME, "infTalkProtection", gbInfTalkProtection = chk_INFTALKPROT.GetState());
- db_set_b(NULL, MODULENAME, "addPermanent", gbAddPermanent = chk_ADDPERMANENT.GetState());
- db_set_b(NULL, MODULENAME, "handleAuthReq", gbHandleAuthReq = chk_HANDLEAUTHREQ.GetState());
- db_set_b(NULL, MODULENAME, "HideContacts", gbHideContacts = chk_HIDECONTACTS.GetState());
- db_set_b(NULL, MODULENAME, "IgnoreContacts", gbIgnoreContacts = chk_IGNORESPAMMERS.GetState());
- db_set_b(NULL, MODULENAME, "LogSpamToFile", gbLogToFile = chk_LOGSPAMTOFILE.GetState());
+ g_plugin.setDword("maxQuestCount", gbMaxQuestCount = edit_MAXQUESTCOUNT.GetInt());
+ g_plugin.setByte("infTalkProtection", gbInfTalkProtection = chk_INFTALKPROT.GetState());
+ g_plugin.setByte("addPermanent", gbAddPermanent = chk_ADDPERMANENT.GetState());
+ g_plugin.setByte("handleAuthReq", gbHandleAuthReq = chk_HANDLEAUTHREQ.GetState());
+ g_plugin.setByte("HideContacts", gbHideContacts = chk_HIDECONTACTS.GetState());
+ g_plugin.setByte("IgnoreContacts", gbIgnoreContacts = chk_IGNORESPAMMERS.GetState());
+ g_plugin.setByte("LogSpamToFile", gbLogToFile = chk_LOGSPAMTOFILE.GetState());
return true;
}
@@ -91,14 +91,14 @@ public: bool OnApply() override
{
- db_set_ws(NULL, MODULENAME, "question", edit_QUESTION.GetText());
- gbQuestion = DBGetContactSettingStringPAN(NULL, MODULENAME, "question", TranslateW(defQuestion));
- db_set_ws(NULL, MODULENAME, "answer", edit_ANSWER.GetText());
- gbAnswer = DBGetContactSettingStringPAN(NULL, MODULENAME, "answer", L"nospam");
- db_set_ws(NULL, MODULENAME, "authrepl", edit_AUTHREPL.GetText());
- gbAuthRepl = DBGetContactSettingStringPAN(NULL, MODULENAME, "authrepl", TranslateW(defAuthReply));
- db_set_ws(NULL, MODULENAME, "congratulation", edit_CONGRATULATION.GetText());
- gbCongratulation = DBGetContactSettingStringPAN(NULL, MODULENAME, "congratulation", TranslateW(defCongrats));
+ g_plugin.setWString("question", edit_QUESTION.GetText());
+ gbQuestion = DBGetContactSettingStringPAN(0, MODULENAME, "question", TranslateW(defQuestion));
+ g_plugin.setWString("answer", edit_ANSWER.GetText());
+ gbAnswer = DBGetContactSettingStringPAN(0, MODULENAME, "answer", L"nospam");
+ g_plugin.setWString("authrepl", edit_AUTHREPL.GetText());
+ gbAuthRepl = DBGetContactSettingStringPAN(0, MODULENAME, "authrepl", TranslateW(defAuthReply));
+ g_plugin.setWString("congratulation", edit_CONGRATULATION.GetText());
+ gbCongratulation = DBGetContactSettingStringPAN(0, MODULENAME, "congratulation", TranslateW(defCongrats));
return true;
}
@@ -152,7 +152,7 @@ public: out << str << "\r\n";
mir_free(str);
}
- db_set_s(NULL, MODULENAME, "protoList", out.str().c_str());
+ g_plugin.setString("protoList", out.str().c_str());
return true;
}
@@ -230,38 +230,38 @@ public: bool OnApply() override
{
- db_set_b(NULL, MODULENAME, "CaseInsensitive", gbCaseInsensitive = chk_CASE_INSENSITIVE.GetState());
- db_set_b(NULL, MODULENAME, "DisableInInvis", gbInvisDisable = chk_INVIS_DISABLE.GetState());
+ g_plugin.setByte("CaseInsensitive", gbCaseInsensitive = chk_CASE_INSENSITIVE.GetState());
+ g_plugin.setByte("DisableInInvis", gbInvisDisable = chk_INVIS_DISABLE.GetState());
{
static wstring NewGroupName = edit_SPECIALGROUPNAME.GetText(), CurrentGroupName;
- CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(NULL, MODULENAME, "SpammersGroup", L"0");
+ CurrentGroupName = gbSpammersGroup = DBGetContactSettingStringPAN(0, MODULENAME, "SpammersGroup", L"0");
if (mir_wstrcmp(CurrentGroupName.c_str(), NewGroupName.c_str()) != 0) {
bool GroupExist = Clist_GroupExists(NewGroupName.c_str()) != NULL;
- db_set_ws(NULL, MODULENAME, "SpammersGroup", NewGroupName.c_str());
- gbSpammersGroup = DBGetContactSettingStringPAN(NULL, MODULENAME, "SpammersGroup", L"Spammers");
+ g_plugin.setWString("SpammersGroup", NewGroupName.c_str());
+ gbSpammersGroup = DBGetContactSettingStringPAN(0, MODULENAME, "SpammersGroup", L"Spammers");
if (!GroupExist && gbSpecialGroup)
Clist_GroupCreate(0, gbSpammersGroup.c_str());
}
}
- db_set_b(NULL, MODULENAME, "SpecialGroup", gbSpecialGroup = chk_SPECIALGROUP.GetState());
- db_set_b(NULL, MODULENAME, "ExcludeContacts", gbExclude = chk_EXCLUDE.GetState());
- db_set_b(NULL, MODULENAME, "DelExcluded", gbDelExcluded = chk_REMOVE_TMP.GetState());
- db_set_b(NULL, MODULENAME, "DelAllTempory", gbDelAllTempory = chk_REMOVE_TMP_ALL.GetState());
- db_set_b(NULL, MODULENAME, "IgnoreURL", gbIgnoreURL = chk_IGNOREURL.GetState());
+ g_plugin.setByte("SpecialGroup", gbSpecialGroup = chk_SPECIALGROUP.GetState());
+ g_plugin.setByte("ExcludeContacts", gbExclude = chk_EXCLUDE.GetState());
+ g_plugin.setByte("DelExcluded", gbDelExcluded = chk_REMOVE_TMP.GetState());
+ g_plugin.setByte("DelAllTempory", gbDelAllTempory = chk_REMOVE_TMP_ALL.GetState());
+ g_plugin.setByte("IgnoreURL", gbIgnoreURL = chk_IGNOREURL.GetState());
- db_set_b(NULL, MODULENAME, "AutoAuth", gbAutoAuth = chk_AUTOAUTH.GetState());
- db_set_b(NULL, MODULENAME, "AutoAddToServerList", gbAutoAddToServerList = chk_ADDTOSRVLST.GetState());
- db_set_b(NULL, MODULENAME, "AutoReqAuth", gbAutoReqAuth = chk_REQAUTH.GetState());
- db_set_b(NULL, MODULENAME, "RegexMatch", gbRegexMatch = chk_REGEX.GetState());
- db_set_b(NULL, MODULENAME, "HistoryLog", gbHistoryLog = chk_HISTORY_LOG.GetState());
- db_set_b(NULL, MODULENAME, "MathExpression", gbMathExpression = chk_MATH_QUESTION.GetState());
+ g_plugin.setByte("AutoAuth", gbAutoAuth = chk_AUTOAUTH.GetState());
+ g_plugin.setByte("AutoAddToServerList", gbAutoAddToServerList = chk_ADDTOSRVLST.GetState());
+ g_plugin.setByte("AutoReqAuth", gbAutoReqAuth = chk_REQAUTH.GetState());
+ g_plugin.setByte("RegexMatch", gbRegexMatch = chk_REGEX.GetState());
+ g_plugin.setByte("HistoryLog", gbHistoryLog = chk_HISTORY_LOG.GetState());
+ g_plugin.setByte("MathExpression", gbMathExpression = chk_MATH_QUESTION.GetState());
{
static wstring NewAGroupName = edit_AUTOADDGROUP.GetText(), CurrentAGroupName;
- CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, MODULENAME, "AutoAuthGroup", L"0");
+ CurrentAGroupName = gbAutoAuthGroup = DBGetContactSettingStringPAN(0, MODULENAME, "AutoAuthGroup", L"0");
if (mir_wstrcmp(CurrentAGroupName.c_str(), NewAGroupName.c_str()) != 0) {
bool GroupExist = Clist_GroupExists(NewAGroupName.c_str()) != NULL;
- db_set_ws(NULL, MODULENAME, "AutoAuthGroup", NewAGroupName.c_str());
- gbAutoAuthGroup = DBGetContactSettingStringPAN(NULL, MODULENAME, "AutoAuthGroup", L"Not Spammers");
+ g_plugin.setWString("AutoAuthGroup", NewAGroupName.c_str());
+ gbAutoAuthGroup = DBGetContactSettingStringPAN(0, MODULENAME, "AutoAuthGroup", L"Not Spammers");
if (!GroupExist && gbAutoAddToServerList)
Clist_GroupCreate(0, gbAutoAuthGroup.c_str());
}
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 370def4c18..b38c2e26c4 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -54,7 +54,7 @@ wstring& GetDlgItemString(HWND hwnd, int id) std::string &GetProtoList()
{
static std::string s;
- return s = DBGetContactSettingStringPAN_A(NULL, MODULENAME, "protoList", "ICQ\r\n");
+ return s = DBGetContactSettingStringPAN_A(0, MODULENAME, "protoList", "ICQ\r\n");
}
bool ProtoInList(const char *szProto)
@@ -67,9 +67,9 @@ bool ProtoInList(const char *szProto) void DeleteCListGroupsByName(wchar_t* szGroupName)
{
- BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
+ BYTE ConfirmDelete = db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
if (ConfirmDelete)
- db_set_b(NULL, "CList", "ConfirmDelete", 0);
+ db_set_b(0, "CList", "ConfirmDelete", 0);
wchar_t *szGroup;
for (int i = 1; (szGroup = Clist_GroupGetName(i, nullptr)) != nullptr; i++)
@@ -77,7 +77,7 @@ void DeleteCListGroupsByName(wchar_t* szGroupName) Clist_GroupDelete(i);
if (ConfirmDelete)
- db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete);
+ db_set_b(0, "CList", "ConfirmDelete", ConfirmDelete);
}
int RemoveTmp(WPARAM, LPARAM)
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 9cb028e983..053461b9ae 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -51,13 +51,13 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam) do {
group_name = Clist_GroupGetName(hGroup, nullptr);
if (group_name != nullptr && wcsstr(group_name, TranslateT("Not In List"))) {
- BYTE ConfirmDelete = db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
+ BYTE ConfirmDelete = db_get_b(0, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT);
if (ConfirmDelete)
- db_set_b(NULL, "CList", "ConfirmDelete", 0);
+ db_set_b(0, "CList", "ConfirmDelete", 0);
Clist_GroupDelete(hGroup);
if (ConfirmDelete)
- db_set_b(NULL, "CList", "ConfirmDelete", ConfirmDelete);
+ db_set_b(0, "CList", "ConfirmDelete", ConfirmDelete);
break;
}
hGroup++;
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 888e848fd3..6f5bde404b 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -36,7 +36,7 @@ extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip) DBVARIANT dbv;
int result = 1;
- if (!db_get_ws(NULL, MODULENAME, szSetting, &dbv)) {
+ if (!g_plugin.getWString(szSetting, &dbv)) {
result = wcsstr(dbv.pwszVal, swzProto) ? 1 : 0;
db_free(&dbv);
}
@@ -219,43 +219,43 @@ void SaveDI(DISPLAYITEM *di, int index) void SaveOptions()
{
- db_set_dw(0, MODULENAME, "MaxWidth", opt.iWinWidth);
- db_set_dw(0, MODULENAME, "MaxHeight", opt.iWinMaxHeight);
- db_set_b(0, MODULENAME, "AvatarOpacity", (BYTE)opt.iAvatarOpacity);
- db_set_b(0, MODULENAME, "AvatarRoundCorners", (opt.bAvatarRound ? 1 : 0));
- db_set_b(0, MODULENAME, "TitleIconLayout", (BYTE)opt.titleIconLayout);
- db_set_b(0, MODULENAME, "TitleShow", (opt.bShowTitle ? 1 : 0));
+ g_plugin.setDword("MaxWidth", opt.iWinWidth);
+ g_plugin.setDword("MaxHeight", opt.iWinMaxHeight);
+ g_plugin.setByte("AvatarOpacity", (BYTE)opt.iAvatarOpacity);
+ g_plugin.setByte("AvatarRoundCorners", (opt.bAvatarRound ? 1 : 0));
+ g_plugin.setByte("TitleIconLayout", (BYTE)opt.titleIconLayout);
+ g_plugin.setByte("TitleShow", (opt.bShowTitle ? 1 : 0));
if (ServiceExists(MS_AV_DRAWAVATAR))
- db_set_b(0, MODULENAME, "AVLayout", (BYTE)opt.avatarLayout);
+ g_plugin.setByte("AVLayout", (BYTE)opt.avatarLayout);
opt.bWaitForAvatar = (opt.avatarLayout == PAV_NONE) ? false : true;
- db_set_dw(0, MODULENAME, "AVSize", opt.iAvatarSize);
- db_set_dw(0, MODULENAME, "TextIndent", opt.iTextIndent);
- db_set_dw(0, MODULENAME, "TitleIndent", opt.iTitleIndent);
- db_set_dw(0, MODULENAME, "ValueIndent", opt.iValueIndent);
- db_set_b(0, MODULENAME, "ShowNoFocus", (opt.bShowNoFocus ? 1 : 0));
+ g_plugin.setDword("AVSize", opt.iAvatarSize);
+ g_plugin.setDword("TextIndent", opt.iTextIndent);
+ g_plugin.setDword("TitleIndent", opt.iTitleIndent);
+ g_plugin.setDword("ValueIndent", opt.iValueIndent);
+ g_plugin.setByte("ShowNoFocus", (opt.bShowNoFocus ? 1 : 0));
- db_set_w(0, MODULENAME, "TimeIn", opt.iTimeIn);
+ g_plugin.setWord("TimeIn", opt.iTimeIn);
CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
- db_set_w(0, MODULENAME, "Padding", opt.iPadding);
- db_set_w(0, MODULENAME, "OuterAvatarPadding", opt.iOuterAvatarPadding);
- db_set_w(0, MODULENAME, "InnerAvatarPadding", opt.iInnerAvatarPadding);
- db_set_w(0, MODULENAME, "TextPadding", opt.iTextPadding);
- db_set_b(0, MODULENAME, "Position", (BYTE)opt.pos);
- db_set_dw(0, MODULENAME, "MinWidth", (DWORD)opt.iMinWidth);
- db_set_dw(0, MODULENAME, "MinHeight", (DWORD)opt.iMinHeight);
- db_set_dw(0, MODULENAME, "SidebarWidth", (DWORD)opt.iSidebarWidth);
- db_set_b(0, MODULENAME, "MouseTollerance", (BYTE)opt.iMouseTollerance);
- db_set_b(0, MODULENAME, "SBarTips", (opt.bStatusBarTips ? 1 : 0));
-
- db_set_w(0, MODULENAME, "LabelVAlign", opt.iLabelValign);
- db_set_w(0, MODULENAME, "LabelHAlign", opt.iLabelHalign);
- db_set_w(0, MODULENAME, "ValueVAlign", opt.iValueValign);
- db_set_w(0, MODULENAME, "ValueHAlign", opt.iValueHalign);
-
- db_set_b(0, MODULENAME, "OriginalAvSize", (opt.bOriginalAvatarSize ? 1 : 0));
- db_set_b(0, MODULENAME, "AvatarBorder", (opt.bAvatarBorder ? 1 : 0));
+ g_plugin.setWord("Padding", opt.iPadding);
+ g_plugin.setWord("OuterAvatarPadding", opt.iOuterAvatarPadding);
+ g_plugin.setWord("InnerAvatarPadding", opt.iInnerAvatarPadding);
+ g_plugin.setWord("TextPadding", opt.iTextPadding);
+ g_plugin.setByte("Position", (BYTE)opt.pos);
+ g_plugin.setDword("MinWidth", (DWORD)opt.iMinWidth);
+ g_plugin.setDword("MinHeight", (DWORD)opt.iMinHeight);
+ g_plugin.setDword("SidebarWidth", (DWORD)opt.iSidebarWidth);
+ g_plugin.setByte("MouseTollerance", (BYTE)opt.iMouseTollerance);
+ g_plugin.setByte("SBarTips", (opt.bStatusBarTips ? 1 : 0));
+
+ g_plugin.setWord("LabelVAlign", opt.iLabelValign);
+ g_plugin.setWord("LabelHAlign", opt.iLabelHalign);
+ g_plugin.setWord("ValueVAlign", opt.iValueValign);
+ g_plugin.setWord("ValueHAlign", opt.iValueHalign);
+
+ g_plugin.setByte("OriginalAvSize", (opt.bOriginalAvatarSize ? 1 : 0));
+ g_plugin.setByte("AvatarBorder", (opt.bAvatarBorder ? 1 : 0));
}
void SaveItems()
@@ -286,16 +286,16 @@ void SaveItems() void SaveSkinOptions()
{
- db_set_b(0, MODULENAME, "Border", (opt.bBorder ? 1 : 0));
- db_set_b(0, MODULENAME, "DropShadow", (opt.bDropShadow ? 1 : 0));
- db_set_b(0, MODULENAME, "RoundCorners", (opt.bRound ? 1 : 0));
- db_set_b(0, MODULENAME, "AeroGlass", (opt.bAeroGlass ? 1 : 0));
- db_set_b(0, MODULENAME, "Opacity", (BYTE)opt.iOpacity);
- db_set_b(0, MODULENAME, "ShowEffect", (BYTE)opt.showEffect);
- db_set_b(0, MODULENAME, "ShowEffectSpeed", (BYTE)opt.iAnimateSpeed);
- db_set_b(0, MODULENAME, "LoadFonts", (opt.bLoadFonts ? 1 : 0));
- db_set_b(0, MODULENAME, "LoadProportions", (opt.bLoadProportions ? 1 : 0));
- db_set_dw(0, MODULENAME, "EnableColoring", opt.iEnableColoring);
+ g_plugin.setByte("Border", (opt.bBorder ? 1 : 0));
+ g_plugin.setByte("DropShadow", (opt.bDropShadow ? 1 : 0));
+ g_plugin.setByte("RoundCorners", (opt.bRound ? 1 : 0));
+ g_plugin.setByte("AeroGlass", (opt.bAeroGlass ? 1 : 0));
+ g_plugin.setByte("Opacity", (BYTE)opt.iOpacity);
+ g_plugin.setByte("ShowEffect", (BYTE)opt.showEffect);
+ g_plugin.setByte("ShowEffectSpeed", (BYTE)opt.iAnimateSpeed);
+ g_plugin.setByte("LoadFonts", (opt.bLoadFonts ? 1 : 0));
+ g_plugin.setByte("LoadProportions", (opt.bLoadProportions ? 1 : 0));
+ g_plugin.setDword("EnableColoring", opt.iEnableColoring);
}
void LoadObsoleteSkinSetting()
@@ -305,15 +305,15 @@ void LoadObsoleteSkinSetting() for (int i = 0; i < SKIN_ITEMS_COUNT; i++) {
mir_snprintf(setting, "SPaintMode%d", i);
- opt.transfMode[i] = (TransformationMode)db_get_b(0, MODULENAME, setting, 0);
+ opt.transfMode[i] = (TransformationMode)g_plugin.getByte(setting, 0);
mir_snprintf(setting, "SImgFile%d", i);
- if (!db_get_ws(NULL, MODULENAME, setting, &dbv)) {
+ if (!g_plugin.getWString(setting, &dbv)) {
opt.szImgFile[i] = mir_wstrdup(dbv.pwszVal);
db_free(&dbv);
}
mir_snprintf(setting, "SGlyphMargins%d", i);
- DWORD margins = db_get_dw(NULL, MODULENAME, setting, 0);
+ DWORD margins = g_plugin.getDword(setting, 0);
opt.margins[i].top = LOBYTE(LOWORD(margins));
opt.margins[i].right = HIBYTE(LOWORD(margins));
opt.margins[i].bottom = LOBYTE(HIWORD(margins));
@@ -323,25 +323,25 @@ void LoadObsoleteSkinSetting() void LoadOptions()
{
- opt.iWinWidth = db_get_dw(0, MODULENAME, "MaxWidth", 420);
- opt.iWinMaxHeight = db_get_dw(0, MODULENAME, "MaxHeight", 400);
- opt.iAvatarOpacity = db_get_b(0, MODULENAME, "AvatarOpacity", 100);
+ opt.iWinWidth = g_plugin.getDword("MaxWidth", 420);
+ opt.iWinMaxHeight = g_plugin.getDword("MaxHeight", 400);
+ opt.iAvatarOpacity = g_plugin.getByte("AvatarOpacity", 100);
if (opt.iAvatarOpacity > 100) opt.iAvatarOpacity = 100;
- opt.bAvatarRound = (db_get_b(0, MODULENAME, "AvatarRoundCorners", opt.bRound ? 1 : 0) == 1);
- opt.titleIconLayout = (PopupIconTitleLayout)db_get_b(0, MODULENAME, "TitleIconLayout", (BYTE)PTL_LEFTICON);
- opt.bShowTitle = (db_get_b(0, MODULENAME, "TitleShow", 1) == 1);
+ opt.bAvatarRound = (g_plugin.getByte("AvatarRoundCorners", opt.bRound ? 1 : 0) == 1);
+ opt.titleIconLayout = (PopupIconTitleLayout)g_plugin.getByte("TitleIconLayout", (BYTE)PTL_LEFTICON);
+ opt.bShowTitle = (g_plugin.getByte("TitleShow", 1) == 1);
if (ServiceExists(MS_AV_DRAWAVATAR))
- opt.avatarLayout = (PopupAvLayout)db_get_b(0, MODULENAME, "AVLayout", PAV_RIGHT);
+ opt.avatarLayout = (PopupAvLayout)g_plugin.getByte("AVLayout", PAV_RIGHT);
else
opt.avatarLayout = PAV_NONE;
opt.bWaitForAvatar = (opt.avatarLayout == PAV_NONE) ? false : true;
- opt.iAvatarSize = db_get_dw(0, MODULENAME, "AVSize", 60); //tweety
- opt.iTextIndent = db_get_dw(0, MODULENAME, "TextIndent", 22);
- opt.iTitleIndent = db_get_dw(0, MODULENAME, "TitleIndent", 22);
- opt.iValueIndent = db_get_dw(0, MODULENAME, "ValueIndent", 10);
- opt.iSidebarWidth = db_get_dw(0, MODULENAME, "SidebarWidth", 22);
- opt.bShowNoFocus = (db_get_b(0, MODULENAME, "ShowNoFocus", 1) == 1);
+ opt.iAvatarSize = g_plugin.getDword("AVSize", 60); //tweety
+ opt.iTextIndent = g_plugin.getDword("TextIndent", 22);
+ opt.iTitleIndent = g_plugin.getDword("TitleIndent", 22);
+ opt.iValueIndent = g_plugin.getDword("ValueIndent", 10);
+ opt.iSidebarWidth = g_plugin.getDword("SidebarWidth", 22);
+ opt.bShowNoFocus = (g_plugin.getByte("ShowNoFocus", 1) == 1);
int i, real_count = 0;
opt.dsList = nullptr;
@@ -378,21 +378,21 @@ void LoadOptions() }
opt.iDiCount = real_count;
- opt.iTimeIn = db_get_w(0, MODULENAME, "TimeIn", 750);
- opt.iPadding = db_get_w(0, MODULENAME, "Padding", 4);
- opt.iOuterAvatarPadding = db_get_w(0, MODULENAME, "OuterAvatarPadding", 6);
- opt.iInnerAvatarPadding = db_get_w(0, MODULENAME, "InnerAvatarPadding", 10);
- opt.iTextPadding = db_get_w(0, MODULENAME, "TextPadding", 4);
- opt.pos = (PopupPosition)db_get_b(0, MODULENAME, "Position", (BYTE)PP_BOTTOMRIGHT);
- opt.iMinWidth = db_get_dw(0, MODULENAME, "MinWidth", 0);
- opt.iMinHeight = db_get_dw(0, MODULENAME, "MinHeight", 0);
+ opt.iTimeIn = g_plugin.getWord("TimeIn", 750);
+ opt.iPadding = g_plugin.getWord("Padding", 4);
+ opt.iOuterAvatarPadding = g_plugin.getWord("OuterAvatarPadding", 6);
+ opt.iInnerAvatarPadding = g_plugin.getWord("InnerAvatarPadding", 10);
+ opt.iTextPadding = g_plugin.getWord("TextPadding", 4);
+ opt.pos = (PopupPosition)g_plugin.getByte("Position", (BYTE)PP_BOTTOMRIGHT);
+ opt.iMinWidth = g_plugin.getDword("MinWidth", 0);
+ opt.iMinHeight = g_plugin.getDword("MinHeight", 0);
- opt.iMouseTollerance = db_get_b(0, MODULENAME, "MouseTollerance", (BYTE)GetSystemMetrics(SM_CXSMICON));
- opt.bStatusBarTips = (db_get_b(0, MODULENAME, "SBarTips", 1) == 1);
+ opt.iMouseTollerance = g_plugin.getByte("MouseTollerance", (BYTE)GetSystemMetrics(SM_CXSMICON));
+ opt.bStatusBarTips = (g_plugin.getByte("SBarTips", 1) == 1);
// convert defunct last message and status message options to new 'sys' items, and remove the old settings
- if (db_get_b(0, MODULENAME, "ShowLastMessage", 0)) {
- db_unset(0, MODULENAME, "ShowLastMessage");
+ if (g_plugin.getByte("ShowLastMessage", 0)) {
+ g_plugin.delSetting("ShowLastMessage");
// find end of list
di_node = opt.diList;
@@ -416,8 +416,8 @@ void LoadOptions() opt.iDiCount++;
}
- if (db_get_b(0, MODULENAME, "ShowStatusMessage", 0)) {
- db_unset(0, MODULENAME, "ShowStatusMessage");
+ if (g_plugin.getByte("ShowStatusMessage", 0)) {
+ g_plugin.delSetting("ShowStatusMessage");
// find end of list
di_node = opt.diList;
@@ -441,31 +441,31 @@ void LoadOptions() opt.iDiCount++;
}
- opt.iLabelValign = db_get_w(0, MODULENAME, "LabelVAlign", DT_TOP /*DT_VCENTER*/);
- opt.iLabelHalign = db_get_w(0, MODULENAME, "LabelHAlign", DT_LEFT);
- opt.iValueValign = db_get_w(0, MODULENAME, "ValueVAlign", DT_TOP /*DT_VCENTER*/);
- opt.iValueHalign = db_get_w(0, MODULENAME, "ValueHAlign", DT_LEFT);
+ opt.iLabelValign = g_plugin.getWord("LabelVAlign", DT_TOP /*DT_VCENTER*/);
+ opt.iLabelHalign = g_plugin.getWord("LabelHAlign", DT_LEFT);
+ opt.iValueValign = g_plugin.getWord("ValueVAlign", DT_TOP /*DT_VCENTER*/);
+ opt.iValueHalign = g_plugin.getWord("ValueHAlign", DT_LEFT);
// tray tooltip
- opt.bTraytip = db_get_b(0, MODULENAME, "TrayTip", 1) ? true : false;
- opt.bHandleByTipper = db_get_b(0, MODULENAME, "ExtendedTrayTip", 1) ? true : false;
- opt.bExpandTraytip = db_get_b(0, MODULENAME, "ExpandTrayTip", 1) ? true : false;
- opt.bHideOffline = db_get_b(0, MODULENAME, "HideOffline", 0) ? true : false;
- opt.iExpandTime = db_get_dw(0, MODULENAME, "ExpandTime", 1000);
- opt.iFirstItems = db_get_dw(0, MODULENAME, "TrayTipItems", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_CLIST_EVENT);
- opt.iSecondItems = db_get_dw(0, MODULENAME, "TrayTipItemsEx", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_STATUS_MSG | TRAYTIP_EXTRA_STATUS | TRAYTIP_MIRANDA_UPTIME | TRAYTIP_CLIST_EVENT);
- opt.iFavoriteContFlags = db_get_dw(0, MODULENAME, "FavContFlags", FAVCONT_APPEND_PROTO);
+ opt.bTraytip = g_plugin.getByte("TrayTip", 1) ? true : false;
+ opt.bHandleByTipper = g_plugin.getByte("ExtendedTrayTip", 1) ? true : false;
+ opt.bExpandTraytip = g_plugin.getByte("ExpandTrayTip", 1) ? true : false;
+ opt.bHideOffline = g_plugin.getByte("HideOffline", 0) ? true : false;
+ opt.iExpandTime = g_plugin.getDword("ExpandTime", 1000);
+ opt.iFirstItems = g_plugin.getDword("TrayTipItems", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_CLIST_EVENT);
+ opt.iSecondItems = g_plugin.getDword("TrayTipItemsEx", TRAYTIP_NUMCONTACTS | TRAYTIP_LOGON | TRAYTIP_STATUS | TRAYTIP_STATUS_MSG | TRAYTIP_EXTRA_STATUS | TRAYTIP_MIRANDA_UPTIME | TRAYTIP_CLIST_EVENT);
+ opt.iFavoriteContFlags = g_plugin.getDword("FavContFlags", FAVCONT_APPEND_PROTO);
// extra setting
- opt.bWaitForContent = db_get_b(0, MODULENAME, "WaitForContent", 0) ? true : false;
- opt.bGetNewStatusMsg = db_get_b(0, MODULENAME, "GetNewStatusMsg", 0) ? true : false;
- opt.bDisableIfInvisible = db_get_b(0, MODULENAME, "DisableInvisible", 1) ? true : false;
- opt.bRetrieveXstatus = db_get_b(0, MODULENAME, "RetrieveXStatus", 0) ? true : false;
- opt.bOriginalAvatarSize = db_get_b(0, MODULENAME, "OriginalAvSize", 0) ? true : false;
- opt.bAvatarBorder = db_get_b(0, MODULENAME, "AvatarBorder", 0) ? true : false;
- opt.bLimitMsg = db_get_b(0, MODULENAME, "LimitMsg", 0) ? true : false;
- opt.iLimitCharCount = db_get_b(0, MODULENAME, "LimitCharCount", 64);
- opt.iSmileyAddFlags = db_get_dw(0, MODULENAME, "SmileyAddFlags", SMILEYADD_ENABLE);
+ opt.bWaitForContent = g_plugin.getByte("WaitForContent", 0) ? true : false;
+ opt.bGetNewStatusMsg = g_plugin.getByte("GetNewStatusMsg", 0) ? true : false;
+ opt.bDisableIfInvisible = g_plugin.getByte("DisableInvisible", 1) ? true : false;
+ opt.bRetrieveXstatus = g_plugin.getByte("RetrieveXStatus", 0) ? true : false;
+ opt.bOriginalAvatarSize = g_plugin.getByte("OriginalAvSize", 0) ? true : false;
+ opt.bAvatarBorder = g_plugin.getByte("AvatarBorder", 0) ? true : false;
+ opt.bLimitMsg = g_plugin.getByte("LimitMsg", 0) ? true : false;
+ opt.iLimitCharCount = g_plugin.getByte("LimitCharCount", 64);
+ opt.iSmileyAddFlags = g_plugin.getDword("SmileyAddFlags", SMILEYADD_ENABLE);
DBVARIANT dbv;
// Load the icons order
@@ -474,12 +474,12 @@ void LoadOptions() opt.exIconsVis[i] = 1;
}
- if (!db_get(NULL, MODULENAME, "IconOrder", &dbv)) {
+ if (!db_get(0, MODULENAME, "IconOrder", &dbv)) {
memcpy(opt.exIconsOrder, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
- if (!db_get(NULL, MODULENAME, "icons_vis", &dbv)) {
+ if (!db_get(0, MODULENAME, "icons_vis", &dbv)) {
memcpy(opt.exIconsVis, dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
}
@@ -489,31 +489,31 @@ void LoadOptions() exIcons[i].vis = opt.exIconsVis[i];
}
- opt.iOpacity = db_get_b(0, MODULENAME, "Opacity", 75);
- opt.bBorder = db_get_b(0, MODULENAME, "Border", 1) ? true : false;
- opt.bDropShadow = db_get_b(0, MODULENAME, "DropShadow", 1) ? true : false;
- opt.bRound = db_get_b(0, MODULENAME, "RoundCorners", 1) ? true : false;
- opt.bAeroGlass = db_get_b(0, MODULENAME, "AeroGlass", 0) ? true : false;
- opt.showEffect = (PopupShowEffect)db_get_b(0, MODULENAME, "ShowEffect", (BYTE)PSE_FADE);
- opt.iAnimateSpeed = db_get_b(0, MODULENAME, "ShowEffectSpeed", 12);
+ opt.iOpacity = g_plugin.getByte("Opacity", 75);
+ opt.bBorder = g_plugin.getByte("Border", 1) ? true : false;
+ opt.bDropShadow = g_plugin.getByte("DropShadow", 1) ? true : false;
+ opt.bRound = g_plugin.getByte("RoundCorners", 1) ? true : false;
+ opt.bAeroGlass = g_plugin.getByte("AeroGlass", 0) ? true : false;
+ opt.showEffect = (PopupShowEffect)g_plugin.getByte("ShowEffect", (BYTE)PSE_FADE);
+ opt.iAnimateSpeed = g_plugin.getByte("ShowEffectSpeed", 12);
if (opt.iAnimateSpeed < 1)
opt.iAnimateSpeed = 1;
else if (opt.iAnimateSpeed > 20)
opt.iAnimateSpeed = 20;
- int iBgImg = db_get_b(0, MODULENAME, "SBgImage", 0);
- opt.skinMode = (SkinMode)db_get_b(0, MODULENAME, "SkinEngine", iBgImg ? SM_OBSOLOTE : SM_COLORFILL);
- opt.bLoadFonts = db_get_b(0, MODULENAME, "LoadFonts", 1) ? true : false;
- opt.bLoadProportions = db_get_b(0, MODULENAME, "LoadProportions", 1) ? true : false;
- opt.iEnableColoring = db_get_dw(0, MODULENAME, "EnableColoring", 0);
+ int iBgImg = g_plugin.getByte("SBgImage", 0);
+ opt.skinMode = (SkinMode)g_plugin.getByte("SkinEngine", iBgImg ? SM_OBSOLOTE : SM_COLORFILL);
+ opt.bLoadFonts = g_plugin.getByte("LoadFonts", 1) ? true : false;
+ opt.bLoadProportions = g_plugin.getByte("LoadProportions", 1) ? true : false;
+ opt.iEnableColoring = g_plugin.getDword("EnableColoring", 0);
opt.szSkinName[0] = 0;
if (opt.skinMode == SM_OBSOLOTE) {
LoadObsoleteSkinSetting();
}
else if (opt.skinMode == SM_IMAGE) {
- if (!db_get_ws(NULL, MODULENAME, "SkinName", &dbv)) {
+ if (!g_plugin.getWString("SkinName", &dbv)) {
wcsncpy(opt.szSkinName, dbv.pwszVal, _countof(opt.szSkinName) - 1);
db_free(&dbv);
}
@@ -1500,8 +1500,8 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), item.hItem);
i++;
}
- db_set_blob(NULL, MODULENAME, "IconOrder", opt.exIconsOrder, _countof(opt.exIconsOrder));
- db_set_blob(NULL, MODULENAME, "icons_vis", opt.exIconsVis, _countof(opt.exIconsVis));
+ db_set_blob(0, MODULENAME, "IconOrder", opt.exIconsOrder, _countof(opt.exIconsOrder));
+ db_set_blob(0, MODULENAME, "icons_vis", opt.exIconsVis, _countof(opt.exIconsVis));
opt.iSmileyAddFlags = 0;
opt.iSmileyAddFlags |= (IsDlgButtonChecked(hwndDlg, IDC_CHK_ENABLESMILEYS) ? SMILEYADD_ENABLE : 0)
@@ -1516,13 +1516,13 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM opt.bLimitMsg = IsDlgButtonChecked(hwndDlg, IDC_CHK_LIMITMSG) ? true : false;
opt.iLimitCharCount = GetDlgItemInt(hwndDlg, IDC_ED_CHARCOUNT, nullptr, FALSE);
- db_set_dw(0, MODULENAME, "SmileyAddFlags", opt.iSmileyAddFlags);
- db_set_b(0, MODULENAME, "WaitForContent", opt.bWaitForContent ? 1 : 0);
- db_set_b(0, MODULENAME, "GetNewStatusMsg", opt.bGetNewStatusMsg ? 1 : 0);
- db_set_b(0, MODULENAME, "DisableInvisible", opt.bDisableIfInvisible ? 1 : 0);
- db_set_b(0, MODULENAME, "RetrieveXStatus", opt.bRetrieveXstatus ? 1 : 0);
- db_set_b(0, MODULENAME, "LimitMsg", opt.bLimitMsg ? 1 : 0);
- db_set_b(0, MODULENAME, "LimitCharCount", opt.iLimitCharCount);
+ g_plugin.setDword("SmileyAddFlags", opt.iSmileyAddFlags);
+ g_plugin.setByte("WaitForContent", opt.bWaitForContent ? 1 : 0);
+ g_plugin.setByte("GetNewStatusMsg", opt.bGetNewStatusMsg ? 1 : 0);
+ g_plugin.setByte("DisableInvisible", opt.bDisableIfInvisible ? 1 : 0);
+ g_plugin.setByte("RetrieveXStatus", opt.bRetrieveXstatus ? 1 : 0);
+ g_plugin.setByte("LimitMsg", opt.bLimitMsg ? 1 : 0);
+ g_plugin.setByte("LimitCharCount", opt.iLimitCharCount);
return TRUE;
}
@@ -1785,8 +1785,8 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l }
}
- db_set_b(0, MODULENAME, "SkinEngine", opt.skinMode);
- db_set_ws(0, MODULENAME, "SkinName", opt.szSkinName);
+ g_plugin.setByte("SkinEngine", opt.skinMode);
+ g_plugin.setWString("SkinName", opt.szSkinName);
DestroySkinBitmap();
SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE);
@@ -1838,7 +1838,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
@@ -1868,13 +1868,13 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, count++;
}
}
- db_set_dw(0, MODULENAME, "FavouriteContactsCount", count);
+ g_plugin.setDword("FavouriteContactsCount", count);
opt.iFavoriteContFlags = 0;
opt.iFavoriteContFlags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? FAVCONT_HIDE_OFFLINE : 0
| IsDlgButtonChecked(hwndDlg, IDC_CHK_APPENDPROTO) ? FAVCONT_APPEND_PROTO : 0;
- db_set_dw(0, MODULENAME, "FavContFlags", opt.iFavoriteContFlags);
+ g_plugin.setDword("FavContFlags", opt.iFavoriteContFlags);
}
__fallthrough;
@@ -1997,7 +1997,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), item.hItem);
}
- db_set_ws(0, MODULENAME, "TrayProtocols", swzProtos);
+ g_plugin.setWString("TrayProtocols", swzProtos);
swzProtos[0] = 0;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS));
@@ -2012,7 +2012,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), item.hItem);
}
- db_set_ws(0, MODULENAME, "TrayProtocolsEx", swzProtos);
+ g_plugin.setWString("TrayProtocolsEx", swzProtos);
int count = 0;
opt.iFirstItems = 0;
@@ -2046,13 +2046,13 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA opt.bHideOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEOFFLINE) ? true : false;
opt.iExpandTime = max(min(GetDlgItemInt(hwndDlg, IDC_ED_EXPANDTIME, nullptr, FALSE), 5000), 10);
- db_set_b(0, MODULENAME, "TrayTip", (opt.bTraytip ? 1 : 0));
- db_set_b(0, MODULENAME, "ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
- db_set_b(0, MODULENAME, "ExpandTrayTip", (opt.bExpandTraytip ? 1 : 0));
- db_set_b(0, MODULENAME, "HideOffline", (opt.bHideOffline ? 1 : 0));
- db_set_dw(0, MODULENAME, "ExpandTime", opt.iExpandTime);
- db_set_dw(0, MODULENAME, "TrayTipItems", opt.iFirstItems);
- db_set_dw(0, MODULENAME, "TrayTipItemsEx", opt.iSecondItems);
+ g_plugin.setByte("TrayTip", (opt.bTraytip ? 1 : 0));
+ g_plugin.setByte("ExtendedTrayTip", (opt.bHandleByTipper ? 1 : 0));
+ g_plugin.setByte("ExpandTrayTip", (opt.bExpandTraytip ? 1 : 0));
+ g_plugin.setByte("HideOffline", (opt.bHideOffline ? 1 : 0));
+ g_plugin.setDword("ExpandTime", opt.iExpandTime);
+ g_plugin.setDword("TrayTipItems", opt.iFirstItems);
+ g_plugin.setDword("TrayTipItemsEx", opt.iSecondItems);
return TRUE;
}
break;
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 716d0098b7..7624cdcd55 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -1579,7 +1579,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } if (dwItems & TRAYTIP_FAVCONTACTS) { - if (db_get_dw(0, MODULENAME, "FavouriteContactsCount", 0)) { + if (g_plugin.getDword("FavouriteContactsCount", 0)) { wchar_t swzName[256]; wchar_t swzStatus[256]; bool bTitlePainted = false; @@ -1633,7 +1633,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } if (dwItems & TRAYTIP_MIRANDA_UPTIME) { - if (TimestampToTimeDifference(NULL, MODULENAME, "MirandaStartTS", buff, 64)) { + if (TimestampToTimeDifference(0, MODULENAME, "MirandaStartTS", buff, 64)) { AddRow(pwd, TranslateT("Other"), L"", nullptr, false, false, !bFirstItem, true, nullptr); AddRow(pwd, TranslateT("Miranda uptime:"), buff, nullptr, false, false, false); } diff --git a/plugins/TipperYM/src/skin_parser.cpp b/plugins/TipperYM/src/skin_parser.cpp index 485a46609e..cb57ceacc5 100644 --- a/plugins/TipperYM/src/skin_parser.cpp +++ b/plugins/TipperYM/src/skin_parser.cpp @@ -209,7 +209,7 @@ void ParseFontPart(FILE *fp, wchar_t *buff) if (mir_wstrlen(pch) > 32)
pch[32] = 0;
- db_set_ws(0, MODULENAME, szSetting, pch);
+ g_plugin.setWString(szSetting, pch);
}
}
else if (wcsstr(buff, L"color"))
@@ -226,7 +226,7 @@ void ParseFontPart(FILE *fp, wchar_t *buff) {
BYTE b = _wtoi(pch);
COLORREF color = RGB(r, g ,b);
- db_set_dw(0, MODULENAME, szSetting, color);
+ g_plugin.setDword(szSetting, color);
}
}
}
@@ -237,7 +237,7 @@ void ParseFontPart(FILE *fp, wchar_t *buff) {
HDC hdc = GetDC(nullptr);
int size = -MulDiv(_wtoi(pch), GetDeviceCaps(hdc, LOGPIXELSY), 72);
- db_set_b(0, MODULENAME, szSetting, (BYTE)size);
+ g_plugin.setByte(szSetting, (BYTE)size);
ReleaseDC(nullptr, hdc);
}
}
@@ -253,7 +253,7 @@ void ParseFontPart(FILE *fp, wchar_t *buff) if (wcsstr(pch, L"font_underline"))
effect |= DBFONTF_UNDERLINE;
- db_set_b(0, MODULENAME, szSetting, effect);
+ g_plugin.setByte(szSetting, effect);
}
}
}
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 34a7bde2cb..b46fd74dcf 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -78,7 +78,7 @@ bool CheckContactType(MCONTACT hContact, const DISPLAYITEM &di) void StripBBCodesInPlace(wchar_t *ptszText) { - if (!db_get_b(0, MODULENAME, "StripBBCodes", 1)) + if (!g_plugin.getByte("StripBBCodes", 1)) return; if (ptszText == nullptr) diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 3c048e0489..0cae9b3abe 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -248,7 +248,7 @@ static int ModulesLoaded(WPARAM, LPARAM) CallService(MS_CLC_SETINFOTIPHOVERTIME, opt.iTimeIn, 0);
// set Miranda start timestamp
- db_set_dw(0, MODULENAME, "MirandaStartTS", (DWORD)time(0));
+ g_plugin.setDword("MirandaStartTS", (DWORD)time(0));
return 0;
}
@@ -279,8 +279,8 @@ static INT_PTR ReloadSkin(WPARAM wParam, LPARAM lParam) ReloadFont(0, 0);
SaveOptions();
- db_set_b(0, MODULENAME, "SkinEngine", opt.skinMode);
- db_set_ws(0, MODULENAME, "SkinName", opt.szSkinName);
+ g_plugin.setByte("SkinEngine", opt.skinMode);
+ g_plugin.setWString("SkinName", opt.szSkinName);
DestroySkinBitmap();
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index cde67b2709..4fb336b948 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -126,11 +126,11 @@ int CTooltipNotify::ModulesLoaded(WPARAM, LPARAM) ValidateSettings();
if (m_sOptions.bFirstRun) {
- db_set_b(NULL, "SkinSoundsOff", SND_ONLINE, 1);
- db_set_b(NULL, "SkinSoundsOff", SND_OFFLINE, 1);
- db_set_b(NULL, "SkinSoundsOff", SND_OTHER, 1);
- db_set_b(NULL, "SkinSoundsOff", SND_TYPING, 1);
- db_set_b(NULL, MODULENAME, "firstrun", 0);
+ db_set_b(0, "SkinSoundsOff", SND_ONLINE, 1);
+ db_set_b(0, "SkinSoundsOff", SND_OFFLINE, 1);
+ db_set_b(0, "SkinSoundsOff", SND_OTHER, 1);
+ db_set_b(0, "SkinSoundsOff", SND_TYPING, 1);
+ g_plugin.setByte("firstrun", 0);
}
g_plugin.addSound(SND_ONLINE, LPGENW("Tooltip Notify"), LPGENW("Online"), L"online.wav");
@@ -176,9 +176,9 @@ int CTooltipNotify::ProtoAck(WPARAM, LPARAM lParam) char *szProtocol = (char *)ack->szModule;
if (wNewStatus == ID_STATUS_OFFLINE) {
- BYTE bProtoActive = db_get_b(NULL, MODULENAME, szProtocol, ProtoUserBit | ProtoIntBit);
+ BYTE bProtoActive = g_plugin.getByte(szProtocol, ProtoUserBit | ProtoIntBit);
bProtoActive &= ~ProtoIntBit;
- db_set_b(NULL, MODULENAME, szProtocol, bProtoActive);
+ g_plugin.setByte(szProtocol, bProtoActive);
}
else {
if (wOldStatus < ID_STATUS_ONLINE && wNewStatus > ID_STATUS_OFFLINE) {
@@ -208,7 +208,7 @@ int CTooltipNotify::ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
const char *pszProto = cws->szModule;
- if (db_get_b(NULL, MODULENAME, pszProto, ProtoUserBit | ProtoIntBit) != (ProtoUserBit | ProtoIntBit))
+ if (g_plugin.getByte(pszProto, ProtoUserBit | ProtoIntBit) != (ProtoUserBit | ProtoIntBit))
return 0;
if (db_get_b(hContact, "CList", "NotOnList", 0) && m_sOptions.bIgnoreUnknown)
@@ -356,9 +356,9 @@ void CTooltipNotify::OnConnectionTimer(HWND, UINT, UINT_PTR idEvent, DWORD) MapTimerIdProtoIter iter = FindProtoByTimer(idEvent);
assert(iter != m_mapTimerIdProto.end());
- BYTE bProtoActive = db_get_b(NULL, MODULENAME, iter->proto, ProtoUserBit | ProtoIntBit);
+ BYTE bProtoActive = g_plugin.getByte(iter->proto, ProtoUserBit | ProtoIntBit);
bProtoActive |= ProtoIntBit;
- db_set_b(NULL, MODULENAME, iter->proto, bProtoActive);
+ g_plugin.setByte(iter->proto, bProtoActive);
free((char*)iter->proto);
m_mapTimerIdProto.erase(iter);
@@ -389,10 +389,10 @@ static arSettings[] = void CTooltipNotify::MigrateSettings()
{
for (int i = 0; i < _countof(arSettings); i++) {
- int val = db_get_w(NULL, MODULENAME, arSettings[i].szOldSetting, -1);
+ int val = g_plugin.getWord(arSettings[i].szOldSetting, -1);
if (val != -1) {
- db_set_w(NULL, MODULENAME, arSettings[i].szNewSetting, val);
- db_unset(NULL, MODULENAME, arSettings[i].szOldSetting);
+ g_plugin.setWord(arSettings[i].szNewSetting, val);
+ g_plugin.delSetting(arSettings[i].szOldSetting);
}
}
}
@@ -401,47 +401,47 @@ void CTooltipNotify::MigrateSettings() void CTooltipNotify::LoadSettings()
{
- m_sOptions.bFirstRun = db_get_b(NULL, MODULENAME, "firstrun", DEF_SETTING_FIRSTRUN);
- m_sOptions.bOffline = db_get_b(NULL, MODULENAME, "offline", DEF_SETTING_OFFLINE);
- m_sOptions.bOnline = db_get_b(NULL, MODULENAME, "online", DEF_SETTING_ONLINE);
- m_sOptions.bOther = db_get_b(NULL, MODULENAME, "other", DEF_SETTING_OTHER);
- m_sOptions.bTyping = db_get_b(NULL, MODULENAME, "typing", DEF_SETTING_TYPING);
- m_sOptions.bIdle = db_get_b(NULL, MODULENAME, "idle", DEF_SETTING_TYPING);
- m_sOptions.bX2 = db_get_b(NULL, MODULENAME, "x2", DEF_SETTING_X2);
- m_sOptions.bConjSOLN = db_get_b(NULL, MODULENAME, "conjsoln", DEF_SETTING_CONJSOLN);
- m_sOptions.bAutoPos = db_get_b(NULL, MODULENAME, "autopos", DEF_SETTING_DEF_POS);
- m_sOptions.bBallonTip = db_get_b(NULL, MODULENAME, "balloontip", DEF_SETTING_BALLONTIP);
- m_sOptions.bTransp = db_get_b(NULL, MODULENAME, "transp", DEF_SETTING_TRANSP);
- m_sOptions.bAlpha = db_get_b(NULL, MODULENAME, "alpha", DEF_SETTING_ALPHA);
- m_sOptions.bTranspInput = db_get_b(NULL, MODULENAME, "transpinput", DEF_SETTING_TRANSP_INPUT);
- m_sOptions.bPrefixProto = db_get_b(NULL, MODULENAME, "prfxproto", DEF_SETTING_PREFIX_PROTO);
- m_sOptions.bLDblClick = db_get_b(NULL, MODULENAME, "ldblclick", DEF_SETTING_LDBLCLICK);
- m_sOptions.wDuration = db_get_w(NULL, MODULENAME, "duration", DEF_SETTING_DURATION);
- m_sOptions.wStartupDelay = db_get_w(NULL, MODULENAME, "suprconndelay", DEF_SETTING_STARTUP_DELAY);
- m_sOptions.bIgnoreUnknown = db_get_b(NULL, MODULENAME, "ignoreunknown", DEF_SETTING_IGNORE_UNKNOWN);
- m_sOptions.bIgnoreNew = db_get_b(NULL, MODULENAME, "ignorenew", DEF_SETTING_IGNORE_NEW);
+ m_sOptions.bFirstRun = g_plugin.getByte("firstrun", DEF_SETTING_FIRSTRUN);
+ m_sOptions.bOffline = g_plugin.getByte("offline", DEF_SETTING_OFFLINE);
+ m_sOptions.bOnline = g_plugin.getByte("online", DEF_SETTING_ONLINE);
+ m_sOptions.bOther = g_plugin.getByte("other", DEF_SETTING_OTHER);
+ m_sOptions.bTyping = g_plugin.getByte("typing", DEF_SETTING_TYPING);
+ m_sOptions.bIdle = g_plugin.getByte("idle", DEF_SETTING_TYPING);
+ m_sOptions.bX2 = g_plugin.getByte("x2", DEF_SETTING_X2);
+ m_sOptions.bConjSOLN = g_plugin.getByte("conjsoln", DEF_SETTING_CONJSOLN);
+ m_sOptions.bAutoPos = g_plugin.getByte("autopos", DEF_SETTING_DEF_POS);
+ m_sOptions.bBallonTip = g_plugin.getByte("balloontip", DEF_SETTING_BALLONTIP);
+ m_sOptions.bTransp = g_plugin.getByte("transp", DEF_SETTING_TRANSP);
+ m_sOptions.bAlpha = g_plugin.getByte("alpha", DEF_SETTING_ALPHA);
+ m_sOptions.bTranspInput = g_plugin.getByte("transpinput", DEF_SETTING_TRANSP_INPUT);
+ m_sOptions.bPrefixProto = g_plugin.getByte("prfxproto", DEF_SETTING_PREFIX_PROTO);
+ m_sOptions.bLDblClick = g_plugin.getByte("ldblclick", DEF_SETTING_LDBLCLICK);
+ m_sOptions.wDuration = g_plugin.getWord("duration", DEF_SETTING_DURATION);
+ m_sOptions.wStartupDelay = g_plugin.getWord("suprconndelay", DEF_SETTING_STARTUP_DELAY);
+ m_sOptions.bIgnoreUnknown = g_plugin.getByte("ignoreunknown", DEF_SETTING_IGNORE_UNKNOWN);
+ m_sOptions.bIgnoreNew = g_plugin.getByte("ignorenew", DEF_SETTING_IGNORE_NEW);
}
void CTooltipNotify::SaveSettings()
{
- db_set_w(NULL, MODULENAME, "duration", m_sOptions.wDuration);
- db_set_w(NULL, MODULENAME, "suprconndelay", m_sOptions.wStartupDelay);
- db_set_b(NULL, MODULENAME, "offline", m_sOptions.bOffline);
- db_set_b(NULL, MODULENAME, "online", m_sOptions.bOnline);
- db_set_b(NULL, MODULENAME, "other", m_sOptions.bOther);
- db_set_b(NULL, MODULENAME, "typing", m_sOptions.bTyping);
- db_set_b(NULL, MODULENAME, "idle", m_sOptions.bIdle);
- db_set_b(NULL, MODULENAME, "prfxproto", m_sOptions.bPrefixProto);
- db_set_b(NULL, MODULENAME, "x2", m_sOptions.bX2);
- db_set_b(NULL, MODULENAME, "conjsoln", m_sOptions.bConjSOLN);
- db_set_b(NULL, MODULENAME, "autopos", m_sOptions.bAutoPos);
- db_set_b(NULL, MODULENAME, "balloontip", m_sOptions.bBallonTip);
- db_set_b(NULL, MODULENAME, "transp", m_sOptions.bTransp);
- db_set_b(NULL, MODULENAME, "alpha", m_sOptions.bAlpha);
- db_set_b(NULL, MODULENAME, "transpinput", m_sOptions.bTranspInput);
- db_set_b(NULL, MODULENAME, "ldblclick", m_sOptions.bLDblClick);
- db_set_b(NULL, MODULENAME, "ignoreunknown", m_sOptions.bIgnoreUnknown);
- db_set_b(NULL, MODULENAME, "ignorenew", m_sOptions.bIgnoreNew);
+ g_plugin.setWord("duration", m_sOptions.wDuration);
+ g_plugin.setWord("suprconndelay", m_sOptions.wStartupDelay);
+ g_plugin.setByte("offline", m_sOptions.bOffline);
+ g_plugin.setByte("online", m_sOptions.bOnline);
+ g_plugin.setByte("other", m_sOptions.bOther);
+ g_plugin.setByte("typing", m_sOptions.bTyping);
+ g_plugin.setByte("idle", m_sOptions.bIdle);
+ g_plugin.setByte("prfxproto", m_sOptions.bPrefixProto);
+ g_plugin.setByte("x2", m_sOptions.bX2);
+ g_plugin.setByte("conjsoln", m_sOptions.bConjSOLN);
+ g_plugin.setByte("autopos", m_sOptions.bAutoPos);
+ g_plugin.setByte("balloontip", m_sOptions.bBallonTip);
+ g_plugin.setByte("transp", m_sOptions.bTransp);
+ g_plugin.setByte("alpha", m_sOptions.bAlpha);
+ g_plugin.setByte("transpinput", m_sOptions.bTranspInput);
+ g_plugin.setByte("ldblclick", m_sOptions.bLDblClick);
+ g_plugin.setByte("ignoreunknown", m_sOptions.bIgnoreUnknown);
+ g_plugin.setByte("ignorenew", m_sOptions.bIgnoreNew);
}
@@ -643,7 +643,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) ListView_InsertItem(GetDlgItem(hDlg, IDC_PROTOS), &lvi);
- BYTE bProtoState = db_get_b(NULL, MODULENAME, pa->szModuleName, ProtoUserBit | ProtoIntBit);
+ BYTE bProtoState = g_plugin.getByte(pa->szModuleName, ProtoUserBit | ProtoIntBit);
BOOL bProtoEnabled = (bProtoState & ProtoUserBit) != 0;
ListView_SetCheckState(GetDlgItem(hDlg, IDC_PROTOS), lvi.iItem, bProtoEnabled);
}
@@ -664,13 +664,13 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) szMultiByteProto, sizeof(szMultiByteProto), nullptr, nullptr);
szMultiByteProto[lLen] = '\0';
- BYTE bProtoState = db_get_b(NULL, MODULENAME, szMultiByteProto, ProtoUserBit | ProtoIntBit);
+ BYTE bProtoState = g_plugin.getByte(szMultiByteProto, ProtoUserBit | ProtoIntBit);
BOOL bProtoEnabled = ListView_GetCheckState(GetDlgItem(hDlg, IDC_PROTOS), i);
bProtoState = bProtoEnabled ? bProtoState | ProtoUserBit : bProtoState&~ProtoUserBit;
- db_set_b(NULL, MODULENAME, szMultiByteProto, bProtoState);
+ g_plugin.setByte(szMultiByteProto, bProtoState);
}
@@ -695,7 +695,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) void CTooltipNotify::ResetCList(HWND hwndDlg)
{
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
}
diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index 7ce86882b9..012b96bcc1 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -52,8 +52,8 @@ INT_PTR TTBInternalStatusMenuButt(WPARAM, LPARAM) INT_PTR TTBInternalSoundsOnOff(WPARAM, LPARAM)
{
- int newVal = !(db_get_b(NULL, "Skin", "UseSound", 1));
- db_set_b(NULL, "Skin", "UseSound", (BYTE)newVal);
+ int newVal = !(db_get_b(0, "Skin", "UseSound", 1));
+ db_set_b(0, "Skin", "UseSound", (BYTE)newVal);
return 0;
}
@@ -159,16 +159,16 @@ void InitInternalButtons() hExit = g_plugin.addTTB(&ttb);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hShowHideOffline,
- db_get_b(NULL, "CList", "HideOffline", 0) ? 0 : TTBST_PUSHED);
+ db_get_b(0, "CList", "HideOffline", 0) ? 0 : TTBST_PUSHED);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hGroups,
- db_get_b(NULL, "CList", "UseGroups", 1) ? TTBST_PUSHED : 0);
+ db_get_b(0, "CList", "UseGroups", 1) ? TTBST_PUSHED : 0);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hSounds,
- db_get_b(NULL, "Skin", "UseSound", 1) ? TTBST_PUSHED : 0);
+ db_get_b(0, "Skin", "UseSound", 1) ? TTBST_PUSHED : 0);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hMetaContacts,
- db_get_b(NULL, "MetaContacts", "Enabled", 1) ? TTBST_PUSHED : 0);
+ db_get_b(0, "MetaContacts", "Enabled", 1) ? TTBST_PUSHED : 0);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanging);
}
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp index da81db4300..633f9ad155 100644 --- a/plugins/TopToolBar/src/toolbar.cpp +++ b/plugins/TopToolBar/src/toolbar.cpp @@ -623,9 +623,9 @@ static LRESULT CALLBACK TTBButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA int LoadToolbarModule()
{
if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- if (!db_get_b(NULL, TTB_OPTDIR, "WarningDone", 0))
+ if (!db_get_b(0, TTB_OPTDIR, "WarningDone", 0))
MessageBox(nullptr, TranslateT("Frames service has not been found, so plugin will be disabled.\nTo run it you need to install and / or enable contact list plugin that supports it:\n- Modern contact list\n- Clist nicer\nYou can get them at https://wiki.miranda-ng.org/Download"), TranslateT("TopToolBar"), 0);
- db_set_b(NULL, TTB_OPTDIR, "WarningDone", 1);
+ db_set_b(0, TTB_OPTDIR, "WarningDone", 1);
return 1;
}
diff --git a/plugins/TopToolBar/src/toolbarwnd.cpp b/plugins/TopToolBar/src/toolbarwnd.cpp index 3eb9e78cde..88a918cc29 100644 --- a/plugins/TopToolBar/src/toolbarwnd.cpp +++ b/plugins/TopToolBar/src/toolbarwnd.cpp @@ -162,7 +162,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return 0; case WM_LBUTTONDOWN: - if (db_get_b(NULL, "CLUI", "ClientAreaDrag", 0)) { + if (db_get_b(0, "CLUI", "ClientAreaDrag", 0)) { POINT pt; GetCursorPos(&pt); return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE|HTCAPTION, MAKELPARAM(pt.x, pt.y)); @@ -289,18 +289,18 @@ void CALLBACK OnEventFire() int LoadBackgroundOptions() { - bkColour = db_get_dw(NULL, TTB_OPTDIR, "BkColour", TTBDEFAULT_BKCOLOUR); + bkColour = db_get_dw(0, TTB_OPTDIR, "BkColour", TTBDEFAULT_BKCOLOUR); if (hBmpBackground) { DeleteObject(hBmpBackground); hBmpBackground = nullptr; } - if (db_get_b(NULL, TTB_OPTDIR, "UseBitmap", TTBDEFAULT_USEBITMAP)) { + if (db_get_b(0, TTB_OPTDIR, "UseBitmap", TTBDEFAULT_USEBITMAP)) { ptrW tszBitmapName(db_get_wsa(NULL, TTB_OPTDIR, "BkBitmap")); if (tszBitmapName != NULL) hBmpBackground = Bitmap_Load(tszBitmapName); } - backgroundBmpUse = db_get_w(NULL, TTB_OPTDIR, "BkBmpUse", TTBDEFAULT_BKBMPUSE); + backgroundBmpUse = db_get_w(0, TTB_OPTDIR, "BkBmpUse", TTBDEFAULT_BKBMPUSE); RECT rc; GetClientRect(g_ctrl->hWnd, &rc); diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 8e7cb33cc3..dc5caf4b15 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -158,37 +158,37 @@ void SaveSettings(BYTE OnlyCnt) unsigned short int i;
// Сохраняем счётчик времени онлайна
- db_set_dw(NULL, MODULENAME, SETTINGS_TOTAL_ONLINE_TIME, OverallInfo.Total.Timer);
+ g_plugin.setDword(SETTINGS_TOTAL_ONLINE_TIME, OverallInfo.Total.Timer);
if (OnlyCnt) return;
// Для каждого протокола сохраняем флаги
for (i = 0; i < NumberOfAccounts; i++) {
if (!ProtoList[i].name) continue;
- db_set_b(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, ProtoList[i].Flags);
+ db_set_b(0, ProtoList[i].name, SETTINGS_PROTO_FLAGS, ProtoList[i].Flags);
}
//settings for notification
- db_set_dw(NULL, MODULENAME, SETTINGS_POPUP_BKCOLOR, Traffic_PopupBkColor);
- db_set_dw(NULL, MODULENAME, SETTINGS_POPUP_FONTCOLOR, Traffic_PopupFontColor);
+ g_plugin.setDword(SETTINGS_POPUP_BKCOLOR, Traffic_PopupBkColor);
+ g_plugin.setDword(SETTINGS_POPUP_FONTCOLOR, Traffic_PopupFontColor);
//
- db_set_b(NULL, MODULENAME, SETTINGS_POPUP_NOTIFY_TIME_VALUE, Traffic_Notify_time_value);
+ g_plugin.setByte(SETTINGS_POPUP_NOTIFY_TIME_VALUE, Traffic_Notify_time_value);
//
- db_set_w(NULL, MODULENAME, SETTINGS_POPUP_NOTIFY_SIZE_VALUE, Traffic_Notify_size_value);
+ g_plugin.setWord(SETTINGS_POPUP_NOTIFY_SIZE_VALUE, Traffic_Notify_size_value);
//
//popup timeout
- db_set_b(NULL, MODULENAME, SETTINGS_POPUP_TIMEOUT_DEFAULT, Traffic_PopupTimeoutDefault);
- db_set_b(NULL, MODULENAME, SETTINGS_POPUP_TIMEOUT_VALUE, Traffic_PopupTimeoutValue);
+ g_plugin.setByte(SETTINGS_POPUP_TIMEOUT_DEFAULT, Traffic_PopupTimeoutDefault);
+ g_plugin.setByte(SETTINGS_POPUP_TIMEOUT_VALUE, Traffic_PopupTimeoutValue);
//
// Формат счётчиков
- db_set_ws(NULL, MODULENAME, SETTINGS_COUNTER_FORMAT, Traffic_CounterFormat);
+ g_plugin.setWString(SETTINGS_COUNTER_FORMAT, Traffic_CounterFormat);
- db_set_ws(NULL, MODULENAME, SETTINGS_TOOLTIP_FORMAT, Traffic_TooltipFormat);
+ g_plugin.setWString(SETTINGS_TOOLTIP_FORMAT, Traffic_TooltipFormat);
- db_set_b(NULL, MODULENAME, SETTINGS_ADDITION_SPACE, Traffic_AdditionSpace);
+ g_plugin.setByte(SETTINGS_ADDITION_SPACE, Traffic_AdditionSpace);
// Сохраняем флаги
- db_set_dw(NULL, MODULENAME, SETTINGS_WHAT_DRAW, unOptions.Flags);
- db_set_w(NULL, MODULENAME, SETTINGS_STAT_ACC_OPT, Stat_SelAcc);
+ g_plugin.setDword(SETTINGS_WHAT_DRAW, unOptions.Flags);
+ g_plugin.setWord(SETTINGS_STAT_ACC_OPT, Stat_SelAcc);
}
/*--------------------------------------------------------------------------------------------*/
@@ -256,8 +256,8 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) DWORD SummarySession, SummaryTotal;
BYTE ClistModernPresent = (GetModuleHandleA("clist_modern.dll") || GetModuleHandleA("clist_modern_dora.dll"))
- && !db_get_b(NULL, "ModernData", "DisableEngine", 0)
- && db_get_b(NULL, "ModernData", "EnableLayering", 1);
+ && !db_get_b(0, "ModernData", "DisableEngine", 0)
+ && db_get_b(0, "ModernData", "EnableLayering", 1);
GetClientRect(hwnd, &rect);
int height = rect.bottom - rect.top;
@@ -611,8 +611,8 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP case WM_PAINT:
{
- if (!db_get_b(NULL, "ModernData", "DisableEngine", 0)
- && db_get_b(NULL, "ModernData", "EnableLayering", 1)
+ if (!db_get_b(0, "ModernData", "DisableEngine", 0)
+ && db_get_b(0, "ModernData", "EnableLayering", 1)
&& ServiceExists(MS_SKINENG_INVALIDATEFRAMEIMAGE))
CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, (WPARAM)TrafficHwnd, 0);
else {
@@ -627,7 +627,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP return 1;
case WM_LBUTTONDOWN:
- if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
+ if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
POINT p;
ClientToScreen(GetParent(hwnd), &p);
return SendMessage(GetParent(hwnd), WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(p.x, p.y));
@@ -852,7 +852,7 @@ INT_PTR MenuCommand_TrafficShowHide(WPARAM, LPARAM) ShowWindow(TrafficHwnd, unOptions.FrameIsVisible ? SW_SHOW : SW_HIDE);
else
CallService(MS_CLIST_FRAMES_SHFRAME, Traffic_FrameID, 0);
- db_set_dw(NULL, MODULENAME, SETTINGS_WHAT_DRAW, unOptions.Flags);
+ g_plugin.setDword(SETTINGS_WHAT_DRAW, unOptions.Flags);
//
return 0;
}
@@ -924,7 +924,7 @@ void CreateProtocolList(void) auto &p = ProtoList[i++];
p.name = mir_strdup(pa->szModuleName);
p.tszAccountName = mir_wstrdup(pa->tszAccountName);
- p.Flags = db_get_b(NULL, p.name, SETTINGS_PROTO_FLAGS, 3);
+ p.Flags = db_get_b(0, p.name, SETTINGS_PROTO_FLAGS, 3);
p.Enabled = pa->IsEnabled();
Stat_ReadFile(p);
@@ -963,8 +963,8 @@ int UpdateFonts(WPARAM, LPARAM) Traffic_BkColor = Colour_GetW(TrafficBackgroundColorID);
// Ключевой цвет
- UseKeyColor = db_get_b(NULL, "ModernSettings", "UseKeyColor", 1);
- KeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", 0);
+ UseKeyColor = db_get_b(0, "ModernSettings", "UseKeyColor", 1);
+ KeyColor = db_get_dw(0, "ModernSettings", "KeyColor", 0);
UpdateTrafficWindowSize();
return 0;
@@ -1053,37 +1053,37 @@ static int TrafficCounterModulesLoaded(WPARAM, LPARAM) ModuleLoad(0, 0);
// Читаем флаги
- unOptions.Flags = db_get_dw(NULL, MODULENAME, SETTINGS_WHAT_DRAW, 0x0882);
- Stat_SelAcc = db_get_w(NULL, MODULENAME, SETTINGS_STAT_ACC_OPT, 0x01);
+ unOptions.Flags = g_plugin.getDword(SETTINGS_WHAT_DRAW, 0x0882);
+ Stat_SelAcc = g_plugin.getWord(SETTINGS_STAT_ACC_OPT, 0x01);
// settings for notification
- Traffic_PopupBkColor = db_get_dw(NULL, MODULENAME, SETTINGS_POPUP_BKCOLOR, RGB(200, 255, 200));
- Traffic_PopupFontColor = db_get_dw(NULL, MODULENAME, SETTINGS_POPUP_FONTCOLOR, RGB(0, 0, 0));
- Traffic_Notify_time_value = db_get_b(NULL, MODULENAME, SETTINGS_POPUP_NOTIFY_TIME_VALUE, 10);
- Traffic_Notify_size_value = db_get_w(NULL, MODULENAME, SETTINGS_POPUP_NOTIFY_SIZE_VALUE, 100);
+ Traffic_PopupBkColor = g_plugin.getDword(SETTINGS_POPUP_BKCOLOR, RGB(200, 255, 200));
+ Traffic_PopupFontColor = g_plugin.getDword(SETTINGS_POPUP_FONTCOLOR, RGB(0, 0, 0));
+ Traffic_Notify_time_value = g_plugin.getByte(SETTINGS_POPUP_NOTIFY_TIME_VALUE, 10);
+ Traffic_Notify_size_value = g_plugin.getWord(SETTINGS_POPUP_NOTIFY_SIZE_VALUE, 100);
// popup timeout
- Traffic_PopupTimeoutDefault = db_get_b(NULL, MODULENAME, SETTINGS_POPUP_TIMEOUT_DEFAULT, 1);
- Traffic_PopupTimeoutValue = db_get_b(NULL, MODULENAME, SETTINGS_POPUP_TIMEOUT_VALUE, 5);
+ Traffic_PopupTimeoutDefault = g_plugin.getByte(SETTINGS_POPUP_TIMEOUT_DEFAULT, 1);
+ Traffic_PopupTimeoutValue = g_plugin.getByte(SETTINGS_POPUP_TIMEOUT_VALUE, 5);
// Формат счётчика для каждого активного протокола
- ptrW wszFormat(db_get_wsa(NULL, MODULENAME, SETTINGS_COUNTER_FORMAT));
+ ptrW wszFormat(g_plugin.getWStringA(SETTINGS_COUNTER_FORMAT));
if (mir_wstrlen(wszFormat) > 0)
mir_wstrncpy(Traffic_CounterFormat, wszFormat, _countof(Traffic_CounterFormat));
else
mir_wstrcpy(Traffic_CounterFormat, wszDefaultFormat);
// Формат всплывающих подсказок
- wszFormat = db_get_wsa(NULL, MODULENAME, SETTINGS_TOOLTIP_FORMAT);
+ wszFormat = g_plugin.getWStringA(SETTINGS_TOOLTIP_FORMAT);
if (mir_wstrlen(wszFormat) > 0)
mir_wstrncpy(Traffic_TooltipFormat, wszFormat, _countof(Traffic_TooltipFormat));
else
mir_wstrcpy(Traffic_TooltipFormat, L"Traffic Counter");
- Traffic_AdditionSpace = db_get_b(NULL, MODULENAME, SETTINGS_ADDITION_SPACE, 0);
+ Traffic_AdditionSpace = g_plugin.getByte(SETTINGS_ADDITION_SPACE, 0);
// Счётчик времени онлайна
- OverallInfo.Total.Timer = db_get_dw(NULL, MODULENAME, SETTINGS_TOTAL_ONLINE_TIME, 0);
+ OverallInfo.Total.Timer = g_plugin.getDword(SETTINGS_TOTAL_ONLINE_TIME, 0);
//register traffic font
mir_wstrcpy(TrafficFontID.group, LPGENW("Traffic counter"));
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 1c7ce7688a..796dc87623 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -315,8 +315,8 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT, Traffic_TooltipFormat, _countof(Traffic_TooltipFormat));
// Ключевой цвет
- UseKeyColor = db_get_b(NULL, "ModernSettings", "UseKeyColor", 1);
- KeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", 0);
+ UseKeyColor = db_get_b(0, "ModernSettings", "UseKeyColor", 1);
+ KeyColor = db_get_dw(0, "ModernSettings", "KeyColor", 0);
// Перерисовываем фрейм
UpdateTrafficWindowSize();
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 9d8f999db2..2dbeb04ac8 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -208,8 +208,8 @@ void SvcFlagsLoadModule() CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY, ServiceDetectContactOriginCountry);
// init settings
- g_bUseUnknownFlag = db_get_b(NULL, MODNAMEFLAGS, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
- g_bShowStatusIconFlag = db_get_b(NULL, MODNAMEFLAGS, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
+ g_bUseUnknownFlag = db_get_b(0, MODNAMEFLAGS, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
+ g_bShowStatusIconFlag = db_get_b(0, MODNAMEFLAGS, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
HookEvent(ME_SKIN2_ICONSCHANGED, OnStatusIconsChanged);
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index c057cf202c..69d0aad715 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -573,7 +573,7 @@ int MAnnivDate::DBWriteBirthDate(MCONTACT hContact) // only delete values from current contact's custom modules
!(_wFlags & (MADF_HASPROTO|MADF_HASMETA)) &&
// check whether user wants this feature
- db_get_b(NULL, MODULENAME, SET_REMIND_SECUREBIRTHDAY, TRUE))
+ g_plugin.getByte(SET_REMIND_SECUREBIRTHDAY, TRUE))
{
// keep the database clean
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index fb895460cc..c3939a94f9 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -158,7 +158,7 @@ BYTE CPsTree::InitTreeItems(LPWORD needWidth) return FALSE; } - if (!DB::Setting::GetUString(NULL, MODULENAME, SET_LASTITEM, &dbv)) + if (!DB::Setting::GetUString(0, MODULENAME, SET_LASTITEM, &dbv)) { _curItem = FindItemIndexByName(dbv.pszVal); db_free(&dbv); @@ -552,8 +552,8 @@ void CPsTree::SaveState() } // save current selected item - if (pti) db_set_utf(NULL, MODULENAME, SET_LASTITEM, pti->Name()); - else db_unset(NULL, MODULENAME, SET_LASTITEM); + if (pti) db_set_utf(0, MODULENAME, SET_LASTITEM, pti->Name()); + else g_plugin.delSetting(SET_LASTITEM); } /** @@ -576,7 +576,7 @@ void CPsTree::DBResetState() for (auto &s : Settings) if (s && *s == '{' && !mir_strncmpi(s + 1, p, c)) - db_unset(NULL, MODULENAME, s); + g_plugin.delSetting(s); // keep only these flags _dwFlags &= PSTVF_SORTTREE|PSTVF_GROUPS; @@ -627,7 +627,7 @@ int CPsTree::BeginLabelEdit(HTREEITEM hItem) CPsTreeItem* pti; // tree is readonly - if (db_get_b(NULL, MODULENAME, SET_PROPSHEET_READONLYLABEL, 0)) + if (g_plugin.getByte(SET_PROPSHEET_READONLYLABEL, 0)) return 0; // get item text @@ -731,7 +731,7 @@ void CPsTree::PopupMenu() tvi.hItem = hti.hItem; TreeView_GetItem(_hWndTree, &tvi); - if (!db_get_b(NULL, MODULENAME, SET_PROPSHEET_READONLYLABEL, FALSE)) { + if (!g_plugin.getByte(SET_PROPSHEET_READONLYLABEL, FALSE)) { mii.dwTypeData = TranslateT("Rename Item"); mii.wID = 32001; InsertMenuItem(hPopup, 0, FALSE, &mii); diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 18463b0f99..6e88f8d7cb 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -151,7 +151,7 @@ LPSTR CPsTreeItem::ParentItemName() {
// try to read the parent item from the database
DBVARIANT dbv;
- if (!DB::Setting::GetAString(NULL, MODULENAME, PropertyKey(SET_ITEM_GROUP), &dbv))
+ if (!DB::Setting::GetAString(0, MODULENAME, PropertyKey(SET_ITEM_GROUP), &dbv))
return dbv.pszVal;
const CHAR* p = mir_strrchr(_pszName, '\\');
@@ -245,7 +245,7 @@ int CPsTreeItem::ItemLabel(const BYTE bReadDBValue) mir_free(_ptszLabel);
// try to get custom label from database
- if (!bReadDBValue || DB::Setting::GetTString(NULL, MODULENAME, GlobalPropertyKey(SET_ITEM_LABEL), &dbv) || (_ptszLabel = dbv.pwszVal) == nullptr) {
+ if (!bReadDBValue || DB::Setting::GetTString(0, MODULENAME, GlobalPropertyKey(SET_ITEM_LABEL), &dbv) || (_ptszLabel = dbv.pwszVal) == nullptr) {
// extract the name
LPSTR pszName = mir_strrchr(_pszName, '\\');
if (pszName && pszName[1])
@@ -425,12 +425,12 @@ int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp) // load custom order
if (!(pPsh->_dwFlags & PSTVF_SORTTREE)) {
- _iPosition = (int)db_get_b(NULL, MODULENAME, PropertyKey(SET_ITEM_POS), odp->position);
+ _iPosition = (int)g_plugin.getByte(PropertyKey(SET_ITEM_POS), odp->position);
if ((_iPosition < 0) && (_iPosition > 0x800000A))
_iPosition = 0;
}
// read visibility state
- _bState = db_get_b(NULL, MODULENAME, PropertyKey(SET_ITEM_STATE), DBTVIS_EXPANDED);
+ _bState = g_plugin.getByte(PropertyKey(SET_ITEM_STATE), DBTVIS_EXPANDED);
// error for no longer supported dialog template type
if (((UINT_PTR)odp->pszTemplate & 0xFFFF0000))
@@ -473,20 +473,19 @@ WORD CPsTreeItem::DBSaveItemState(LPCSTR pszGroup, int iItemPosition, UINT iStat // save group
if ((dwFlags & PSTVF_GROUPS) && (dwFlags & PSTVF_POS_CHANGED))
- numErrors += db_set_utf(NULL, MODULENAME, PropertyKey(SET_ITEM_GROUP), (LPSTR)pszGroup);
+ numErrors += db_set_utf(0, MODULENAME, PropertyKey(SET_ITEM_GROUP), (LPSTR)pszGroup);
// save label
if ((dwFlags & PSTVF_LABEL_CHANGED) && (_dwFlags & PSTVF_LABEL_CHANGED))
- numErrors += db_set_ws(NULL, MODULENAME, GlobalPropertyKey(SET_ITEM_LABEL), Label());
+ g_plugin.setWString(GlobalPropertyKey(SET_ITEM_LABEL), Label());
// save position
if ((dwFlags & PSTVF_POS_CHANGED) && !(dwFlags & PSTVF_SORTTREE))
- numErrors += db_set_b(NULL, MODULENAME, PropertyKey(SET_ITEM_POS), iItemPosition);
+ g_plugin.setByte(PropertyKey(SET_ITEM_POS), iItemPosition);
// save state
if (dwFlags & PSTVF_STATE_CHANGED)
- numErrors += db_set_b(NULL, MODULENAME, PropertyKey(SET_ITEM_STATE),
- _hItem ? ((iState & TVIS_EXPANDED) ? DBTVIS_EXPANDED : DBTVIS_NORMAL) : DBTVIS_INVISIBLE);
+ g_plugin.setByte(PropertyKey(SET_ITEM_STATE), _hItem ? ((iState & TVIS_EXPANDED) ? DBTVIS_EXPANDED : DBTVIS_NORMAL) : DBTVIS_INVISIBLE);
RemoveFlags(PSTVF_STATE_CHANGED|PSTVF_LABEL_CHANGED|PSTVF_POS_CHANGED);
return numErrors;
diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp index 4dcda44702..612a6fe0a1 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp +++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp @@ -41,7 +41,7 @@ CAnnivEditCtrl::CAnnivEditCtrl(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) _hBtnEdit = GetDlgItem(hDlg, BTN_EDIT);
_hBtnMenu = GetDlgItem(hDlg, BTN_MENU);
_hwndDate = GetDlgItem(hDlg, EDIT_ANNIVERSARY_DATE);
- _ReminderEnabled = db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
+ _ReminderEnabled = g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
_pDates = nullptr;
_curDate = 0;
@@ -148,7 +148,7 @@ void CAnnivEditCtrl::EnableCurrentItem() = !hContact ||
(pCurrent->Flags() & CTRLF_HASCUSTOM) ||
!(pCurrent->Flags() & (CTRLF_HASPROTO|CTRLF_HASMETA)) ||
- !db_get_b(NULL, MODULENAME, SET_PROPSHEET_PCBIREADONLY, 0);
+ !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0);
EnableWindow(_hBtnEdit, bEnabled);
EnableWindow(_hBtnDel, bEnabled);
@@ -540,7 +540,7 @@ void CAnnivEditCtrl::OnReminderChecked() {
if (IsDlgButtonChecked(_hwndDlg, RADIO_REMIND1))
{
- _itow(db_get_b(NULL, MODULENAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
+ _itow(g_plugin.getByte(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
EnableWindow(GetDlgItem(_hwndDlg, EDIT_REMIND), FALSE);
EnableWindow(GetDlgItem(_hwndDlg, SPIN_REMIND), FALSE);
state = BST_INDETERMINATE;
@@ -549,7 +549,7 @@ void CAnnivEditCtrl::OnReminderChecked() {
if (pCurrent->RemindOffset() == (WORD)-1)
{
- _itow(db_get_b(NULL, MODULENAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
+ _itow(g_plugin.getByte(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10);
}
else
{
diff --git a/plugins/UserInfoEx/src/ctrl_base.cpp b/plugins/UserInfoEx/src/ctrl_base.cpp index 0d230a3c4f..cc278096ef 100644 --- a/plugins/UserInfoEx/src/ctrl_base.cpp +++ b/plugins/UserInfoEx/src/ctrl_base.cpp @@ -33,11 +33,11 @@ COLORREF clrMeta = -1; void Ctrl_InitTextColours()
{
- clrBoth = db_get_dw(NULL, MODULENAME, SET_PROPSHEET_CLRBOTH, RGB(0, 160, 10));
- clrChanged = db_get_dw(NULL, MODULENAME, SET_PROPSHEET_CLRCHANGED, RGB(190, 0, 0));
- clrCustom = db_get_dw(NULL, MODULENAME, SET_PROPSHEET_CLRCUSTOM, RGB(0, 10, 130));
- clrNormal = db_get_dw(NULL, MODULENAME, SET_PROPSHEET_CLRNORMAL, RGB(90, 90, 90));
- clrMeta = db_get_dw(NULL, MODULENAME, SET_PROPSHEET_CLRMETA, RGB(120, 40, 130));
+ clrBoth = g_plugin.getDword(SET_PROPSHEET_CLRBOTH, RGB(0, 160, 10));
+ clrChanged = g_plugin.getDword(SET_PROPSHEET_CLRCHANGED, RGB(190, 0, 0));
+ clrCustom = g_plugin.getDword(SET_PROPSHEET_CLRCUSTOM, RGB(0, 10, 130));
+ clrNormal = g_plugin.getDword(SET_PROPSHEET_CLRNORMAL, RGB(90, 90, 90));
+ clrMeta = g_plugin.getDword(SET_PROPSHEET_CLRMETA, RGB(120, 40, 130));
}
INT_PTR CALLBACK Ctrl_SetTextColour(HDC hdc, WORD wFlags)
@@ -55,7 +55,7 @@ INT_PTR CALLBACK Ctrl_SetTextColour(HDC hdc, WORD wFlags) INT_PTR CALLBACK Ctrl_SetTextColour(HWND hCtrl, HDC hdc)
{
- if (hCtrl && db_get_b(NULL, MODULENAME, SET_PROPSHEET_SHOWCOLOURS, 1))
+ if (hCtrl && g_plugin.getByte(SET_PROPSHEET_SHOWCOLOURS, 1))
{
LPCTRL pCtrl = (LPCTRL)GetUserData(hCtrl);
if (PtrIsValid(pCtrl))
diff --git a/plugins/UserInfoEx/src/ctrl_combo.cpp b/plugins/UserInfoEx/src/ctrl_combo.cpp index 2afbbdc00b..6c4d152a64 100644 --- a/plugins/UserInfoEx/src/ctrl_combo.cpp +++ b/plugins/UserInfoEx/src/ctrl_combo.cpp @@ -150,7 +150,7 @@ BOOL CCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) _Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = false;
_Flags.W |= DB::Setting::GetTStringCtrl(hContact, USERINFO, USERINFO, pszProto, _pszSetting, &dbv);
- EnableWindow(_hwnd, !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODULENAME, SET_PROPSHEET_PCBIREADONLY, 0));
+ EnableWindow(_hwnd, !hContact || _Flags.B.hasCustom || !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0));
if (_Flags.B.hasCustom || _Flags.B.hasProto || _Flags.B.hasMeta) {
switch (dbv.type) {
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 84de9f555f..c0ad33eb9c 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -152,7 +152,7 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM SetUserData(hDlg, lParam);
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_EMAIL, TRUE));
- if (db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1)) {
+ if (g_plugin.getByte(SET_ICONS_BUTTONS, 1)) {
SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
}
@@ -244,7 +244,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam SetUserData(hDlg, lParam);
SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_PHONE, TRUE));
- if (db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1)) {
+ if (g_plugin.getByte(SET_ICONS_BUTTONS, 1)) {
SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
}
@@ -564,7 +564,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L * return: a brush
**/
case WM_CTLCOLOREDIT:
- if (!db_get_b(NULL, MODULENAME, SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0)
+ if (!g_plugin.getByte(SET_PROPSHEET_SHOWCOLOURS, 1) || (HWND)lParam != cbex->hEdit || !cbex->pItems || cbex->iSelectedItem < 0)
break;
return Ctrl_SetTextColour((HDC)wParam, cbex->pItems[cbex->iSelectedItem].wFlags);
@@ -1136,7 +1136,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L bEnabled = !hContact ||
(cbex->pItems[cbex->iSelectedItem].wFlags & CTRLF_HASCUSTOM) ||
!(cbex->pItems[cbex->iSelectedItem].wFlags & (CTRLF_HASPROTO|CTRLF_HASMETA)) ||
- !db_get_b(NULL, MODULENAME, SET_PROPSHEET_PCBIREADONLY, 0);
+ !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0);
EnableWindow(cbex->hBtnEdit, bEnabled);
EnableWindow(cbex->hBtnDel, bEnabled && GetWindowTextLength(cbex->hEdit) > 0);
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index 51a1a19607..db9efe21ea 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -114,7 +114,7 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) _Flags.W |= DB::Setting::GetTStringCtrl(hContact, _pszModule, _pszModule, pszProto, _pszSetting, &dbv); EnableWindow(_hwnd, - !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODULENAME, SET_PROPSHEET_PCBIREADONLY, 0)); + !hContact || _Flags.B.hasCustom || !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0)); MIR_FREE(_pszValue); switch (dbv.type) { diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index b49a6153c1..69dc4dce35 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -345,17 +345,17 @@ class CAnnivList }
// init reminder groups
- pDlg->_bRemindEnable = db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF;
+ pDlg->_bRemindEnable = g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF;
if (hCtrl = GetDlgItem(hDlg, CHECK_REMIND)) {
Button_SetCheck(hCtrl, pDlg->_bRemindEnable ? BST_INDETERMINATE : BST_UNCHECKED);
EnableWindow(hCtrl, pDlg->_bRemindEnable);
}
- CheckDlgButton(hDlg, CHECK_POPUP, db_get_b(NULL, MODULENAME, SET_ANNIVLIST_POPUP, FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, CHECK_POPUP, g_plugin.getByte(SET_ANNIVLIST_POPUP, FALSE) ? BST_CHECKED : BST_UNCHECKED);
// set number of days to show contact in advance
SetDlgItemInt(hDlg, EDIT_DAYS, pDlg->_filter.wDaysBefore, FALSE);
if (hCtrl = GetDlgItem(hDlg, CHECK_DAYS)) {
- Button_SetCheck(hCtrl, db_get_b(NULL, MODULENAME, SET_ANNIVLIST_FILTER_DAYSENABLED, FALSE));
+ Button_SetCheck(hCtrl, g_plugin.getByte(SET_ANNIVLIST_FILTER_DAYSENABLED, FALSE));
DlgProc(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_DAYS, BN_CLICKED), (LPARAM)hCtrl);
}
@@ -598,7 +598,7 @@ class CAnnivList CHAR pszSetting[MAXSETTING];
mir_snprintf(pszSetting, "AnnivDlg_Col%d", iSubItem);
- lvc.cx = db_get_w(NULL, MODULENAME, pszSetting, defaultWidth);
+ lvc.cx = g_plugin.getWord(pszSetting, defaultWidth);
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.iSubItem = iSubItem;
lvc.pszText = TranslateW(pszText);
@@ -730,7 +730,7 @@ class CAnnivList MAnnivDate ad;
int i = 0;
DWORD age = 0;
- WORD wDaysBefore = db_get_w(NULL, MODULENAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
+ WORD wDaysBefore = g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
WORD numMale = 0;
WORD numFemale = 0;
WORD numContacts = 0;
@@ -822,17 +822,17 @@ class CAnnivList // This method loads all filter settings from db
void LoadFilter()
{
- _filter.wDaysBefore = db_get_w(NULL, MODULENAME, SET_ANNIVLIST_FILTER_DAYS, 9);
- _filter.bFilterIndex = db_get_b(NULL, MODULENAME, SET_ANNIVLIST_FILTER_INDEX, 0);
+ _filter.wDaysBefore = g_plugin.getWord(SET_ANNIVLIST_FILTER_DAYS, 9);
+ _filter.bFilterIndex = g_plugin.getByte(SET_ANNIVLIST_FILTER_INDEX, 0);
}
// This method saves all filter settings to db
void SaveFilter()
{
if (_hDlg) {
- db_set_w(NULL, MODULENAME, SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, SET_ANNIVLIST_FILTER_DAYSENABLED, (BYTE)Button_GetCheck(GetDlgItem(_hDlg, CHECK_DAYS)));
- db_set_b(NULL, MODULENAME, SET_ANNIVLIST_FILTER_INDEX, (BYTE)ComboBox_GetCurSel(GetDlgItem(_hDlg, EDIT_DAYS)));
+ g_plugin.setWord(SET_ANNIVLIST_FILTER_DAYS, (WORD)GetDlgItemInt(_hDlg, EDIT_DAYS, nullptr, FALSE));
+ g_plugin.setByte(SET_ANNIVLIST_FILTER_DAYSENABLED, (BYTE)Button_GetCheck(GetDlgItem(_hDlg, CHECK_DAYS)));
+ g_plugin.setByte(SET_ANNIVLIST_FILTER_INDEX, (BYTE)ComboBox_GetCurSel(GetDlgItem(_hDlg, EDIT_DAYS)));
}
}
@@ -877,12 +877,12 @@ public: for (c = 0; c < cc; c++) {
mir_snprintf(pszSetting, "AnnivDlg_Col%d", c);
- db_set_w(NULL, MODULENAME, pszSetting, (WORD)ListView_GetColumnWidth(_hList, c));
+ g_plugin.setWord(pszSetting, (WORD)ListView_GetColumnWidth(_hList, c));
}
DeleteAllItems();
}
// remember popup setting
- db_set_b(NULL, MODULENAME, SET_ANNIVLIST_POPUP, (BYTE)IsDlgButtonChecked(_hDlg, CHECK_POPUP));
+ g_plugin.setByte(SET_ANNIVLIST_POPUP, (BYTE)IsDlgButtonChecked(_hDlg, CHECK_POPUP));
// save window position, size and column widths
Utils_SaveWindowPosition(_hDlg, NULL, MODULENAME, "AnnivDlg_");
SaveFilter();
@@ -928,7 +928,7 @@ INT_PTR DlgAnniversaryListShow(WPARAM, LPARAM) {
if (!gpDlg) {
try {
- myGlobals.WantAeroAdaption = db_get_b(NULL, MODULENAME, SET_PROPSHEET_AEROADAPTION, TRUE);
+ myGlobals.WantAeroAdaption = g_plugin.getByte(SET_PROPSHEET_AEROADAPTION, TRUE);
gpDlg = new CAnnivList();
}
catch(...) {
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index ecd58db4b4..e8dfc3def4 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -644,8 +644,8 @@ INT_PTR MsgBoxService(WPARAM, LPARAM lParam) if (!(pMsgBox->uType & (MB_INFOBAR | MB_NOPOPUP)) // message box can be a popup?
&& ServiceExists(MS_POPUP_ADDPOPUPT) // popups exist?
&& myGlobals.PopupActionsExist == 1 // popup support ext stuct?
- && (db_get_dw(NULL, "Popup", "Actions", 0) & 1) // popup++ actions on?
- && db_get_b(NULL, MODULENAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
+ && (db_get_dw(0, "Popup", "Actions", 0) & 1) // popup++ actions on?
+ && g_plugin.getByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOX), pMsgBox->hParent, MsgBoxProc, lParam);
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index e61ea4c593..75bacd9cf0 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -232,8 +232,8 @@ static int SortProc(CPsTreeItem **item1, CPsTreeItem **item2) static INT_PTR ShowDialog(WPARAM wParam, LPARAM)
{
// update some cached settings
- myGlobals.ShowPropsheetColours = db_get_b(NULL, MODULENAME, SET_PROPSHEET_SHOWCOLOURS, TRUE);
- myGlobals.WantAeroAdaption = db_get_b(NULL, MODULENAME, SET_PROPSHEET_AEROADAPTION, TRUE);
+ myGlobals.ShowPropsheetColours = g_plugin.getByte(SET_PROPSHEET_SHOWCOLOURS, TRUE);
+ myGlobals.WantAeroAdaption = g_plugin.getByte(SET_PROPSHEET_AEROADAPTION, TRUE);
// allow only one dialog per user
if (HWND hWnd = WindowList_Find(g_hWindowList, wParam)) {
@@ -247,9 +247,9 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM) bool bScanMetaSubContacts = false;
// init the treeview options
- if (db_get_b(NULL, MODULENAME, SET_PROPSHEET_SORTITEMS, FALSE))
+ if (g_plugin.getByte(SET_PROPSHEET_SORTITEMS, FALSE))
psh._dwFlags |= PSTVF_SORTTREE;
- if (db_get_b(NULL, MODULENAME, SET_PROPSHEET_GROUPS, TRUE))
+ if (g_plugin.getByte(SET_PROPSHEET_GROUPS, TRUE))
psh._dwFlags |= PSTVF_GROUPS;
// create imagelist
@@ -409,7 +409,7 @@ static int InitDetails(WPARAM wParam, LPARAM lParam) {
CPsHdr *pPsh = (CPsHdr *)wParam;
if (!(pPsh->_dwFlags & PSF_PROTOPAGESONLY)) {
- BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && db_get_b(NULL, MODULENAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE);
+ BYTE bChangeDetailsEnabled = myGlobals.CanChangeDetails && g_plugin.getByte(SET_PROPSHEET_CHANGEMYDETAILS, FALSE);
if (lParam || bChangeDetailsEnabled) {
OPTIONSDIALOGPAGE odp = {};
odp.flags = ODPF_ICON | ODPF_UNICODE;
@@ -935,7 +935,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { ICO_BTN_APPLY, BM_SETIMAGE, IDAPPLY }
};
- const int numIconsToSet = db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 1;
+ const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 1;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
@@ -1033,7 +1033,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case ACKTYPE_GETINFO:
// is contact the owner of the dialog or any metasubcontact of the owner? skip handling otherwise!
if (ack->hContact != pPs->hContact) {
- if (!db_get_b(NULL, MODULENAME, SET_META_SCAN, TRUE))
+ if (!g_plugin.getByte(SET_META_SCAN, TRUE))
break;
for (i = 0; i < pPs->nSubContacts; i++) {
@@ -1100,7 +1100,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (hContact != pPs->hContact) {
if (pPs->hContact != db_mc_getMeta(hContact))
break;
- if (!db_get_b(NULL, MODULENAME, SET_META_SCAN, TRUE))
+ if (!g_plugin.getByte(SET_META_SCAN, TRUE))
break;
}
@@ -1294,7 +1294,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar g_clistApi.pfnInvalidateDisplayNameCacheEntry(pPs->hContact);
// need to upload owners settings
- if (!pPs->hContact && myGlobals.CanChangeDetails && db_get_b(NULL, MODULENAME, SET_PROPSHEET_CHANGEMYDETAILS, FALSE)) {
+ if (!pPs->hContact && myGlobals.CanChangeDetails && g_plugin.getByte(SET_PROPSHEET_CHANGEMYDETAILS, FALSE)) {
if (pPs->pUpload = new CPsUpload(pPs, LOWORD(wParam) == IDOK)) {
if (pPs->pUpload->UploadFirst() == CPsUpload::UPLOAD_CONTINUE)
break;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index e4f0f3d090..689e72c564 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -167,7 +167,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar { ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
+ const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
// create imagelist for treeview
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index df30690a1b..b38f2a54d7 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -225,9 +225,9 @@ static void SaveInitialDir(LPSTR pszInitialDir) if (p = mir_strrchr(pszInitialDir, '\\')) {
*p = 0;
if ( PathToRelative(pszInitialDir, szRelative))
- db_set_s(0, MODULENAME, "vCardPath", szRelative);
+ g_plugin.setString("vCardPath", szRelative);
else
- db_set_s(0, MODULENAME, "vCardPath", pszInitialDir);
+ g_plugin.setString("vCardPath", pszInitialDir);
*p = '\\';
}
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index db0e72e03a..8e4ca959ae 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar { ICO_DLG_IMPORT, STM_SETIMAGE, ICO_DLGLOGO },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
+ const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
TranslateDialogDefault(hDlg);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 6db5af2457..067210b013 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -35,7 +35,7 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM { ICO_BTN_EXPORT, BM_SETIMAGE, IDOK },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- const int numIconsToSet = db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
+ const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
SendDlgItemMessage(hDlg, IDOK, BUTTONTRANSLATE, NULL, NULL);
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 16f3358b8f..9b4c936e9d 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -115,7 +115,7 @@ bool IsMeta(LPCSTR pszModule) bool IsMetaAndScan(LPCSTR pszModule)
{
- return 0 != db_get_b(NULL, MODULENAME, SET_META_SCAN, TRUE) && IsMeta(pszModule);
+ return 0 != g_plugin.getByte(SET_META_SCAN, TRUE) && IsMeta(pszModule);
}
} /* namespace Module */
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp index dea1d2d8f8..d9d74c0d08 100644 --- a/plugins/UserInfoEx/src/mir_icolib.cpp +++ b/plugins/UserInfoEx/src/mir_icolib.cpp @@ -154,7 +154,7 @@ LPTSTR IcoLib_GetDefaultIconFileName() **/
static void IcoLib_CheckIconPackVersion(LPTSTR szIconPack)
{
- if (db_get_b(NULL, MODULENAME, SET_ICONS_CHECKFILEVERSION, TRUE)) {
+ if (g_plugin.getByte(SET_ICONS_CHECKFILEVERSION, TRUE)) {
if (szIconPack) {
wchar_t szAbsolutePath[MAX_PATH];
PathToAbsoluteW(szIconPack, szAbsolutePath);
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index 157d7fcc1a..8b33978a46 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -73,10 +73,10 @@ void RebuildContact() SvcHomepageRebuildMenu();
// load options
- int flag = db_get_b(NULL, MODULENAME, SET_MI_CONTACT, MCAS_NOTINITIATED);
+ int flag = g_plugin.getByte(SET_MI_CONTACT, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED) {
flag = MCAS_EXIMPORT | TRUE;
- db_set_b(NULL, MODULENAME, SET_MI_CONTACT, flag);
+ g_plugin.setByte(SET_MI_CONTACT, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -166,10 +166,10 @@ void RebuildMain() static HGENMENU hMenuItem[8] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
// load options
- int flag = db_get_b(NULL, MODULENAME, SET_MI_MAIN, MCAS_NOTINITIATED);
+ int flag = g_plugin.getByte(SET_MI_MAIN, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED) {
flag = MCAS_ALL | TRUE;
- db_set_b(NULL, MODULENAME, SET_MI_MAIN, flag);
+ g_plugin.setByte(SET_MI_MAIN, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -240,8 +240,8 @@ void RebuildMain() // reminder
mi.root = mhRoot;
const BYTE bRemindMenus =
- db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) &&
- db_get_b(NULL, MODULENAME, SET_REMIND_MENUENABLED, DEFVAL_REMIND_MENUENABLED);
+ g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) &&
+ g_plugin.getByte(SET_REMIND_MENUENABLED, DEFVAL_REMIND_MENUENABLED);
if (bRemindMenus) {
// make backup of each protocol based birthday
SET_UID(mi, 0x67980bea, 0x8fca, 0x4642, 0x96, 0x78, 0x6a, 0xc0, 0xe3, 0x74, 0x4c, 0x2a);
@@ -300,10 +300,10 @@ void RebuildGroup() static HGENMENU hMenuItem[3] = { nullptr, nullptr, nullptr };
// load options
- flag = db_get_b(NULL, MODULENAME, SET_MI_GROUP, MCAS_NOTINITIATED);
+ flag = g_plugin.getByte(SET_MI_GROUP, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED) {
flag = MCAS_EXIMPORT | TRUE;
- db_set_b(NULL, MODULENAME, SET_MI_GROUP, flag);
+ g_plugin.setByte(SET_MI_GROUP, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -391,10 +391,10 @@ void RebuildSubGroup() static HGENMENU hMenuItem[3] = { nullptr, nullptr, nullptr };
// load options
- flag = db_get_b(NULL, MODULENAME, SET_MI_SUBGROUP, MCAS_NOTINITIATED);
+ flag = g_plugin.getByte(SET_MI_SUBGROUP, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED) {
flag = MCAS_DISABLED | TRUE;
- db_set_b(NULL, MODULENAME, SET_MI_SUBGROUP, flag);
+ g_plugin.setByte(SET_MI_SUBGROUP, flag);
}
// delete all MenuItems and set all bytes 0 to avoid problems
@@ -499,10 +499,10 @@ INT_PTR RebuildAccount(WPARAM, LPARAM lParam) RemoveMenuItems(hMenuItemAccount, mItems * g_clistApi.menuProtos->getCount());
// load options
- int flag = db_get_b(NULL, MODULENAME, SET_MI_ACCOUNT, MCAS_NOTINITIATED);
+ int flag = g_plugin.getByte(SET_MI_ACCOUNT, MCAS_NOTINITIATED);
if (flag == MCAS_NOTINITIATED) {
flag = MCAS_EXIMPORT | TRUE;
- db_set_b(NULL, MODULENAME, SET_MI_ACCOUNT, flag);
+ g_plugin.setByte(SET_MI_ACCOUNT, flag);
}
// loop for all account names
diff --git a/plugins/UserInfoEx/src/psp_anniversary.cpp b/plugins/UserInfoEx/src/psp_anniversary.cpp index ab41b642d9..a75ad3d52f 100644 --- a/plugins/UserInfoEx/src/psp_anniversary.cpp +++ b/plugins/UserInfoEx/src/psp_anniversary.cpp @@ -44,7 +44,7 @@ static INT_PTR CALLBACK DlgProc_AnniversaryEditor(HWND hDlg, UINT uMsg, WPARAM w SetUserData(hDlg, lParam);
// set icons
- if (db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1)) {
+ if (g_plugin.getByte(SET_ICONS_BUTTONS, 1)) {
SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK));
SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL));
}
diff --git a/plugins/UserInfoEx/src/psp_general.cpp b/plugins/UserInfoEx/src/psp_general.cpp index e3d1a10de4..3dc0e6de02 100644 --- a/plugins/UserInfoEx/src/psp_general.cpp +++ b/plugins/UserInfoEx/src/psp_general.cpp @@ -91,7 +91,7 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar CheckDlgButton(hDlg, RADIO_FEMALE, (dbv.bVal == 'F') ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, RADIO_MALE, (dbv.bVal == 'M') ? BST_CHECKED : BST_UNCHECKED);
- bEnable = !hContact || Flags.B.hasCustom || !db_get_b(NULL, MODULENAME, SET_PROPSHEET_PCBIREADONLY, 0);
+ bEnable = !hContact || Flags.B.hasCustom || !g_plugin.getByte(SET_PROPSHEET_PCBIREADONLY, 0);
EnableWindow(GetDlgItem(hDlg, RADIO_FEMALE), bEnable);
EnableWindow(GetDlgItem(hDlg, RADIO_MALE), bEnable);
}
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 0d9ea34eaa..405e1a6191 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -135,7 +135,7 @@ static BYTE EnableControls(HWND hDlg, const int *idCtrl, int countCtrl, BYTE bEn **/
static BYTE DBGetCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE bDefault)
{
- BYTE val = (db_get_b(NULL, MODULENAME, pszSetting, bDefault) & 1) == 1;
+ BYTE val = (g_plugin.getByte(pszSetting, bDefault) & 1) == 1;
CheckDlgButton(hDlg, idCtrl, val ? BST_CHECKED : BST_UNCHECKED);
return val;
}
@@ -153,9 +153,9 @@ static BYTE DBGetCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE b static BYTE DBWriteCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting)
{
BYTE val = IsDlgButtonChecked(hDlg, idCtrl);
- int Temp = db_get_b(NULL, MODULENAME, pszSetting, 0);
+ int Temp = g_plugin.getByte(pszSetting, 0);
Temp &= ~1;
- db_set_b(NULL, MODULENAME, pszSetting, Temp |= val);
+ g_plugin.setByte(pszSetting, Temp |= val);
return val;
}
@@ -172,7 +172,7 @@ static BYTE DBWriteCheckBtn(HWND hDlg, const int idCtrl, LPCSTR pszSetting) **/
static void DBGetColor(HWND hDlg, const int idCtrl, LPCSTR pszSetting, DWORD bDefault)
{
- SendDlgItemMessage(hDlg, idCtrl, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULENAME, pszSetting, bDefault));
+ SendDlgItemMessage(hDlg, idCtrl, CPM_SETCOLOUR, 0, g_plugin.getDword(pszSetting, bDefault));
}
/**
@@ -187,7 +187,7 @@ static void DBGetColor(HWND hDlg, const int idCtrl, LPCSTR pszSetting, DWORD bDe **/
static void DBWriteColor(HWND hDlg, const int idCtrl, LPCSTR pszSetting)
{
- db_set_dw(NULL, MODULENAME, pszSetting, (DWORD)SendDlgItemMessage(hDlg, idCtrl, CPM_GETCOLOUR, 0, 0));
+ g_plugin.setDword(pszSetting, (DWORD)SendDlgItemMessage(hDlg, idCtrl, CPM_GETCOLOUR, 0, 0));
}
/**
@@ -209,8 +209,10 @@ static BYTE DBWriteEditByte(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYTE BOOL t;
v = (BYTE)GetDlgItemInt(hDlg, idCtrl, &t, FALSE);
- if (t && (v != db_get_b(NULL, MODULENAME, pszSetting, defVal)))
- return db_set_b(NULL, MODULENAME, pszSetting, v) == 0;
+ if (t && (v != g_plugin.getByte(pszSetting, defVal))) {
+ g_plugin.setByte(pszSetting, v);
+ return true;
+ }
return FALSE;
}
@@ -233,8 +235,10 @@ static BYTE DBWriteEditWord(HWND hDlg, const int idCtrl, LPCSTR pszSetting, WORD BOOL t;
v = (WORD)GetDlgItemInt(hDlg, idCtrl, &t, FALSE);
- if (t && (v != db_get_w(NULL, MODULENAME, pszSetting, defVal)))
- return db_set_w(NULL, MODULENAME, pszSetting, v) == 0;
+ if (t && (v != g_plugin.getWord(pszSetting, defVal))) {
+ g_plugin.setWord(pszSetting, v);
+ return true;
+ }
return FALSE;
}
@@ -256,8 +260,10 @@ static BYTE DBWriteComboByte(HWND hDlg, const int idCtrl, LPCSTR pszSetting, BYT BYTE v;
v = (BYTE)SendDlgItemMessage(hDlg, idCtrl, CB_GETCURSEL, NULL, NULL);
- if (v != db_get_b(NULL, MODULENAME, pszSetting, defVal))
- return db_set_b(NULL, MODULENAME, pszSetting, v) == 0;
+ if (v != g_plugin.getByte(pszSetting, defVal)) {
+ g_plugin.setByte(pszSetting, v);
+ return true;
+ }
return FALSE;
}
@@ -279,7 +285,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, // menu item settings
for (auto &it : ctrl_Menu) {
- int flag = db_get_b(NULL, MODULENAME, it.pszKey, 2);
+ int flag = g_plugin.getByte(it.pszKey, 2);
// check button and enable / disable control
int idEnable[] = { it.idCheckbox + 1, it.idNONE, it.idALL, it.idEXIMPORT };
EnableControls(hDlg, idEnable, _countof(idEnable), DBGetCheckBtn(hDlg, it.idCheckbox, it.pszKey, 0));
@@ -313,7 +319,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, flag |= IsDlgButtonChecked(hDlg, it.idNONE) ? 2 : 0;
flag |= IsDlgButtonChecked(hDlg, it.idALL) ? 4 : 0;
flag |= IsDlgButtonChecked(hDlg, it.idEXIMPORT) ? 8 : 0;
- db_set_b(NULL, MODULENAME, it.pszKey, (BYTE)flag);
+ g_plugin.setByte(it.pszKey, (BYTE)flag);
}
RebuildMenu();
@@ -324,14 +330,14 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, bool valNew = IsDlgButtonChecked(hDlg, CHECK_OPT_FLAGSUNKNOWN) != 0;
if (g_bUseUnknownFlag != valNew) {
g_bUseUnknownFlag = valNew;
- db_set_b(NULL, MODNAMEFLAGS, "UseUnknownFlag", valNew);
+ db_set_b(0, MODNAMEFLAGS, "UseUnknownFlag", valNew);
FlagsClistChange = true;
FlagsMsgWndChange = true;
}
valNew = IsDlgButtonChecked(hDlg, CHECK_OPT_FLAGSMSGSTATUS) != 0;
if (g_bShowStatusIconFlag != valNew) {
g_bShowStatusIconFlag = valNew;
- db_set_b(NULL, MODNAMEFLAGS, "ShowStatusIconFlag", valNew);
+ db_set_b(0, MODNAMEFLAGS, "ShowStatusIconFlag", valNew);
FlagsMsgWndChange = true;
}
@@ -347,7 +353,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, // misc
BYTE bEnabled = IsDlgButtonChecked(hDlg, CHECK_OPT_ZODIACAVATAR);
- db_set_b(NULL, MODULENAME, SET_ZODIAC_AVATARS, bEnabled);
+ g_plugin.setByte(SET_ZODIAC_AVATARS, bEnabled);
NServices::NAvatar::Enable(bEnabled);
}
break;
@@ -615,7 +621,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam bInitialized = 0;
// set reminder options
- BYTE bEnabled = db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
+ BYTE bEnabled = g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
SendDlgItemMessage(hDlg, EDIT_REMIND_ENABLED, CB_SETCURSEL, bEnabled, NULL);
DlgProc_ReminderOpts(hDlg, WM_COMMAND, MAKEWPARAM(EDIT_REMIND_ENABLED, CBN_SELCHANGE),
(LPARAM)GetDlgItem(hDlg, EDIT_REMIND_ENABLED));
@@ -626,16 +632,16 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam DBGetCheckBtn(hDlg, CHECK_REMIND_STARTUP, SET_REMIND_CHECKON_STARTUP, FALSE);
DBGetCheckBtn(hDlg, CHECK_REMIND_SECURED, SET_REMIND_SECUREBIRTHDAY, FALSE);
- SetDlgItemInt(hDlg, EDIT_REMIND, db_get_w(NULL, MODULENAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE);
- SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, db_get_b(NULL, MODULENAME, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE);
- SetDlgItemInt(hDlg, EDIT_REMIND2, db_get_w(NULL, MODULENAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL), FALSE);
+ SetDlgItemInt(hDlg, EDIT_REMIND, g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE);
+ SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, g_plugin.getByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE);
+ SetDlgItemInt(hDlg, EDIT_REMIND2, g_plugin.getWord(SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL), FALSE);
- SendDlgItemMessage(hDlg, EDIT_BIRTHMODULE, CB_SETCURSEL, db_get_b(NULL, MODULENAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE), NULL);
+ SendDlgItemMessage(hDlg, EDIT_BIRTHMODULE, CB_SETCURSEL, g_plugin.getByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE), NULL);
MTime mtLast;
wchar_t szTime[MAX_PATH];
- mtLast.DBGetStamp(NULL, MODULENAME, SET_REMIND_LASTCHECK);
+ mtLast.DBGetStamp(0, MODULENAME, SET_REMIND_LASTCHECK);
mtLast.UTCToLocal();
mtLast.TimeFormat(szTime, _countof(szTime));
@@ -661,7 +667,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam bReminderCheck = DBWriteEditWord(hDlg, EDIT_REMIND, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
// save primary birthday module
- BYTE bOld = db_get_b(NULL, MODULENAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE); // = 1
+ BYTE bOld = g_plugin.getByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE); // = 1
BYTE bNew = (BYTE)ComboBox_GetCurSel(GetDlgItem(hDlg, EDIT_BIRTHMODULE));
if (bOld != bNew) {
// keep the database clean
@@ -675,8 +681,8 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam // update current reminder state
BYTE bNewVal = (BYTE)SendDlgItemMessage(hDlg, EDIT_REMIND_ENABLED, CB_GETCURSEL, NULL, NULL);
- if (db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, 1) != bNewVal) {
- db_set_b(NULL, MODULENAME, SET_REMIND_ENABLED, bNewVal);
+ if (g_plugin.getByte(SET_REMIND_ENABLED, 1) != bNewVal) {
+ g_plugin.setByte(SET_REMIND_ENABLED, bNewVal);
if (bNewVal == REMIND_OFF) {
SvcReminderEnable(FALSE);
bReminderCheck = FALSE;
@@ -729,7 +735,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam if (bInitialized && HIWORD(wParam) == EN_UPDATE) {
BOOL t;
WORD v = (WORD)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
- if (t && (v != db_get_w(NULL, MODULENAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET)))
+ if (t && (v != g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET)))
NotifyParentOfChange(hDlg);
}
break;
@@ -739,7 +745,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam if (bInitialized && HIWORD(wParam) == EN_UPDATE) {
BOOL t;
BYTE v = (BYTE)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
- if (t && (v != db_get_b(NULL, MODULENAME, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET)))
+ if (t && (v != g_plugin.getByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET)))
NotifyParentOfChange(hDlg);
}
break;
@@ -749,7 +755,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam if (bInitialized && HIWORD(wParam) == EN_UPDATE) {
BOOL t;
WORD v = (WORD)GetDlgItemInt(hDlg, LOWORD(wParam), &t, FALSE);
- if (t && (v != db_get_w(NULL, MODULENAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL)))
+ if (t && (v != g_plugin.getWord(SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL)))
NotifyParentOfChange(hDlg);
}
}
@@ -792,7 +798,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // set colortype checkboxes and color controls
DBGetColor(hDlg, CLR_BBACK, SET_POPUP_BIRTHDAY_COLOR_BACK, RGB(192, 180, 30));
DBGetColor(hDlg, CLR_BTEXT, SET_POPUP_BIRTHDAY_COLOR_TEXT, RGB(0, 0, 0));
- switch (db_get_b(NULL, MODULENAME, SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
+ switch (g_plugin.getByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_DEFAULT:
CheckDlgButton(hDlg, CHECK_OPT_POPUP_DEFCLR, BST_CHECKED);
break;
@@ -803,7 +809,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR DBGetColor(hDlg, CLR_ABACK, SET_POPUP_ANNIVERSARY_COLOR_BACK, RGB(90, 190, 130));
DBGetColor(hDlg, CLR_ATEXT, SET_POPUP_ANNIVERSARY_COLOR_TEXT, RGB(0, 0, 0));
- switch (db_get_b(NULL, MODULENAME, SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
+ switch (g_plugin.getByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_DEFAULT:
CheckDlgButton(hDlg, CHECK_OPT_POPUP_ADEFCLR, BST_CHECKED);
break;
@@ -816,7 +822,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(CHECK_OPT_POPUP_ADEFCLR, BN_CLICKED), NULL);
}
// set delay values
- bDelay = db_get_b(NULL, MODULENAME, SET_POPUP_DELAY, 0);
+ bDelay = g_plugin.getByte(SET_POPUP_DELAY, 0);
switch (bDelay) {
case 0:
CheckDlgButton(hDlg, RADIO_OPT_POPUP_DEFAULT, BST_CHECKED);
@@ -846,7 +852,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // save popup style for birthdays
DBWriteColor(hDlg, CLR_BBACK, SET_POPUP_BIRTHDAY_COLOR_BACK);
DBWriteColor(hDlg, CLR_BTEXT, SET_POPUP_BIRTHDAY_COLOR_TEXT);
- db_set_b(NULL, MODULENAME, SET_POPUP_BIRTHDAY_COLORTYPE,
+ g_plugin.setByte(SET_POPUP_BIRTHDAY_COLORTYPE,
IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_DEFCLR)
? POPUP_COLOR_DEFAULT
: IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_WINCLR)
@@ -856,7 +862,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // save popup style for anniversaries
DBWriteColor(hDlg, CLR_ABACK, SET_POPUP_ANNIVERSARY_COLOR_BACK);
DBWriteColor(hDlg, CLR_ATEXT, SET_POPUP_ANNIVERSARY_COLOR_TEXT);
- db_set_b(NULL, MODULENAME, SET_POPUP_ANNIVERSARY_COLORTYPE,
+ g_plugin.setByte(SET_POPUP_ANNIVERSARY_COLORTYPE,
IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_ADEFCLR)
? POPUP_COLOR_DEFAULT
: IsDlgButtonChecked(hDlg, CHECK_OPT_POPUP_AWINCLR)
@@ -865,14 +871,14 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // save delay
if (IsDlgButtonChecked(hDlg, RADIO_OPT_POPUP_PERMANENT))
- db_set_b(NULL, MODULENAME, SET_POPUP_DELAY, 255);
+ g_plugin.setByte(SET_POPUP_DELAY, 255);
else if (IsDlgButtonChecked(hDlg, RADIO_OPT_POPUP_CUSTOM)) {
wchar_t szDelay[4];
GetDlgItemText(hDlg, EDIT_DELAY, szDelay, _countof(szDelay));
- db_set_b(NULL, MODULENAME, SET_POPUP_DELAY, (BYTE)wcstol(szDelay, nullptr, 10));
+ g_plugin.setByte(SET_POPUP_DELAY, (BYTE)wcstol(szDelay, nullptr, 10));
}
else
- db_unset(NULL, MODULENAME, SET_POPUP_DELAY);
+ g_plugin.delSetting(SET_POPUP_DELAY);
}
break;
@@ -881,7 +887,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR case BTN_PREVIEW:
{
POPUPDATAT ppd = { 0 };
- ppd.iSeconds = (int)db_get_b(NULL, MODULENAME, SET_POPUP_DELAY, 0);
+ ppd.iSeconds = (int)g_plugin.getByte(SET_POPUP_DELAY, 0);
mir_wstrncpy(ppd.lptzText, TranslateT("This is the reminder message"), MAX_SECONDLINE);
// Birthday
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index 9884240d26..14a1d1c247 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -155,7 +155,7 @@ namespace NServices **/
void OnModulesLoaded()
{
- Enable(db_get_b(NULL, MODULENAME, SET_ZODIAC_AVATARS, FALSE));
+ Enable(g_plugin.getByte(SET_ZODIAC_AVATARS, FALSE));
}
} /* namespace NAvatar */
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 8d7d7c4952..7652aba64f 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -177,7 +177,7 @@ void SvcEMailRebuildMenu() {
static HANDLE hPrebuildMenuHook = nullptr;
- if (db_get_b(NULL, MODULENAME, SET_EXTENDED_EMAILSERVICE, TRUE)) {
+ if (g_plugin.getByte(SET_EXTENDED_EMAILSERVICE, TRUE)) {
if (!hPrebuildMenuHook)
hPrebuildMenuHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildMenu);
@@ -216,9 +216,9 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) if (bUpdateDB) {
bChanged = g_eiEmail != bEnable;
- db_set_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_EMAIL, g_eiEmail = bEnable);
+ g_plugin.setByte(SET_CLIST_EXTRAICON_EMAIL, g_eiEmail = bEnable);
}
- else bChanged = g_eiEmail = db_get_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL) != 0;
+ else bChanged = g_eiEmail = g_plugin.getByte(SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL) != 0;
if (g_eiEmail) { // E-mail checked
// hook events
@@ -252,7 +252,7 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) void SvcEMailLoadModule()
{
SvcEMailEnableExtraIcons();
- if (db_get_b(NULL, MODULENAME, SET_EXTENDED_EMAILSERVICE, TRUE)) {
+ if (g_plugin.getByte(SET_EXTENDED_EMAILSERVICE, TRUE)) {
// create own email send command
DestroyServiceFunction(MS_EMAIL_SENDEMAIL);
CreateServiceFunction(MS_EMAIL_SENDEMAIL, MenuCommand);
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index b6827227eb..bd57c715c5 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -111,9 +111,9 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) if (bUpdateDB) {
bChanged = g_eiGender != bEnable;
- db_set_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_GENDER2, g_eiGender = bEnable);
+ g_plugin.setByte(SET_CLIST_EXTRAICON_GENDER2, g_eiGender = bEnable);
}
- else bChanged = g_eiGender = db_get_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_GENDER2, 0) != 0;
+ else bChanged = g_eiGender = g_plugin.getByte(SET_CLIST_EXTRAICON_GENDER2, 0) != 0;
if (g_eiGender) { // Gender checked or dropdown select
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index dbf32d5f67..8361873cb6 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -176,9 +176,9 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) if (bUpdateDB) {
bChanged = g_eiHome != bEnable;
- db_set_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_HOMEPAGE, g_eiHome = bEnable);
+ g_plugin.setByte(SET_CLIST_EXTRAICON_HOMEPAGE, g_eiHome = bEnable);
}
- else bChanged = g_eiHome = db_get_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE) != 0;
+ else bChanged = g_eiHome = g_plugin.getByte(SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE) != 0;
if (g_eiHome) {
// hook events
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 18e4cbb4e1..49215d1471 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -132,9 +132,9 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) if (bUpdateDB) {
bChanged = g_eiPhone != bEnable;
- db_set_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_PHONE, g_eiPhone = bEnable);
+ g_plugin.setByte(SET_CLIST_EXTRAICON_PHONE, g_eiPhone = bEnable);
}
- else bChanged = g_eiPhone = db_get_b(NULL, MODULENAME, SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE) != 0;
+ else bChanged = g_eiPhone = g_plugin.getByte(SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE) != 0;
// force module enabled, if extraicon plugin was found
if (g_eiPhone) {
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 53cdac42d9..6f3d9473ea 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -241,7 +241,7 @@ class CDlgUpdProgress : public CUpdProgress { ICO_BTN_DOWNARROW, BM_SETIMAGE, IDSKIP },
{ ICO_BTN_CANCEL, BM_SETIMAGE, IDCANCEL }
};
- IcoLib_SetCtrlIcons(hWnd, idIcon, db_get_b(NULL, MODULENAME, SET_ICONS_BUTTONS, 1) ? 2 : 1);
+ IcoLib_SetCtrlIcons(hWnd, idIcon, g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? 2 : 1);
SendDlgItemMessage(hWnd, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
SendDlgItemMessage(hWnd, IDSKIP, BUTTONTRANSLATE, NULL, NULL);
@@ -390,7 +390,7 @@ public: : CUpdProgress(data)
{
_szText = nullptr;
- _bBBCode = db_get_b(NULL, "Popup", "UseMText", FALSE);
+ _bBBCode = db_get_b(0, "Popup", "UseMText", FALSE);
_popupButtons[0].cbSize = sizeof(POPUPACTION);
_popupButtons[0].flags = PAF_ENABLED;
@@ -690,7 +690,7 @@ public: if (Size() && !_pProgress)
{
- if (ServiceExists(MS_POPUP_CHANGETEXTT) && db_get_b(NULL, MODULENAME, "PopupProgress", FALSE))
+ if (ServiceExists(MS_POPUP_CHANGETEXTT) && g_plugin.getByte("PopupProgress", FALSE))
{
_pProgress = new CPopupUpdProgress(this);
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index d5a7aedb14..005c1e711c 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -251,7 +251,7 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- ppd.iSeconds = (int)db_get_b(NULL, MODULENAME, SET_POPUP_DELAY, 0);
+ ppd.iSeconds = (int)g_plugin.getByte(SET_POPUP_DELAY, 0);
if (hContact) {
ppd.lchContact = hContact;
@@ -265,29 +265,29 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT switch (eventType) {
case CEvent::BIRTHDAY:
- switch (db_get_b(NULL, MODULENAME, SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
+ switch (g_plugin.getByte(SET_POPUP_BIRTHDAY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
break;
case POPUP_COLOR_CUSTOM:
- ppd.colorBack = db_get_dw(NULL, MODULENAME, SET_POPUP_BIRTHDAY_COLOR_BACK, RGB(192, 180, 30));
- ppd.colorText = db_get_dw(NULL, MODULENAME, SET_POPUP_BIRTHDAY_COLOR_TEXT, 0);
+ ppd.colorBack = g_plugin.getDword(SET_POPUP_BIRTHDAY_COLOR_BACK, RGB(192, 180, 30));
+ ppd.colorText = g_plugin.getDword(SET_POPUP_BIRTHDAY_COLOR_TEXT, 0);
break;
}
break;
case CEvent::ANNIVERSARY:
- switch (db_get_b(NULL, MODULENAME, SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
+ switch (g_plugin.getByte(SET_POPUP_ANNIVERSARY_COLORTYPE, POPUP_COLOR_CUSTOM)) {
case POPUP_COLOR_WINDOWS:
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
break;
case POPUP_COLOR_CUSTOM:
- ppd.colorBack = db_get_dw(NULL, MODULENAME, SET_POPUP_ANNIVERSARY_COLOR_BACK, RGB(90, 190, 130));
- ppd.colorText = db_get_dw(NULL, MODULENAME, SET_POPUP_ANNIVERSARY_COLOR_TEXT, 0);
+ ppd.colorBack = g_plugin.getDword(SET_POPUP_ANNIVERSARY_COLOR_BACK, RGB(90, 190, 130));
+ ppd.colorText = g_plugin.getDword(SET_POPUP_ANNIVERSARY_COLOR_TEXT, 0);
break;
}
}
@@ -349,7 +349,7 @@ static void NotifyFlashCListIcon(MCONTACT hContact, const CEvent &evt) static BYTE NotifyWithSound(const CEvent &evt)
{
- if (evt._wDaysLeft <= min(db_get_b(NULL, MODULENAME, SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), gRemindOpts.wDaysEarlier)) {
+ if (evt._wDaysLeft <= min(g_plugin.getByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), gRemindOpts.wDaysEarlier)) {
switch (evt._eType) {
case CEvent::BIRTHDAY:
Skin_PlaySound(evt._wDaysLeft == 0 ? SOUND_BIRTHDAY_TODAY : SOUND_BIRTHDAY_SOON);
@@ -460,7 +460,7 @@ static bool CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti mtb.DBGetReminderOpts(hContact);
// make backup of each protocol based birthday
- if (db_get_b(NULL, MODULENAME, SET_REMIND_SECUREBIRTHDAY, TRUE))
+ if (g_plugin.getByte(SET_REMIND_SECUREBIRTHDAY, TRUE))
mtb.BackupBirthday(hContact, nullptr, 0, LastAnwer);
if (mtb.RemindOption() != BST_UNCHECKED) {
@@ -572,7 +572,7 @@ void SvcReminderCheckAll(const ENotify notify) NotifyWithSound(evt);
// popup anniversary list
- if (db_get_b(NULL, MODULENAME, SET_ANNIVLIST_POPUP, FALSE))
+ if (g_plugin.getByte(SET_ANNIVLIST_POPUP, FALSE))
DlgAnniversaryListShow(0, 0);
if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV)
@@ -733,7 +733,7 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) LPCSTR SvcReminderGetMyBirthdayModule()
{
- return ((db_get_b(NULL, MODULENAME, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE) == 1) ? USERINFO : MOD_MBIRTHDAY);
+ return ((g_plugin.getByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE) == 1) ? USERINFO : MOD_MBIRTHDAY);
}
/***********************************************************************************************************
@@ -787,23 +787,23 @@ static void CALLBACK TimerProc_Check(HWND, UINT, UINT_PTR, DWORD) static void UpdateTimer(BYTE bStartup)
{
- LONG wNotifyInterval = 60 * 60 * (LONG)db_get_w(NULL, MODULENAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL);
+ LONG wNotifyInterval = 60 * 60 * (LONG)g_plugin.getWord(SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL);
MTime now, last;
now.GetTimeUTC();
if (bStartup) {
- last.DBGetStamp(NULL, MODULENAME, SET_REMIND_LASTCHECK);
+ last.DBGetStamp(0, MODULENAME, SET_REMIND_LASTCHECK);
// if last check occured at least one day before just do it on startup again
- if (now.Year() > last.Year() || now.Month() > last.Month() || now.Day() > last.Day() || db_get_b(NULL, MODULENAME, SET_REMIND_CHECKON_STARTUP, FALSE))
+ if (now.Year() > last.Year() || now.Month() > last.Month() || now.Day() > last.Day() || g_plugin.getByte(SET_REMIND_CHECKON_STARTUP, FALSE))
wNotifyInterval = 5;
else
wNotifyInterval -= now.Compare(last);
ghRemindDateChangeTimer = SetTimer(nullptr, 0, 1000 * 60 * 5, (TIMERPROC)TimerProc_DateChanged);
}
- else now.DBWriteStamp(NULL, MODULENAME, SET_REMIND_LASTCHECK);
+ else now.DBWriteStamp(0, MODULENAME, SET_REMIND_LASTCHECK);
// wait at least 5 seconds before checking at startup, to give miranda a better chance to load faster
KillTimer(nullptr, ghRemindTimer);
@@ -825,12 +825,12 @@ void SvcReminderEnable(BYTE bEnable) ghSettingsChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
// reinit reminder options
- gRemindOpts.RemindState = db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
- gRemindOpts.wDaysEarlier = db_get_w(NULL, MODULENAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
- gRemindOpts.bCListExtraIcon = db_get_b(NULL, MODULENAME, SET_REMIND_EXTRAICON, 1);
- gRemindOpts.bCheckVisibleOnly = db_get_b(NULL, MODULENAME, SET_REMIND_CHECKVISIBLE, DEFVAL_REMIND_CHECKVISIBLE);
- gRemindOpts.bFlashCList = db_get_b(NULL, MODULENAME, SET_REMIND_FLASHICON, FALSE);
- gRemindOpts.bPopups = ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODULENAME, SET_POPUP_ENABLED, DEFVAL_POPUP_ENABLED);
+ gRemindOpts.RemindState = g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED);
+ gRemindOpts.wDaysEarlier = g_plugin.getWord(SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET);
+ gRemindOpts.bCListExtraIcon = g_plugin.getByte(SET_REMIND_EXTRAICON, 1);
+ gRemindOpts.bCheckVisibleOnly = g_plugin.getByte(SET_REMIND_CHECKVISIBLE, DEFVAL_REMIND_CHECKVISIBLE);
+ gRemindOpts.bFlashCList = g_plugin.getByte(SET_REMIND_FLASHICON, FALSE);
+ gRemindOpts.bPopups = ServiceExists(MS_POPUP_ADDPOPUPT) && g_plugin.getByte(SET_POPUP_ENABLED, DEFVAL_POPUP_ENABLED);
// init the timer
UpdateTimer(TRUE);
@@ -857,7 +857,7 @@ void SvcReminderOnModulesLoaded(void) // init clist extra icon structure
OnCListRebuildIcons(0, 0);
- SvcReminderEnable(db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF);
+ SvcReminderEnable(g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF);
}
/**
@@ -883,7 +883,7 @@ void SvcReminderLoadModule(void) hk.pszService = MS_USERINFO_REMINDER_CHECK;
g_plugin.addHotkey(&hk);
- if (db_get_b(NULL, MODULENAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF && ExtraIcon == INVALID_HANDLE_VALUE)
+ if (g_plugin.getByte(SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF && ExtraIcon == INVALID_HANDLE_VALUE)
ExtraIcon = ExtraIcon_RegisterIcolib("Reminder", LPGEN("Reminder (UInfoEx)"), ICO_COMMON_ANNIVERSARY);
}
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index 582b8d8da0..d36f6bdfaf 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -91,7 +91,7 @@ static INT_PTR CALLBACK extratextDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPA // dialog box for the %subject% selection void ResetCList(HWND hwndDlg) { - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0); + SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0); } @@ -127,7 +127,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM MCONTACT hItem, hContact = wParam; log_debugA("VARM_SETSUBJECT: %u", hContact); if (hContact == INVALID_CONTACT_ID) { - wchar_t *tszContact = db_get_wsa(NULL, MODULENAME, SETTING_SUBJECT); + wchar_t *tszContact = g_plugin.getWStringA(SETTING_SUBJECT); log_debugA("VARM_SETSUBJECT: %s", tszContact); if (tszContact != nullptr) { hContact = getContactFromString(tszContact, CI_PROTOID); @@ -196,13 +196,13 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM break; case WM_DESTROY: - db_unset(NULL, MODULENAME, SETTING_SUBJECT); + g_plugin.delSetting(SETTING_SUBJECT); MCONTACT hContact = (MCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); if (hContact != NULL) { wchar_t *tszContact = encodeContactToString(hContact); if (tszContact != nullptr) { - db_set_ws(NULL, MODULENAME, SETTING_SUBJECT, tszContact); + g_plugin.setWString(SETTING_SUBJECT, tszContact); mir_free(tszContact); } } break; @@ -583,7 +583,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM memset(dat, 0, sizeof(INPUTDLGDATA)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); // splitter things - dat->splitterPos = (INT_PTR)db_get_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, -1); + dat->splitterPos = (INT_PTR)g_plugin.getDword(SETTING_SPLITTERPOS, -1); { RECT rc; POINT pt; @@ -718,7 +718,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM KillTimer(hwndDlg, IDT_PARSE); if (dat == nullptr) break; - db_set_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, dat->splitterPos); + g_plugin.setDword(SETTING_SPLITTERPOS, dat->splitterPos); mir_free(dat); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); break; diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index ed4bf81e07..116bd46b14 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -26,15 +26,15 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg);
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, SETTING_STARTUPTEXT, &dbv)) {
+ if (!g_plugin.getWString(SETTING_STARTUPTEXT, &dbv)) {
SetDlgItemText(hwndDlg, IDC_FORMATTEXT, dbv.pwszVal);
db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_STRIPCRLF, db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_STRIPWS, db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_STRIPALL, db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_PARSEATSTARTUP, g_plugin.getByte(SETTING_PARSEATSTARTUP, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_STRIPCRLF, g_plugin.getByte(SETTING_STRIPCRLF, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_STRIPWS, g_plugin.getByte(SETTING_STRIPWS, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_STRIPALL, g_plugin.getByte(SETTING_STRIPALL, 0) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPCRLF), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_STRIPWS), IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? FALSE : TRUE);
variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP);
@@ -90,14 +90,14 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
if (GetDlgItemText(hwndDlg, IDC_FORMATTEXT, szFormatText, len + 1) != 0)
- db_set_ws(NULL, MODULENAME, SETTING_STARTUPTEXT, szFormatText);
+ g_plugin.setWString(SETTING_STARTUPTEXT, szFormatText);
mir_free(szFormatText);
}
- db_set_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP) ? 1 : 0));
- db_set_b(NULL, MODULENAME, SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF) ? 1 : 0));
- db_set_b(NULL, MODULENAME, SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS) ? 1 : 0));
- db_set_b(NULL, MODULENAME, SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? 1 : 0));
+ g_plugin.setByte(SETTING_PARSEATSTARTUP, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PARSEATSTARTUP) ? 1 : 0));
+ g_plugin.setByte(SETTING_STRIPCRLF, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPCRLF) ? 1 : 0));
+ g_plugin.setByte(SETTING_STRIPWS, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPWS) ? 1 : 0));
+ g_plugin.setByte(SETTING_STRIPALL, (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_STRIPALL) ? 1 : 0));
}
break;
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 2db71497a4..479f18d34b 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -368,9 +368,9 @@ int setParseOptions(struct ParseOptions *po) po = &gParseOpts; memset(po, 0, sizeof(struct ParseOptions)); - if (!db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0)) { - po->bStripEOL = db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0); - po->bStripWS = db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0); + if (!g_plugin.getByte(SETTING_STRIPALL, 0)) { + po->bStripEOL = g_plugin.getByte(SETTING_STRIPCRLF, 0); + po->bStripWS = g_plugin.getByte(SETTING_STRIPWS, 0); } else po->bStripAll = TRUE; @@ -418,10 +418,10 @@ int LoadVarModule() log_debugA("Variables: Internal tokens registered"); - if (db_get_b(NULL, MODULENAME, SETTING_PARSEATSTARTUP, 0)) { + if (g_plugin.getByte(SETTING_PARSEATSTARTUP, 0)) { FORMATINFO fi = { 0 }; fi.cbSize = sizeof(fi); - fi.szFormat.w = db_get_wsa(NULL, MODULENAME, SETTING_STARTUPTEXT); + fi.szFormat.w = g_plugin.getWStringA(SETTING_STARTUPTEXT); if (fi.szFormat.w != nullptr) { mir_free(formatString(&fi)); mir_free(fi.szFormat.w); diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp index 49d25d64b8..45f263e94d 100755 --- a/plugins/Watrack_MPD/src/init.cpp +++ b/plugins/Watrack_MPD/src/init.cpp @@ -53,9 +53,9 @@ static int OnModulesLoaded(WPARAM, LPARAM) nlu.szSettingsModule = __PLUGIN_NAME;
ghNetlibUser = Netlib_RegisterUser(&nlu);
- gbPort = db_get_w(NULL, MODULENAME, "Port", 6600);
- gbHost = UniGetContactSettingUtf(NULL, MODULENAME, "Server", L"127.0.0.1");
- gbPassword = UniGetContactSettingUtf(NULL, MODULENAME, "Password", L"");
+ gbPort = g_plugin.getWord("Port", 6600);
+ gbHost = UniGetContactSettingUtf(0, MODULENAME, "Server", L"127.0.0.1");
+ gbPassword = UniGetContactSettingUtf(0, MODULENAME, "Password", L"");
if (ServiceExists(MS_WAT_PLAYER))
bWatrackService = TRUE;
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index 93bcefa620..f861e8ed90 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -25,11 +25,11 @@ public: bool OnInitDialog() override { - edit_PORT.SetInt(db_get_w(NULL, MODULENAME, "Port", 6600)); - wchar_t *tmp = UniGetContactSettingUtf(NULL, MODULENAME, "Server", L"127.0.0.1"); + edit_PORT.SetInt(g_plugin.getWord("Port", 6600)); + wchar_t *tmp = UniGetContactSettingUtf(0, MODULENAME, "Server", L"127.0.0.1"); edit_SERVER.SetText(tmp); mir_free(tmp); - tmp = UniGetContactSettingUtf(NULL, MODULENAME, "Password", L""); + tmp = UniGetContactSettingUtf(0, MODULENAME, "Password", L""); edit_PASSWORD.SetText(tmp); mir_free(tmp); return true; @@ -37,11 +37,11 @@ public: bool OnApply() override { - db_set_w(NULL, MODULENAME, "Port", (WORD)edit_PORT.GetInt()); + g_plugin.setWord("Port", (WORD)edit_PORT.GetInt()); gbPort = edit_PORT.GetInt(); - db_set_ws(NULL, MODULENAME, "Server", edit_SERVER.GetText()); + g_plugin.setWString("Server", edit_SERVER.GetText()); mir_wstrcpy(gbHost, edit_SERVER.GetText()); - db_set_ws(NULL, MODULENAME, "Password", edit_PASSWORD.GetText()); + g_plugin.setWString("Password", edit_PASSWORD.GetText()); mir_wstrcpy(gbPassword, edit_PASSWORD.GetText()); return true; } diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 5ecdb7f4a5..d8720af41d 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -77,7 +77,7 @@ static const PLUGININFOEX pluginInfoEx = CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>(WEATHERPROTONAME, pluginInfoEx)
{
- opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
+ opt.NoProtoCondition = db_get_b(0, WEATHERPROTONAME, "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(NULL, WEATHERPROTONAME, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
+ ttb.dwFlags = (db_get_b(0, WEATHERPROTONAME, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
hTBButton = g_plugin.addTTB(&ttb);
return 0;
}
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 04dafdaef9..686fe935c5 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -113,7 +113,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) db_free(&dbv);
MessageBox(nullptr, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
- db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
}
// display the Edit Settings dialog box
EditSettings(hContact, 0);
@@ -426,7 +426,7 @@ int NameSearch(wchar_t *name, const int searchId) // add a new weather station via find/add dialog
int WeatherAdd(WPARAM, LPARAM)
{
- db_set_s(NULL, "FindAdd", "LastSearched", "Weather");
+ db_set_s(0, "FindAdd", "LastSearched", "Weather");
CallService(MS_FINDADD_FINDADD, 0, 0);
return 0;
}
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 62fdf93ffc..2f1b66d03d 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -345,7 +345,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFA)) { // if default station is set
mir_wstrcpy(opt.Default, str);
opt.DefStn = hContact;
- db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
}
GetDlgItemText(hwndDlg, IDC_NAME, city, _countof(city));
db_set_ws(hContact, WEATHERPROTONAME, "Nick", city);
@@ -461,7 +461,7 @@ int ContactDeleted(WPARAM wParam, LPARAM) 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(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
return 0; // exit this function quickly
}
}
@@ -469,7 +469,7 @@ 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(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
return 0;
}
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index 8137b19c0d..dfe095e386 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -175,7 +175,7 @@ void EraseAllInfo() }
}
// save option in case of default station changed
- db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
}
void ConvertDataValue(WIDATAITEM *UpdateData, wchar_t *Data)
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 9c5e098dfd..7f7992a6b0 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -154,7 +154,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara }
}
- clr = db_get_dw(NULL, WEATHERPROTONAME, "ColorMwinFrame", GetSysColor(COLOR_3DFACE));
+ 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);
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 4a4beb67d1..3bb684331e 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -97,28 +97,28 @@ void LoadOptions(void) memset(&opt, 0, sizeof(opt));
// main options
- opt.StartupUpdate = db_get_b(NULL, WEATHERPROTONAME, "StartupUpdate", true);
- opt.AutoUpdate = db_get_b(NULL, WEATHERPROTONAME, "AutoUpdate", true);
- opt.UpdateTime = db_get_w(NULL, WEATHERPROTONAME, "UpdateTime", 30);
- opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
- opt.UpdateOnlyConditionChanged = db_get_b(NULL, WEATHERPROTONAME, "CondChangeAsUpdate", true);
- opt.RemoveOldData = db_get_b(NULL, WEATHERPROTONAME, "RemoveOld", false);
- opt.MakeItalic = db_get_b(NULL, WEATHERPROTONAME, "MakeItalic", true);
- opt.AvatarSize = db_get_b(NULL, WEATHERPROTONAME, "AvatarSize", 128);
+ 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);
// units
- opt.tUnit = db_get_w(NULL, WEATHERPROTONAME, "tUnit", 1);
- opt.wUnit = db_get_w(NULL, WEATHERPROTONAME, "wUnit", 2);
- opt.vUnit = db_get_w(NULL, WEATHERPROTONAME, "vUnit", 1);
- opt.pUnit = db_get_w(NULL, WEATHERPROTONAME, "pUnit", 4);
- opt.dUnit = db_get_w(NULL, WEATHERPROTONAME, "dUnit", 1);
- opt.eUnit = db_get_w(NULL, WEATHERPROTONAME, "eUnit", 2);
+ 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"));
wcsncpy_s(opt.DegreeSign, (szValue == NULL) ? L"" : szValue, _TRUNCATE);
- opt.DoNotAppendUnit = db_get_b(NULL, WEATHERPROTONAME, "DoNotAppendUnit", 0);
- opt.NoFrac = db_get_b(NULL, WEATHERPROTONAME, "NoFractions", 0);
+ opt.DoNotAppendUnit = db_get_b(0, WEATHERPROTONAME, "DoNotAppendUnit", 0);
+ opt.NoFrac = db_get_b(0, WEATHERPROTONAME, "NoFractions", 0);
// texts
if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "DisplayText"))
@@ -162,22 +162,22 @@ void LoadOptions(void) SetTextDefault("S");
// advanced
- opt.DisCondIcon = db_get_b(NULL, WEATHERPROTONAME, "DisableConditionIcon", false);
+ opt.DisCondIcon = db_get_b(0, WEATHERPROTONAME, "DisableConditionIcon", false);
// popup options
- opt.UsePopup = db_get_b(NULL, WEATHERPROTONAME, "UsePopUp", true);
- opt.UpdatePopup = db_get_b(NULL, WEATHERPROTONAME, "UpdatePopup", true);
- opt.AlertPopup = db_get_b(NULL, WEATHERPROTONAME, "AlertPopup", true);
- opt.PopupOnChange = db_get_b(NULL, WEATHERPROTONAME, "PopUpOnChange", true);
- opt.ShowWarnings = db_get_b(NULL, WEATHERPROTONAME, "ShowWarnings", true);
+ 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);
// popup colors
- opt.BGColour = db_get_dw(NULL, WEATHERPROTONAME, "BackgroundColour", GetSysColor(COLOR_BTNFACE));
- opt.TextColour = db_get_dw(NULL, WEATHERPROTONAME, "TextColour", GetSysColor(COLOR_WINDOWTEXT));
- opt.UseWinColors = (BOOL)db_get_b(NULL, WEATHERPROTONAME, "UseWinColors", false);
+ 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);
// popup actions
- opt.LeftClickAction = db_get_dw(NULL, WEATHERPROTONAME, "LeftClickAction", IDM_M2);
- opt.RightClickAction = db_get_dw(NULL, WEATHERPROTONAME, "RightClickAction", IDM_M1);
+ opt.LeftClickAction = db_get_dw(0, WEATHERPROTONAME, "LeftClickAction", IDM_M2);
+ opt.RightClickAction = db_get_dw(0, WEATHERPROTONAME, "RightClickAction", IDM_M1);
// popup delay
- opt.pDelay = db_get_dw(NULL, WEATHERPROTONAME, "PopupDelay", 0);
+ opt.pDelay = db_get_dw(0, WEATHERPROTONAME, "PopupDelay", 0);
// popup texts
if (szValue = db_get_wsa(NULL, WEATHERPROTONAME, "PopupTitle"))
wSetData(&opt.pTitle, szValue);
@@ -200,55 +200,55 @@ void LoadOptions(void) void SaveOptions(void)
{
// main options
- db_set_b(NULL, WEATHERPROTONAME, "StartupUpdate", (BYTE)opt.StartupUpdate);
- db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)opt.AutoUpdate);
- db_set_w(NULL, WEATHERPROTONAME, "UpdateTime", opt.UpdateTime);
- db_set_b(NULL, WEATHERPROTONAME, "NoStatus", (BYTE)opt.NoProtoCondition);
- db_set_b(NULL, WEATHERPROTONAME, "CondChangeAsUpdate", (BYTE)opt.UpdateOnlyConditionChanged);
- db_set_b(NULL, WEATHERPROTONAME, "RemoveOld", (BYTE)opt.RemoveOldData);
- db_set_b(NULL, WEATHERPROTONAME, "MakeItalic", (BYTE)opt.MakeItalic);
- db_set_b(NULL, WEATHERPROTONAME, "AvatarSize", (BYTE)opt.AvatarSize);
+ 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);
// units
- db_set_w(NULL, WEATHERPROTONAME, "tUnit", opt.tUnit);
- db_set_w(NULL, WEATHERPROTONAME, "wUnit", opt.wUnit);
- db_set_w(NULL, WEATHERPROTONAME, "vUnit", opt.vUnit);
- db_set_w(NULL, WEATHERPROTONAME, "pUnit", opt.pUnit);
- db_set_w(NULL, WEATHERPROTONAME, "dUnit", opt.dUnit);
- db_set_w(NULL, WEATHERPROTONAME, "eUnit", opt.eUnit);
- db_set_ws(NULL, WEATHERPROTONAME, "DegreeSign", opt.DegreeSign);
- db_set_b(NULL, WEATHERPROTONAME, "DoNotAppendUnit", (BYTE)opt.DoNotAppendUnit);
- db_set_b(NULL, WEATHERPROTONAME, "NoFractions", (BYTE)opt.NoFrac);
+ 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);
// texts
- db_set_ws(NULL, WEATHERPROTONAME, "DisplayText", opt.cText);
- db_set_ws(NULL, WEATHERPROTONAME, "BriefTextTitle", opt.bTitle);
- db_set_ws(NULL, WEATHERPROTONAME, "BriefText", opt.bText);
- db_set_ws(NULL, WEATHERPROTONAME, "NoteText", opt.nText);
- db_set_ws(NULL, WEATHERPROTONAME, "ExtText", opt.eText);
- db_set_ws(NULL, WEATHERPROTONAME, "HistoryText", opt.hText);
- db_set_ws(NULL, WEATHERPROTONAME, "ExtraText", opt.xText);
- db_set_ws(NULL, WEATHERPROTONAME, "StatusText", opt.sText);
+ 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);
// advanced
- db_set_b(NULL, WEATHERPROTONAME, "DisableConditionIcon", (BYTE)opt.DisCondIcon);
+ db_set_b(0, WEATHERPROTONAME, "DisableConditionIcon", (BYTE)opt.DisCondIcon);
// popup options
- db_set_b(NULL, WEATHERPROTONAME, "UsePopUp", (BYTE)opt.UsePopup);
- db_set_b(NULL, WEATHERPROTONAME, "UpdatePopup", (BYTE)opt.UpdatePopup);
- db_set_b(NULL, WEATHERPROTONAME, "AlertPopup", (BYTE)opt.AlertPopup);
- db_set_b(NULL, WEATHERPROTONAME, "PopUpOnChange", (BYTE)opt.PopupOnChange);
- db_set_b(NULL, WEATHERPROTONAME, "ShowWarnings", (BYTE)opt.ShowWarnings);
+ 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);
// popup colors
- db_set_dw(NULL, WEATHERPROTONAME, "BackgroundColour", opt.BGColour);
- db_set_dw(NULL, WEATHERPROTONAME, "TextColour", opt.TextColour);
- db_set_b(NULL, WEATHERPROTONAME, "UseWinColors", (BYTE)opt.UseWinColors);
+ 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);
// popup actions
- db_set_dw(NULL, WEATHERPROTONAME, "LeftClickAction", opt.LeftClickAction);
- db_set_dw(NULL, WEATHERPROTONAME, "RightClickAction", opt.RightClickAction);
+ db_set_dw(0, WEATHERPROTONAME, "LeftClickAction", opt.LeftClickAction);
+ db_set_dw(0, WEATHERPROTONAME, "RightClickAction", opt.RightClickAction);
// popup delay
- db_set_dw(NULL, WEATHERPROTONAME, "PopupDelay", opt.pDelay);
+ db_set_dw(0, WEATHERPROTONAME, "PopupDelay", opt.pDelay);
// popup texts
- db_set_ws(NULL, WEATHERPROTONAME, "PopupTitle", opt.pTitle);
- db_set_ws(NULL, WEATHERPROTONAME, "PopupText", opt.pText);
+ db_set_ws(0, WEATHERPROTONAME, "PopupTitle", opt.pTitle);
+ db_set_ws(0, WEATHERPROTONAME, "PopupText", opt.pText);
// misc stuff
- db_set_ws(NULL, WEATHERPROTONAME, "Default", opt.Default);
+ db_set_ws(0, WEATHERPROTONAME, "Default", opt.Default);
}
//============ MAIN OPTIONS ============
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index dba0d5004f..64fc17b9a3 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -218,7 +218,7 @@ void UpdateMenu(BOOL State) {
// update option setting
opt.CAutoUpdate = State;
- db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)State);
+ db_set_b(0, WEATHERPROTONAME, "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(NULL, WEATHERPROTONAME, "UsePopup", (BYTE)opt.UsePopup);
+ db_set_b(0, WEATHERPROTONAME, "UsePopup", (BYTE)opt.UsePopup);
if (State) // to enable popup
Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Disable &weather notification"), GetIconHandle("popup"));
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 81c9da2ac1..cb743fe631 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -548,7 +548,7 @@ int GetWeatherData(MCONTACT hContact) db_set_ws(hContact, WEATHERCONDITION, "Heat Index", DataValue);
GetStationID(hContact, Svc, _countof(Svc));
if (!mir_wstrcmp(Svc, opt.Default))
- db_set_ws(NULL, DEFCURRENTWEATHER, _T2A(Item->Item.Name), DataValue);
+ db_set_ws(0, DEFCURRENTWEATHER, _T2A(Item->Item.Name), DataValue);
if (!mir_wstrcmp(Item->Item.Name, L"Condition")) {
wchar_t buf[128], *cbuf;
mir_snwprintf(buf, L"#%s Weather", DataValue);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 5c9c387e4d..61f54354bc 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -99,9 +99,9 @@ int CMPlugin::Load() hRichEd = LoadLibrary(L"Msftedit.dll");
/*TIMERS*/
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME) != 0)) {
- timerId = SetTimer(nullptr, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME)) * MINUTE), timerfunc);
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
+ if ((g_plugin.getDword(REFRESH_KEY, TIME) != 0)) {
+ timerId = SetTimer(nullptr, 0, ((g_plugin.getDword(REFRESH_KEY, TIME)) * MINUTE), timerfunc);
+ g_plugin.setDword(COUNTDOWN_KEY, 0);
Countdown = SetTimer(nullptr, 0, MINUTE, Countdownfunc);
}
@@ -124,13 +124,13 @@ int CMPlugin::Load() g_plugin.addSound("webviewalert", _A2W(MODULENAME), LPGENW("Alert event"));
//value is 1 if menu is disabled
- db_set_b(NULL, MODULENAME, MENU_IS_DISABLED_KEY, 1);
+ g_plugin.setByte(MENU_IS_DISABLED_KEY, 1);
CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
- if ( db_get_b(NULL, MODULENAME, MENU_OFF, 0)) {
+ if ( g_plugin.getByte(MENU_OFF, 0)) {
//value is 0 if menu is enabled
- db_set_b(NULL, MODULENAME, MENU_IS_DISABLED_KEY, 0);
+ g_plugin.setByte(MENU_IS_DISABLED_KEY, 0);
mi.root = g_plugin.addRootMenu(MO_MAIN, _A2W(MODULENAME), 20200001);
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "403BE07B-7954-4F3E-B318-4301571776B8");
@@ -139,7 +139,7 @@ int CMPlugin::Load() SET_UID(mi, 0xdedeb697, 0xfc10, 0x4622, 0x8b, 0x97, 0x74, 0x39, 0x32, 0x68, 0xa7, 0x7b);
CreateServiceFunction("DisableWebview", AutoUpdateMCmd);
mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
- if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
+ if (g_plugin.getByte(DISABLE_AUTOUPDATE_KEY, 0))
mi.name.w = LPGENW("Auto update disabled");
else
mi.name.w = LPGENW("Auto update enabled");
@@ -178,7 +178,7 @@ int CMPlugin::Load() CreateServiceFunction("Countdown", CountdownMenuCommand);
mi.flags |= CMIF_KEEPUNTRANSLATED;
wchar_t countername[100];
- mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_snwprintf(countername, TranslateT("%d minutes to update"), g_plugin.getDword(COUNTDOWN_KEY, 0));
mi.position = 600090099;
mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = countername;
@@ -246,7 +246,7 @@ int CMPlugin::Load() HookEvent(ME_DB_CONTACT_DELETED, SiteDeleted);
HookEvent(ME_OPT_INITIALISE, OptInitialise);
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1);
+ g_plugin.setByte(HAS_CRASHED_KEY, 1);
return 0;
}
@@ -259,7 +259,7 @@ int CMPlugin::Unload() KillTimer(nullptr, timerId);
KillTimer(nullptr, Countdown);
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
+ g_plugin.setByte(HAS_CRASHED_KEY, 0);
SavewinSettings();
if (hRichEd)
FreeLibrary(hRichEd);
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index f70712bc45..0edd6fa306 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -47,7 +47,7 @@ void ChangeMenuItem1() {
// Enable or Disable auto updates
LPCTSTR ptszName;
- if (!db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
+ if (!g_plugin.getByte(DISABLE_AUTOUPDATE_KEY, 0))
ptszName = LPGENW("Auto update enabled");
else
ptszName = LPGENW("Auto update disabled");
@@ -62,7 +62,7 @@ void ChangeMenuItemCountdown() HICON hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
wchar_t countername[100];
- mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_snwprintf(countername, TranslateT("%d minutes to update"), g_plugin.getDword(COUNTDOWN_KEY, 0));
Menu_ModifyItem(hMenuItemCountdown, countername, hIcon, CMIF_KEEPUNTRANSLATED);
}
@@ -114,7 +114,7 @@ void BGclrLoop() void StartUpdate(void*)
{
StartUpDelay = 1;
- Sleep(((db_get_dw(NULL, MODULENAME, START_DELAY_KEY, 0)) * SECOND));
+ Sleep(((g_plugin.getDword(START_DELAY_KEY, 0)) * SECOND));
for (auto &hContact : Contacts(MODULENAME))
GetData((void*)hContact);
@@ -145,8 +145,8 @@ INT_PTR MarkAllReadMenuCommand(WPARAM, LPARAM) /*****************************************************************************/
void InitialiseGlobals(void)
{
- Xposition = db_get_dw(NULL, MODULENAME, Xpos_WIN_KEY, 0);
- Yposition = db_get_dw(NULL, MODULENAME, Ypos_WIN_KEY, 0);
+ Xposition = g_plugin.getDword(Xpos_WIN_KEY, 0);
+ Yposition = g_plugin.getDword(Ypos_WIN_KEY, 0);
if (Yposition == -32000)
Yposition = 100;
@@ -154,11 +154,11 @@ void InitialiseGlobals(void) if (Xposition == -32000)
Xposition = 100;
- BackgoundClr = db_get_dw(NULL, MODULENAME, BG_COLOR_KEY, Def_color_bg);
- TextClr = db_get_dw(NULL, MODULENAME, TXT_COLOR_KEY, Def_color_txt);
+ BackgoundClr = g_plugin.getDword(BG_COLOR_KEY, Def_color_bg);
+ TextClr = g_plugin.getDword(TXT_COLOR_KEY, Def_color_txt);
- WindowHeight = db_get_dw(NULL, MODULENAME, WIN_HEIGHT_KEY, Def_win_height);
- WindowWidth = db_get_dw(NULL, MODULENAME, WIN_WIDTH_KEY, Def_win_width);
+ WindowHeight = g_plugin.getDword(WIN_HEIGHT_KEY, Def_win_height);
+ WindowWidth = g_plugin.getDword(WIN_WIDTH_KEY, Def_win_width);
}
/*****************************************************************************/
@@ -187,7 +187,7 @@ int Doubleclick(WPARAM wParam, LPARAM) HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
- if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ if (g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
@@ -200,7 +200,7 @@ int Doubleclick(WPARAM wParam, LPARAM) ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
- if (db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0)) {
+ if (g_plugin.getByte(UPDATE_ON_OPEN_KEY, 0)) {
if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0))
mir_forkthread(ReadFromFile, (void*)hContact);
else
@@ -227,28 +227,28 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb cfFM.cbSize = sizeof(CHARFORMAT2);
cfFM.dwMask = CFM_COLOR | CFM_CHARSET | CFM_FACE | ENM_LINK | ENM_MOUSEEVENTS | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_SIZE;
- if (db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0))
+ if (g_plugin.getByte(FONT_BOLD_KEY, 0))
bold = CFE_BOLD;
- if (db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0))
+ if (g_plugin.getByte(FONT_ITALIC_KEY, 0))
italic = CFE_ITALIC;
- if (db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0))
+ if (g_plugin.getByte(FONT_UNDERLINE_KEY, 0))
underline = CFE_UNDERLINE;
cfFM.dwEffects = bold | italic | underline;
- if (!db_get_ws(NULL, MODULENAME, FONT_FACE_KEY, &dbv)) {
+ if (!g_plugin.getWString(FONT_FACE_KEY, &dbv)) {
mir_wstrcpy(cfFM.szFaceName, dbv.pwszVal);
db_free(&dbv);
}
else mir_wstrcpy(cfFM.szFaceName, Def_font_face);
HDC hDC = GetDC(hWindow);
- cfFM.yHeight = (BYTE)MulDiv(abs(g_lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
+ cfFM.yHeight = (BYTE)MulDiv(abs(g_lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (g_plugin.getByte(FONT_SIZE_KEY, 14));
ReleaseDC(hWindow, hDC);
- cfFM.bCharSet = db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0);
+ cfFM.bCharSet = g_plugin.getByte(FONT_SCRIPT_KEY, 0);
cfFM.bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
cfFM.crTextColor = rgbText;
cfFM.crBackColor = rgbBack;
@@ -263,25 +263,25 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb /*****************************************************************************/
void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD)
{
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
+ g_plugin.setByte(HAS_CRASHED_KEY, 0);
- if (!(db_get_b(NULL, MODULENAME, OFFLINE_STATUS, 1)))
- if (!(db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)))
+ if (!(g_plugin.getByte(OFFLINE_STATUS, 1)))
+ if (!(g_plugin.getByte(DISABLE_AUTOUPDATE_KEY, 0)))
mir_forkthread(ContactLoop);
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
+ g_plugin.setDword(COUNTDOWN_KEY, 0);
}
/*****************************************************************************/
void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD)
{
- DWORD timetemp = db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 100);
+ DWORD timetemp = g_plugin.getDword(COUNTDOWN_KEY, 100);
if (timetemp <= 0) {
- timetemp = db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME);
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp);
+ timetemp = g_plugin.getDword(REFRESH_KEY, TIME);
+ g_plugin.setDword(COUNTDOWN_KEY, timetemp);
}
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp - 1);
+ g_plugin.setDword(COUNTDOWN_KEY, timetemp - 1);
ChangeMenuItemCountdown();
}
@@ -346,7 +346,7 @@ int ModulesLoaded(WPARAM, LPARAM) h_font = CreateFontIndirect(&g_lf);
// get data on startup
- if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
+ if (g_plugin.getByte(UPDATE_ONSTART_KEY, 0))
mir_forkthread(StartUpdate);
return 0;
@@ -365,7 +365,7 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
- if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ if (g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
@@ -377,7 +377,7 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
- if (db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0)) {
+ if (g_plugin.getByte(UPDATE_ON_OPEN_KEY, 0)) {
if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0))
mir_forkthread(ReadFromFile, (void*)hContact);
else
@@ -398,10 +398,10 @@ INT_PTR UpdateAllMenuCommand(WPARAM, LPARAM) /*****************************************************************************/
INT_PTR AutoUpdateMCmd(WPARAM, LPARAM)
{
- if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
- db_set_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0);
+ if (g_plugin.getByte(DISABLE_AUTOUPDATE_KEY, 0))
+ g_plugin.setByte(DISABLE_AUTOUPDATE_KEY, 0);
else
- db_set_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 1);
+ g_plugin.setByte(DISABLE_AUTOUPDATE_KEY, 1);
ChangeMenuItem1();
return 0;
@@ -410,7 +410,7 @@ INT_PTR AutoUpdateMCmd(WPARAM, LPARAM) /*****************************************************************************/
INT_PTR AddContactMenuCommand(WPARAM, LPARAM)
{
- db_set_s(NULL, "FindAdd", "LastSearched", MODULENAME);
+ db_set_s(0, "FindAdd", "LastSearched", MODULENAME);
CallService(MS_FINDADD_FINDADD, 0, 0);
return 0;
}
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index ad281c4b3c..56b7db8e0d 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -35,19 +35,19 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if (message == WM_COMMAND) { // left click
if(hContact != NULL) {
// open data window
- if ( db_get_b(NULL, MODULENAME, LCLK_WINDOW_KEY, 0)) {
+ if ( g_plugin.getByte(LCLK_WINDOW_KEY, 0)) {
NotifyEventHooks(hHookDisplayDataAlert, (int) hContact, 0);
mir_forkthread(GetData, (void*)hContact);
PUDeletePopup(hWnd);
}
// open url
- if (db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0)) {
+ if (g_plugin.getByte(LCLK_WEB_PGE_KEY, 0)) {
Utils_OpenUrlW(url);
PUDeletePopup(hWnd);
db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE);
}
// dismiss
- if (db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1))
+ if (g_plugin.getByte(LCLK_DISMISS_KEY, 1))
PUDeletePopup(hWnd);
}
else if (hContact == NULL)
@@ -56,19 +56,19 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) else if (message == WM_CONTEXTMENU) { // right click
if (hContact != NULL) {
// open datA window
- if (db_get_b(NULL, MODULENAME, RCLK_WINDOW_KEY, 0)) {
+ if (g_plugin.getByte(RCLK_WINDOW_KEY, 0)) {
NotifyEventHooks(hHookDisplayDataAlert, (int) hContact, 0);
mir_forkthread(GetData, (void*)hContact);
PUDeletePopup(hWnd);
}
// open url
- if (db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1)) {
+ if (g_plugin.getByte(RCLK_WEB_PGE_KEY, 1)) {
Utils_OpenUrlW(url);
PUDeletePopup(hWnd);
db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE);
}
// dismiss
- if ( db_get_b(NULL, MODULENAME, RCLK_DISMISS_KEY, 0))
+ if ( g_plugin.getByte(RCLK_DISMISS_KEY, 0))
PUDeletePopup(hWnd);
}
else if(hContact == NULL)
@@ -130,21 +130,21 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) else if (mir_wstrlen(displaytext) < MAX_SECONDLINE)
mir_snwprintf(ppd.lptzText, displaytext);
- if ( db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0)) {
- ppd.colorBack = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg);
- ppd.colorText = db_get_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, Def_color_txt);
+ if ( g_plugin.getByte(POP_USECUSTCLRS_KEY, 0)) {
+ ppd.colorBack = g_plugin.getDword(POP_BG_CLR_KEY, Def_color_bg);
+ ppd.colorText = g_plugin.getDword(POP_TXT_CLR_KEY, Def_color_txt);
}
- else if ( db_get_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, 0)) {
+ else if ( g_plugin.getByte(POP_USEWINCLRS_KEY, 0)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- else if ( db_get_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, 1)) {
+ else if ( g_plugin.getByte(POP_USESAMECLRS_KEY, 1)) {
ppd.colorBack = BackgoundClr;
ppd.colorText = TextClr;
}
ppd.PluginWindowProc = nullptr;
- ppd.iSeconds = db_get_dw(NULL, MODULENAME, POP_DELAY_KEY, 0);
+ ppd.iSeconds = g_plugin.getDword(POP_DELAY_KEY, 0);
if (ServiceExists(MS_POPUP_ADDPOPUPT))
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
@@ -183,15 +183,15 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) MCONTACT hContact = wParam;
wchar_t newdisplaytext[2000], *displaytext = (wchar_t*)lParam;
- if (db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0))
+ if (g_plugin.getByte(SUPPRESS_ERR_KEY, 0))
return 0;
wchar_t *ptszContactName = Clist_GetContactDisplayName(hContact);
- if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && g_plugin.getByte(ERROR_POPUP_KEY, 0)) {
mir_snwprintf(newdisplaytext, L"%s\n%s", ptszContactName, displaytext);
PUShowMessageT(newdisplaytext, SM_WARNING);
}
- else if ( ServiceExists("OSD/Announce") && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
+ else if ( ServiceExists("OSD/Announce") && g_plugin.getByte(ERROR_POPUP_KEY, 0)) {
mir_snwprintf(newdisplaytext, L"%s: %s", ptszContactName, TranslateW(displaytext));
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
}
@@ -766,7 +766,7 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM) HWND hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
- if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ if ( g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 4b70e7c2cb..ae30c5d20f 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -240,7 +240,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, _countof(partWidth), (LPARAM)partWidth);
SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_OWNERDRAW, 0);
- if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ if ( g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0))
Utils_RestoreWindowPosition(hwndDlg, hContact2, MODULENAME, "WV");
}
break;
@@ -476,13 +476,13 @@ void SavewinSettings(void) if (Xposition == -32000)
Xposition = 100;
- db_set_dw(NULL, MODULENAME, Xpos_WIN_KEY, Xposition);
- db_set_dw(NULL, MODULENAME, Ypos_WIN_KEY, Yposition);
+ g_plugin.setDword(Xpos_WIN_KEY, Xposition);
+ g_plugin.setDword(Ypos_WIN_KEY, Yposition);
- db_set_dw(NULL, MODULENAME, BG_COLOR_KEY, BackgoundClr);
- db_set_dw(NULL, MODULENAME, TXT_COLOR_KEY, TextClr);
- db_set_dw(NULL, MODULENAME, WIN_HEIGHT_KEY, WindowHeight);
- db_set_dw(NULL, MODULENAME, WIN_WIDTH_KEY, WindowWidth);
+ g_plugin.setDword(BG_COLOR_KEY, BackgoundClr);
+ g_plugin.setDword(TXT_COLOR_KEY, TextClr);
+ g_plugin.setDword(WIN_HEIGHT_KEY, WindowHeight);
+ g_plugin.setDword(WIN_WIDTH_KEY, WindowWidth);
}
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 3d8a3db19c..590f0d4fdc 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -84,7 +84,7 @@ void GetData(void *param) url[0] = '\0';
if (!Startingup)
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1);
+ g_plugin.setByte(HAS_CRASHED_KEY, 1);
if (!db_get_s(hContact, MODULENAME, START_STRING_KEY, &dbv)) {
strncpy_s(tempstring, _countof(tempstring), dbv.pszVal, _TRUNCATE);
@@ -119,7 +119,7 @@ void GetData(void *param) nlhr.headers = headers;
- if ( db_get_b(NULL, MODULENAME, NO_PROTECT_KEY, 0)) // disable
+ if ( g_plugin.getByte(NO_PROTECT_KEY, 0)) // disable
AlreadyDownloading = 0;
// //try site////
@@ -421,7 +421,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") //data in popup
if (TherewasAlert)
- if ( db_get_b(NULL, MODULENAME, DATA_POPUP_KEY, 0))
+ if ( g_plugin.getByte(DATA_POPUP_KEY, 0))
WAlertPopup(hContact, _A2T(truncated));
if (db_get_b(hContact, MODULENAME, STOP_KEY, 1) == 1)
@@ -472,7 +472,7 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") // update window if the update only on alert option isn't ticked or
// there was an alert or the update button was clicked
- if ((!(db_get_b(NULL, MODULENAME, UPDATE_ONALERT_KEY, 0))) || (TherewasAlert == 1) || (PosButnClick == 1)) {
+ if ((!(g_plugin.getByte(UPDATE_ONALERT_KEY, 0))) || (TherewasAlert == 1) || (PosButnClick == 1)) {
SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr);
if (TherewasAlert) {
@@ -483,8 +483,8 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") SendDlgItemMessage(hwndDlg, IDC_DATA, EM_EXSETSEL, 0, (LPARAM)&sel2);
SetFocus(GetDlgItem(hwndDlg, IDC_DATA));
- DWORD HiBackgoundClr = db_get_dw(NULL, MODULENAME, BG_COLOR_KEY, Def_color_bg);
- DWORD HiTextClr = db_get_dw(NULL, MODULENAME, TXT_COLOR_KEY, Def_color_txt);
+ DWORD HiBackgoundClr = g_plugin.getDword(BG_COLOR_KEY, Def_color_bg);
+ DWORD HiTextClr = g_plugin.getDword(TXT_COLOR_KEY, Def_color_txt);
CHARFORMAT2 Format;
memset(&Format, 0, sizeof(Format));
@@ -507,5 +507,5 @@ LBL_Stop: wchar_t *statusText = TranslateT("Processing data stopped by user.") EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE_BUTTON), 1);
if (!Startingup)
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
+ g_plugin.setByte(HAS_CRASHED_KEY, 0);
}
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index 27091fd65b..a6011d7074 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -102,36 +102,36 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- delay = db_get_dw(NULL, MODULENAME, POP_DELAY_KEY, 0);
+ delay = g_plugin.getDword(POP_DELAY_KEY, 0);
// setting popup delay option
_itoa(delay, str, 10);
SetDlgItemTextA(hdlg, IDC_DELAY, str);
- BGColour = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg);
- TextColour = db_get_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, Def_color_txt);
+ BGColour = g_plugin.getDword(POP_BG_CLR_KEY, Def_color_bg);
+ TextColour = g_plugin.getDword(POP_TXT_CLR_KEY, Def_color_txt);
// Colours. First step is configuring the colours.
SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_SETCOLOUR, 0, BGColour);
SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_SETCOLOUR, 0, TextColour);
// Second step is disabling them if we want to use default Windows
// ones.
- CheckDlgButton(hdlg, IDC_POP_USEWINCOLORS, db_get_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_POP_USESAMECOLORS, db_get_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_POP_USECUSTCOLORS, db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_POP_USEWINCOLORS, g_plugin.getByte(POP_USEWINCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_POP_USESAMECOLORS, g_plugin.getByte(POP_USESAMECLRS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_POP_USECUSTCOLORS, g_plugin.getByte(POP_USECUSTCLRS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS) || IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS)) {
EnableWindow(GetDlgItem(hdlg, IDC_POP_BGCOLOUR), 0);
EnableWindow(GetDlgItem(hdlg, IDC_POP_TEXTCOLOUR), 0);
}
- CheckDlgButton(hdlg, IDC_LCLK_WINDOW, db_get_b(NULL, MODULENAME, LCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_LCLK_WEB_PGE, db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_LCLK_DISMISS, db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_LCLK_WINDOW, g_plugin.getByte(LCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_LCLK_WEB_PGE, g_plugin.getByte(LCLK_WEB_PGE_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_LCLK_DISMISS, g_plugin.getByte(LCLK_DISMISS_KEY, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_RCLK_WINDOW, db_get_b(NULL, MODULENAME, RCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_RCLK_WEB_PGE, db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hdlg, IDC_RCLK_DISMISS, db_get_b(NULL, MODULENAME, RCLK_DISMISS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_RCLK_WINDOW, g_plugin.getByte(RCLK_WINDOW_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_RCLK_WEB_PGE, g_plugin.getByte(RCLK_WEB_PGE_KEY, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hdlg, IDC_RCLK_DISMISS, g_plugin.getByte(RCLK_DISMISS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
case WM_COMMAND:
@@ -224,25 +224,25 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) GetDlgItemText(hdlg, IDC_DELAY, str2, _countof(str2));
popupdelayval = _wtol(str2);
- db_set_dw(NULL, MODULENAME, POP_DELAY_KEY, popupdelayval);
+ g_plugin.setDword(POP_DELAY_KEY, popupdelayval);
- db_set_b(NULL, MODULENAME, LCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WINDOW));
- db_set_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WEB_PGE));
- db_set_b(NULL, MODULENAME, LCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_DISMISS));
+ g_plugin.setByte(LCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WINDOW));
+ g_plugin.setByte(LCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_WEB_PGE));
+ g_plugin.setByte(LCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_LCLK_DISMISS));
- db_set_b(NULL, MODULENAME, RCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WINDOW));
- db_set_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WEB_PGE));
- db_set_b(NULL, MODULENAME, RCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_DISMISS));
+ g_plugin.setByte(RCLK_WINDOW_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WINDOW));
+ g_plugin.setByte(RCLK_WEB_PGE_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_WEB_PGE));
+ g_plugin.setByte(RCLK_DISMISS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_RCLK_DISMISS));
- db_set_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS));
- db_set_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS));
- db_set_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS));
+ g_plugin.setByte(POP_USECUSTCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS));
+ g_plugin.setByte(POP_USEWINCLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USEWINCOLORS));
+ g_plugin.setByte(POP_USESAMECLRS_KEY, (BYTE)IsDlgButtonChecked(hdlg, IDC_POP_USESAMECOLORS));
BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0));
TextColour = (SendDlgItemMessage(hdlg, IDC_POP_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0));
- db_set_dw(NULL, MODULENAME, POP_BG_CLR_KEY, BGColour);
- db_set_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, TextColour);
+ g_plugin.setDword(POP_BG_CLR_KEY, BGColour);
+ g_plugin.setDword(POP_TXT_CLR_KEY, TextColour);
test = 0;
return TRUE;
@@ -1043,26 +1043,26 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(999, 0));
SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETRANGE, 0, MAKELONG(120, 0));
- SetDlgItemInt(hwndDlg, IDC_TIME, db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME), FALSE);
- SetDlgItemInt(hwndDlg, IDC_START_DELAY, db_get_w(NULL, MODULENAME, START_DELAY_KEY, 0), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_TIME, g_plugin.getDword(REFRESH_KEY, TIME), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_START_DELAY, g_plugin.getWord(START_DELAY_KEY, 0), FALSE);
mir_forkthread(FillFontListThread, hwndDlg);
- CheckDlgButton(hwndDlg, IDC_DISABLEMENU, db_get_b(NULL, MODULENAME, MENU_OFF, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SUPPRESS, db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_UPDATE_ONSTART, db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_UPDATE_ON_OPEN, db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDE_STATUS_ICON, db_get_b(NULL, MODULENAME, HIDE_STATUS_ICON_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_FONT_BOLD, db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_FONT_ITALIC, db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_FONT_UNDERLINE, db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ERROR_POPUP, db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_UPDATE_ONALERT, db_get_b(NULL, MODULENAME, UPDATE_ONALERT_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SAVE_INDIVID_POS, db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NO_PROTECT, db_get_b(NULL, MODULENAME, NO_PROTECT_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DATAPOPUP, db_get_b(NULL, MODULENAME, DATA_POPUP_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
-
- if (!db_get_ws(NULL, MODULENAME, FONT_FACE_KEY, &dbv)) {
+ CheckDlgButton(hwndDlg, IDC_DISABLEMENU, g_plugin.getByte(MENU_OFF, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SUPPRESS, g_plugin.getByte(SUPPRESS_ERR_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UPDATE_ONSTART, g_plugin.getByte(UPDATE_ONSTART_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UPDATE_ON_OPEN, g_plugin.getByte(UPDATE_ON_OPEN_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDE_STATUS_ICON, g_plugin.getByte(HIDE_STATUS_ICON_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FONT_BOLD, g_plugin.getByte(FONT_BOLD_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FONT_ITALIC, g_plugin.getByte(FONT_ITALIC_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FONT_UNDERLINE, g_plugin.getByte(FONT_UNDERLINE_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ERROR_POPUP, g_plugin.getByte(ERROR_POPUP_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UPDATE_ONALERT, g_plugin.getByte(UPDATE_ONALERT_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SAVE_INDIVID_POS, g_plugin.getByte(SAVE_INDIVID_POS_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_NO_PROTECT, g_plugin.getByte(NO_PROTECT_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DATAPOPUP, g_plugin.getByte(DATA_POPUP_KEY, 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ if (!g_plugin.getWString(FONT_FACE_KEY, &dbv)) {
SetDlgItemText(hwndDlg, IDC_TYPEFACE, dbv.pwszVal);
db_free(&dbv);
}
@@ -1073,7 +1073,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, wParam, 0);
- SetDlgItemInt(hwndDlg, IDC_FONTSIZE, db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_FONTSIZE, g_plugin.getByte(FONT_SIZE_KEY, 14), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_FIND_BUTTON), 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_BUTTON), 0);
@@ -1086,7 +1086,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara */
oldcolor = BackgoundClr;
- if (db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) {
+ if (g_plugin.getByte(SUPPRESS_ERR_KEY, 0)) {
CheckDlgButton(hwndDlg, IDC_SUPPRESS, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0);
}
@@ -1099,7 +1099,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara if (ServiceExists(MS_POPUP_ADDPOPUPT) == 0)
EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0);
- if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0)) {
+ if (g_plugin.getByte(UPDATE_ONSTART_KEY, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_START_DELAY), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_SPIN2), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_STARTDELAYTXT), 1);
@@ -1129,7 +1129,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontScriptsProc, (LPARAM)GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
ReleaseDC(hwndDlg, hdc);
for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
- if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == (BYTE)((db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0)))) {
+ if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == (BYTE)((g_plugin.getByte(FONT_SCRIPT_KEY, 0)))) {
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, i, 0);
break;
}
@@ -1146,7 +1146,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara switch (LOWORD(wParam)) {
case IDC_TXTCOLOR:
TextClr = SendDlgItemMessage(hwndDlg, IDC_TXTCOLOR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULENAME, TXT_COLOR_KEY, TextClr);
+ g_plugin.setDword(TXT_COLOR_KEY, TextClr);
if (HIWORD(wParam) == CPN_COLOURCHANGED) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
TxtclrLoop();
@@ -1155,7 +1155,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara case IDC_BGCOLOR:
BackgoundClr = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, MODULENAME, BG_COLOR_KEY, BackgoundClr);
+ g_plugin.setDword(BG_COLOR_KEY, BackgoundClr);
if (HIWORD(wParam) == CPN_COLOURCHANGED) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
BGclrLoop();
@@ -1213,46 +1213,46 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, MENU_OFF, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENU));
- db_set_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SUPPRESS));
- db_set_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPDATE_ONSTART));
- db_set_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPDATE_ON_OPEN));
- db_set_b(NULL, MODULENAME, HIDE_STATUS_ICON_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDE_STATUS_ICON));
- db_set_b(NULL, MODULENAME, FONT_BOLD_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FONT_BOLD));
- db_set_b(NULL, MODULENAME, FONT_ITALIC_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FONT_ITALIC));
- db_set_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FONT_UNDERLINE));
- db_set_b(NULL, MODULENAME, UPDATE_ONALERT_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPDATE_ONALERT));
- db_set_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVE_INDIVID_POS));
- db_set_b(NULL, MODULENAME, NO_PROTECT_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NO_PROTECT));
- db_set_b(NULL, MODULENAME, DATA_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DATAPOPUP));
+ g_plugin.setByte(MENU_OFF, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENU));
+ g_plugin.setByte(SUPPRESS_ERR_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SUPPRESS));
+ g_plugin.setByte(UPDATE_ONSTART_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPDATE_ONSTART));
+ g_plugin.setByte(UPDATE_ON_OPEN_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPDATE_ON_OPEN));
+ g_plugin.setByte(HIDE_STATUS_ICON_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDE_STATUS_ICON));
+ g_plugin.setByte(FONT_BOLD_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FONT_BOLD));
+ g_plugin.setByte(FONT_ITALIC_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FONT_ITALIC));
+ g_plugin.setByte(FONT_UNDERLINE_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FONT_UNDERLINE));
+ g_plugin.setByte(UPDATE_ONALERT_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPDATE_ONALERT));
+ g_plugin.setByte(SAVE_INDIVID_POS_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVE_INDIVID_POS));
+ g_plugin.setByte(NO_PROTECT_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NO_PROTECT));
+ g_plugin.setByte(DATA_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DATAPOPUP));
wchar_t str[100];
GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, _countof(str));
- db_set_ws(NULL, MODULENAME, FONT_FACE_KEY, str);
+ g_plugin.setWString(FONT_FACE_KEY, str);
- db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, nullptr, FALSE)));
- db_set_b(NULL, MODULENAME, FONT_SCRIPT_KEY, ((BYTE)SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0)));
+ g_plugin.setByte(FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, nullptr, FALSE)));
+ g_plugin.setByte(FONT_SCRIPT_KEY, ((BYTE)SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0)));
- db_set_b(NULL, MODULENAME, ERROR_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ERROR_POPUP));
+ g_plugin.setByte(ERROR_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ERROR_POPUP));
timerval = GetDlgItemInt(hwndDlg, IDC_TIME, nullptr, FALSE);
- db_set_dw(NULL, MODULENAME, REFRESH_KEY, timerval);
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timerval);
+ g_plugin.setDword(REFRESH_KEY, timerval);
+ g_plugin.setDword(COUNTDOWN_KEY, timerval);
delaytime = GetDlgItemInt(hwndDlg, IDC_START_DELAY, nullptr, FALSE);
- db_set_dw(NULL, MODULENAME, START_DELAY_KEY, delaytime);
+ g_plugin.setDword(START_DELAY_KEY, delaytime);
BackgoundClr = (SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0));
TextClr = (SendDlgItemMessage(hwndDlg, IDC_TXTCOLOR, CPM_GETCOLOUR, 0, 0));
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0)) {
+ if ((g_plugin.getDword(REFRESH_KEY, 0) != 0)) {
KillTimer(nullptr, timerId);
KillTimer(nullptr, Countdown);
- timerId = SetTimer(nullptr, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
+ timerId = SetTimer(nullptr, 0, ((g_plugin.getDword(REFRESH_KEY, 0)) * MINUTE), timerfunc);
Countdown = SetTimer(nullptr, 0, MINUTE, Countdownfunc);
}
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0)) {
+ if ((g_plugin.getDword(REFRESH_KEY, 0) == 0)) {
KillTimer(nullptr, timerId);
KillTimer(nullptr, Countdown);
}
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 229583a1e8..96d416ad40 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -202,7 +202,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM) case PFLAGNUM_1: return PF1_BASICSEARCH | PF1_ADDSEARCHRES | PF1_VISLIST; case PFLAGNUM_2: - return db_get_b(NULL, MODULENAME, HIDE_STATUS_ICON_KEY, 0) ? 0 : (PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND); + return g_plugin.getByte(HIDE_STATUS_ICON_KEY, 0) ? 0 : (PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND); case PFLAGNUM_3: return 0; case PFLAGNUM_4: @@ -247,14 +247,14 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM) ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, wParam); // Make sure no contact has offline status for any reason on first time run - if ( db_get_b(NULL, MODULENAME, "FirstTime", 100) == 100) { + if ( g_plugin.getByte("FirstTime", 100) == 100) { for (auto &hContact : Contacts(MODULENAME)) db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); - db_set_b(NULL, MODULENAME, "FirstTime", 1); + g_plugin.setByte("FirstTime", 1); } - db_set_b(NULL, MODULENAME, OFFLINE_STATUS, bpStatus == ID_STATUS_OFFLINE); + g_plugin.setByte(OFFLINE_STATUS, bpStatus == ID_STATUS_OFFLINE); return 0; } diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index e6916d60d9..85695e5345 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -347,35 +347,35 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara commonData.cDlgTimeout = wcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
- db_set_b(NULL, MODULENAME, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
- db_set_b(NULL, MODULENAME, "UsePopups", commonData.bUsePopups);
- db_set_b(NULL, MODULENAME, "UseDialog", commonData.bUseDialog);
- db_set_w(NULL, MODULENAME, "CheckInterval", commonData.checkInterval);
- db_set_w(NULL, MODULENAME, "DaysInAdvance", commonData.daysInAdvance);
- db_set_w(NULL, MODULENAME, "DaysAfter", commonData.daysAfter);
- db_set_w(NULL, MODULENAME, "PopupTimeout", commonData.popupTimeout);
- db_set_w(NULL, MODULENAME, "PopupTimeoutToday", commonData.popupTimeoutToday);
+ g_plugin.setByte("IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
+ g_plugin.setByte("UsePopups", commonData.bUsePopups);
+ g_plugin.setByte("UseDialog", commonData.bUseDialog);
+ g_plugin.setWord("CheckInterval", commonData.checkInterval);
+ g_plugin.setWord("DaysInAdvance", commonData.daysInAdvance);
+ g_plugin.setWord("DaysAfter", commonData.daysAfter);
+ g_plugin.setWord("PopupTimeout", commonData.popupTimeout);
+ g_plugin.setWord("PopupTimeoutToday", commonData.popupTimeoutToday);
- db_set_b(NULL, MODULENAME, "ShowCurrentAge", commonData.cShowAgeMode);
- db_set_b(NULL, MODULENAME, "NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
+ g_plugin.setByte("ShowCurrentAge", commonData.cShowAgeMode);
+ g_plugin.setByte("NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
- db_set_b(NULL, MODULENAME, "OpenInBackground", commonData.bOpenInBackground);
+ g_plugin.setByte("OpenInBackground", commonData.bOpenInBackground);
- db_set_b(NULL, MODULENAME, "SoundNearDays", commonData.cSoundNearDays);
+ g_plugin.setByte("SoundNearDays", commonData.cSoundNearDays);
- db_set_b(NULL, MODULENAME, "DefaultModule", commonData.cDefaultModule);
+ g_plugin.setByte("DefaultModule", commonData.cDefaultModule);
- db_set_b(NULL, MODULENAME, "PopupLeftClick", commonData.lPopupClick);
- db_set_b(NULL, MODULENAME, "PopupRightClick", commonData.rPopupClick);
+ g_plugin.setByte("PopupLeftClick", commonData.lPopupClick);
+ g_plugin.setByte("PopupRightClick", commonData.rPopupClick);
- db_set_dw(NULL, MODULENAME, "Foreground", commonData.foreground);
- db_set_dw(NULL, MODULENAME, "Background", commonData.background);
+ g_plugin.setDword("Foreground", commonData.foreground);
+ g_plugin.setDword("Background", commonData.background);
- db_set_b(NULL, MODULENAME, "OncePerDay", commonData.bOncePerDay);
+ g_plugin.setByte("OncePerDay", commonData.bOncePerDay);
- db_set_w(NULL, MODULENAME, "DlgTimeout", commonData.cDlgTimeout);
+ g_plugin.setWord("DlgTimeout", commonData.cDlgTimeout);
- db_set_b(NULL, MODULENAME, "NotifyFor", commonData.notifyFor);
+ g_plugin.setByte("NotifyFor", commonData.notifyFor);
RefreshAllContactListIcons();
@@ -746,7 +746,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa ListView_InsertColumn(hList, 5, &col);
LoadBirthdays(hWnd, 0);
- int column = db_get_b(NULL, MODULENAME, "SortColumn", 0);
+ int column = g_plugin.getByte("SortColumn", 0);
BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
@@ -818,7 +818,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case LVN_COLUMNCLICK:
LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
int column = lv->iSubItem;
- db_set_b(NULL, MODULENAME, "SortColumn", column);
+ g_plugin.setByte("SortColumn", column);
BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
params.column = column;
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index 7320a42530..443794d9bd 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -141,7 +141,7 @@ int RefreshContactListIcons(MCONTACT hContact) int UpdateTimers()
{
- UINT interval = db_get_dw(NULL, MODULENAME, "Interval", CHECK_INTERVAL);
+ UINT interval = g_plugin.getDword("Interval", CHECK_INTERVAL);
interval *= (1000 * 60 * 60); //go from miliseconds to hours
hCheckTimer = SetTimer(nullptr, 0, interval, OnCheckTimer);
if (!hDateChangeTimer)
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 38319dc597..b0dfe5c516 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -29,26 +29,26 @@ int InitServices() {
Log("%s", "Entering function " __FUNCTION__);
- commonData.foreground = db_get_dw(NULL, MODULENAME, "Foreground", FOREGROUND_COLOR);
- commonData.background = db_get_dw(NULL, MODULENAME, "Background", BACKGROUND_COLOR);
- commonData.checkInterval = db_get_w(NULL, MODULENAME, "CheckInterval", CHECK_INTERVAL);
- commonData.daysInAdvance = db_get_w(NULL, MODULENAME, "DaysInAdvance", DAYS_TO_NOTIFY);
- commonData.daysAfter = db_get_w(NULL, MODULENAME, "DaysAfter", DAYS_TO_NOTIFY_AFTER);
- commonData.popupTimeout = db_get_w(NULL, MODULENAME, "PopupTimeout", POPUP_TIMEOUT);
- commonData.popupTimeoutToday = db_get_w(NULL, MODULENAME, "PopupTimeoutToday", commonData.popupTimeout);
- commonData.bUsePopups = db_get_b(NULL, MODULENAME, "UsePopups", TRUE);
- commonData.bUseDialog = db_get_b(NULL, MODULENAME, "UseDialog", TRUE);
- commonData.bIgnoreSubcontacts = db_get_b(NULL, MODULENAME, "IgnoreSubcontacts", FALSE);
- commonData.cShowAgeMode = db_get_b(NULL, MODULENAME, "ShowCurrentAge", FALSE);
- commonData.bNoBirthdaysPopup = db_get_b(NULL, MODULENAME, "NoBirthdaysPopup", FALSE);
- commonData.bOpenInBackground = db_get_b(NULL, MODULENAME, "OpenInBackground", FALSE);
- commonData.cSoundNearDays = db_get_b(NULL, MODULENAME, "SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
- commonData.cDefaultModule = db_get_b(NULL, MODULENAME, "DefaultModule", 0);
- commonData.lPopupClick = db_get_b(NULL, MODULENAME, "PopupLeftClick", 2);
- commonData.rPopupClick = db_get_b(NULL, MODULENAME, "PopupRightClick", 1);
- commonData.bOncePerDay = db_get_b(NULL, MODULENAME, "OncePerDay", 0);
- commonData.cDlgTimeout = db_get_w(NULL, MODULENAME, "DlgTimeout", POPUP_TIMEOUT);
- commonData.notifyFor = db_get_b(NULL, MODULENAME, "NotifyFor", 0);
+ commonData.foreground = g_plugin.getDword("Foreground", FOREGROUND_COLOR);
+ commonData.background = g_plugin.getDword("Background", BACKGROUND_COLOR);
+ commonData.checkInterval = g_plugin.getWord("CheckInterval", CHECK_INTERVAL);
+ commonData.daysInAdvance = g_plugin.getWord("DaysInAdvance", DAYS_TO_NOTIFY);
+ commonData.daysAfter = g_plugin.getWord("DaysAfter", DAYS_TO_NOTIFY_AFTER);
+ commonData.popupTimeout = g_plugin.getWord("PopupTimeout", POPUP_TIMEOUT);
+ commonData.popupTimeoutToday = g_plugin.getWord("PopupTimeoutToday", commonData.popupTimeout);
+ commonData.bUsePopups = g_plugin.getByte("UsePopups", TRUE);
+ commonData.bUseDialog = g_plugin.getByte("UseDialog", TRUE);
+ commonData.bIgnoreSubcontacts = g_plugin.getByte("IgnoreSubcontacts", FALSE);
+ commonData.cShowAgeMode = g_plugin.getByte("ShowCurrentAge", FALSE);
+ commonData.bNoBirthdaysPopup = g_plugin.getByte("NoBirthdaysPopup", FALSE);
+ commonData.bOpenInBackground = g_plugin.getByte("OpenInBackground", FALSE);
+ commonData.cSoundNearDays = g_plugin.getByte("SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
+ commonData.cDefaultModule = g_plugin.getByte("DefaultModule", 0);
+ commonData.lPopupClick = g_plugin.getByte("PopupLeftClick", 2);
+ commonData.rPopupClick = g_plugin.getByte("PopupRightClick", 1);
+ commonData.bOncePerDay = g_plugin.getByte("OncePerDay", 0);
+ commonData.cDlgTimeout = g_plugin.getWord("DlgTimeout", POPUP_TIMEOUT);
+ commonData.notifyFor = g_plugin.getByte("NotifyFor", 0);
CreateServiceFunction(MS_WWI_CHECK_BIRTHDAYS, CheckBirthdaysService);
CreateServiceFunction(MS_WWI_LIST_SHOW, ShowListService);
@@ -104,7 +104,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam) SYSTEMTIME today;
GetLocalTime(&today);
- DWORD lastChecked = db_get_dw(NULL, MODULENAME, "LastChecked", 0); //get last checked date
+ DWORD lastChecked = g_plugin.getDword("LastChecked", 0); //get last checked date
int lcDay = LOBYTE(LOWORD(lastChecked));
int lcMonth = HIBYTE(LOWORD(lastChecked));
int lcYear = HIWORD(lastChecked);
@@ -131,7 +131,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam) commonData.daysAfter = savedDaysAfter; //restore previous value
if (lParam) //if not forced - i.e. timer check
- db_set_dw(NULL, MODULENAME, "LastChecked", MAKELONG(MAKEWORD(today.wDay, today.wMonth), today.wYear)); //write the value in DB so we don't check again today
+ g_plugin.setDword("LastChecked", MAKELONG(MAKEWORD(today.wDay, today.wMonth), today.wYear)); //write the value in DB so we don't check again today
return 0;
}
@@ -170,7 +170,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*) Thread_SetName("WhenWasIt: RefreshUserDetailsWorkerThread");
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hRefreshUserDetails);
- int delay = db_get_w(NULL, MODULENAME, "UpdateDelay", REFRESH_DETAILS_DELAY);
+ int delay = g_plugin.getWord("UpdateDelay", REFRESH_DETAILS_DELAY);
MCONTACT hContact = db_find_first();
while (hContact != NULL) {
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 2b058289c4..4b6240ae69 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -135,7 +135,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size)
{
- return GetStringFromDatabase(NULL, MODULENAME, szSettingName, szError, szResult, size);
+ return GetStringFromDatabase(0, MODULENAME, szSettingName, szError, szResult, size);
}
wchar_t* GetContactID(MCONTACT hContact)
diff --git a/plugins/WhoUsesMyFiles/src/options.cpp b/plugins/WhoUsesMyFiles/src/options.cpp index a552d7cb6e..60f1e941d0 100644 --- a/plugins/WhoUsesMyFiles/src/options.cpp +++ b/plugins/WhoUsesMyFiles/src/options.cpp @@ -241,24 +241,24 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara return TRUE; case PSN_APPLY: - db_set_dw(NULL, MODULENAME, COLOR_TEXT, (DWORD)WumfOptions.ColorText); - db_set_dw(NULL, MODULENAME, COLOR_BACK, (DWORD)WumfOptions.ColorBack); - db_set_b(NULL, MODULENAME, COLOR_DEF, (BYTE)WumfOptions.UseDefColor); - db_set_b(NULL, MODULENAME, COLOR_WIN, (BYTE)WumfOptions.UseWinColor); - db_set_b(NULL, MODULENAME, COLOR_SET, (BYTE)WumfOptions.SelectColor ); - db_set_b(NULL, MODULENAME, DELAY_DEF, (BYTE)WumfOptions.DelayDef); - db_set_b(NULL, MODULENAME, DELAY_INF, (BYTE)WumfOptions.DelayInf); - db_set_b(NULL, MODULENAME, DELAY_SET, (BYTE)WumfOptions.DelaySet); - db_set_b(NULL, MODULENAME, DELAY_SEC, (BYTE)WumfOptions.DelaySec); - db_set_b(NULL, MODULENAME, LOG_INTO_FILE, (BYTE)WumfOptions.LogToFile); - db_set_b(NULL, MODULENAME, LOG_FOLDER, (BYTE)WumfOptions.LogFolders); - db_set_b(NULL, MODULENAME, ALERT_FOLDER, (BYTE)WumfOptions.AlertFolders); - db_set_b(NULL, MODULENAME, LOG_UNC, (BYTE)WumfOptions.LogUNC); - db_set_b(NULL, MODULENAME, ALERT_UNC, (BYTE)WumfOptions.AlertUNC); - db_set_b(NULL, MODULENAME, LOG_COMP, (BYTE)WumfOptions.LogComp); - db_set_b(NULL, MODULENAME, ALERT_COMP, (BYTE)WumfOptions.AlertComp); + g_plugin.setDword(COLOR_TEXT, (DWORD)WumfOptions.ColorText); + g_plugin.setDword(COLOR_BACK, (DWORD)WumfOptions.ColorBack); + g_plugin.setByte(COLOR_DEF, (BYTE)WumfOptions.UseDefColor); + g_plugin.setByte(COLOR_WIN, (BYTE)WumfOptions.UseWinColor); + g_plugin.setByte(COLOR_SET, (BYTE)WumfOptions.SelectColor ); + g_plugin.setByte(DELAY_DEF, (BYTE)WumfOptions.DelayDef); + g_plugin.setByte(DELAY_INF, (BYTE)WumfOptions.DelayInf); + g_plugin.setByte(DELAY_SET, (BYTE)WumfOptions.DelaySet); + g_plugin.setByte(DELAY_SEC, (BYTE)WumfOptions.DelaySec); + g_plugin.setByte(LOG_INTO_FILE, (BYTE)WumfOptions.LogToFile); + g_plugin.setByte(LOG_FOLDER, (BYTE)WumfOptions.LogFolders); + g_plugin.setByte(ALERT_FOLDER, (BYTE)WumfOptions.AlertFolders); + g_plugin.setByte(LOG_UNC, (BYTE)WumfOptions.LogUNC); + g_plugin.setByte(ALERT_UNC, (BYTE)WumfOptions.AlertUNC); + g_plugin.setByte(LOG_COMP, (BYTE)WumfOptions.LogComp); + g_plugin.setByte(ALERT_COMP, (BYTE)WumfOptions.AlertComp); GetDlgItemText(hwndDlg, IDC_FILE, WumfOptions.LogFile, _countof(WumfOptions.LogFile)); - db_set_ws(NULL, MODULENAME, OPT_FILE, WumfOptions.LogFile); + g_plugin.setWString(OPT_FILE, WumfOptions.LogFile); } } break; diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index e2876ae1c7..26ff252798 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -35,38 +35,38 @@ void LoadOptions() DBVARIANT dbv = { 0 };
dbv.type = DBVT_WCHAR;
memset(&WumfOptions, 0, sizeof(WumfOptions));
- if (db_get_ws(NULL, MODULENAME, OPT_FILE, &dbv) == 0) {
+ if (g_plugin.getWString(OPT_FILE, &dbv) == 0) {
wcsncpy(WumfOptions.LogFile, dbv.pwszVal, 255);
db_free(&dbv);
}
else
WumfOptions.LogFile[0] = '\0';
- WumfOptions.PopupsEnabled = db_get_b(NULL, MODULENAME, POPUPS_ENABLED, TRUE);
+ WumfOptions.PopupsEnabled = g_plugin.getByte(POPUPS_ENABLED, TRUE);
- WumfOptions.UseDefColor = db_get_b(NULL, MODULENAME, COLOR_DEF, TRUE);
- WumfOptions.UseWinColor = db_get_b(NULL, MODULENAME, COLOR_WIN, FALSE);
- WumfOptions.SelectColor = db_get_b(NULL, MODULENAME, COLOR_SET, FALSE);
+ WumfOptions.UseDefColor = g_plugin.getByte(COLOR_DEF, TRUE);
+ WumfOptions.UseWinColor = g_plugin.getByte(COLOR_WIN, FALSE);
+ WumfOptions.SelectColor = g_plugin.getByte(COLOR_SET, FALSE);
- WumfOptions.ColorText = db_get_dw(NULL, MODULENAME, COLOR_TEXT, RGB(0, 0, 0));
- WumfOptions.ColorBack = db_get_dw(NULL, MODULENAME, COLOR_BACK, RGB(255, 255, 255));
+ WumfOptions.ColorText = g_plugin.getDword(COLOR_TEXT, RGB(0, 0, 0));
+ WumfOptions.ColorBack = g_plugin.getDword(COLOR_BACK, RGB(255, 255, 255));
- WumfOptions.DelayDef = db_get_b(NULL, MODULENAME, DELAY_DEF, TRUE);
- WumfOptions.DelayInf = db_get_b(NULL, MODULENAME, DELAY_INF, FALSE);
- WumfOptions.DelaySet = db_get_b(NULL, MODULENAME, DELAY_SET, FALSE);
- WumfOptions.DelaySec = db_get_b(NULL, MODULENAME, DELAY_SEC, 0);
+ WumfOptions.DelayDef = g_plugin.getByte(DELAY_DEF, TRUE);
+ WumfOptions.DelayInf = g_plugin.getByte(DELAY_INF, FALSE);
+ WumfOptions.DelaySet = g_plugin.getByte(DELAY_SET, FALSE);
+ WumfOptions.DelaySec = g_plugin.getByte(DELAY_SEC, 0);
if (!ServiceExists(MS_POPUP_ADDPOPUPT)) {
WumfOptions.DelayDef = TRUE;
WumfOptions.DelaySet = FALSE;
WumfOptions.DelayInf = FALSE;
}
- WumfOptions.LogToFile = db_get_b(NULL, MODULENAME, LOG_INTO_FILE, FALSE);
- WumfOptions.LogFolders = db_get_b(NULL, MODULENAME, LOG_FOLDER, TRUE);
- WumfOptions.AlertFolders = db_get_b(NULL, MODULENAME, ALERT_FOLDER, TRUE);
- WumfOptions.LogUNC = db_get_b(NULL, MODULENAME, LOG_UNC, FALSE);
- WumfOptions.AlertUNC = db_get_b(NULL, MODULENAME, ALERT_UNC, FALSE);
- WumfOptions.LogComp = db_get_b(NULL, MODULENAME, LOG_COMP, FALSE);
- WumfOptions.AlertComp = db_get_b(NULL, MODULENAME, ALERT_COMP, FALSE);
+ WumfOptions.LogToFile = g_plugin.getByte(LOG_INTO_FILE, FALSE);
+ WumfOptions.LogFolders = g_plugin.getByte(LOG_FOLDER, TRUE);
+ WumfOptions.AlertFolders = g_plugin.getByte(ALERT_FOLDER, TRUE);
+ WumfOptions.LogUNC = g_plugin.getByte(LOG_UNC, FALSE);
+ WumfOptions.AlertUNC = g_plugin.getByte(ALERT_UNC, FALSE);
+ WumfOptions.LogComp = g_plugin.getByte(LOG_COMP, FALSE);
+ WumfOptions.AlertComp = g_plugin.getByte(ALERT_COMP, FALSE);
}
void ExecuteMenu(HWND hWnd)
@@ -199,7 +199,7 @@ static INT_PTR WumfMenuCommand(WPARAM, LPARAM) Menu_ModifyItem(hMenuItem, LPGENW("Disable WUMF popups"), LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_POPUP)));
}
- db_set_b(NULL, MODULENAME, POPUPS_ENABLED, (BYTE)WumfOptions.PopupsEnabled);
+ g_plugin.setByte(POPUPS_ENABLED, (BYTE)WumfOptions.PopupsEnabled);
return 0;
}
diff --git a/plugins/WinterSpeak/src/AnnounceDatabase.cpp b/plugins/WinterSpeak/src/AnnounceDatabase.cpp index 2aebf7cb9b..de701214d8 100644 --- a/plugins/WinterSpeak/src/AnnounceDatabase.cpp +++ b/plugins/WinterSpeak/src/AnnounceDatabase.cpp @@ -65,18 +65,18 @@ void AnnounceDatabase::setEventFlag(EventFlag flag, bool state) //------------------------------------------------------------------------------
void AnnounceDatabase::load()
{
- m_status_flags = db_get_dw(NULL, SPEAK, STATUS_FLAGS, 0xffff);
- m_event_flags = db_get_dw(NULL, SPEAK, EVENT_FLAGS, 0xffff);
- m_max_msg = db_get_dw(NULL, SPEAK, MAX_MSG_SIZE, 50);
+ m_status_flags = db_get_dw(0, SPEAK, STATUS_FLAGS, 0xffff);
+ m_event_flags = db_get_dw(0, SPEAK, EVENT_FLAGS, 0xffff);
+ m_max_msg = db_get_dw(0, SPEAK, MAX_MSG_SIZE, 50);
}
//------------------------------------------------------------------------------
void
AnnounceDatabase::save()
{
- db_set_dw(NULL, SPEAK, STATUS_FLAGS, m_status_flags);
- db_set_dw(NULL, SPEAK, EVENT_FLAGS, m_event_flags);
- db_set_dw(NULL, SPEAK, MAX_MSG_SIZE, m_max_msg);
+ db_set_dw(0, SPEAK, STATUS_FLAGS, m_status_flags);
+ db_set_dw(0, SPEAK, EVENT_FLAGS, m_event_flags);
+ db_set_dw(0, SPEAK, MAX_MSG_SIZE, m_max_msg);
}
//==============================================================================
diff --git a/plugins/WinterSpeak/src/ConfigDatabase.cpp b/plugins/WinterSpeak/src/ConfigDatabase.cpp index d7b643c18c..06f595b43c 100644 --- a/plugins/WinterSpeak/src/ConfigDatabase.cpp +++ b/plugins/WinterSpeak/src/ConfigDatabase.cpp @@ -80,11 +80,11 @@ void ConfigDatabase::load() {
m_voice_desc.engine = DBGetContactSettingString(SPEAK, ENGINE, L"");
m_voice_desc.voice = DBGetContactSettingString(SPEAK, VOICE, L"");
- m_voice_desc.volume = db_get_dw(NULL, SPEAK, VOLUME, 50);
- m_voice_desc.pitch = db_get_dw(NULL, SPEAK, PITCH, 50);
- m_voice_desc.rate = db_get_dw(NULL, SPEAK, RATE, 50);
+ m_voice_desc.volume = db_get_dw(0, SPEAK, VOLUME, 50);
+ m_voice_desc.pitch = db_get_dw(0, SPEAK, PITCH, 50);
+ m_voice_desc.rate = db_get_dw(0, SPEAK, RATE, 50);
- m_active_flags = db_get_dw(NULL, SPEAK, ACTIVE_FLAGS, 0xffff);
+ m_active_flags = db_get_dw(0, SPEAK, ACTIVE_FLAGS, 0xffff);
m_welcome_msg = DBGetContactSettingString(SPEAK, WELCOME_MSG, L"Welcome to Miranda");
@@ -95,22 +95,22 @@ void ConfigDatabase::load() }
// load unknown users setting
- m_active_users[0].status = (db_get_b(NULL, SPEAK, ACTIVE_STATE, true) != 0);
- m_active_users[0].message = (db_get_b(NULL, SPEAK, ACTIVE_MSG, true) != 0);
+ m_active_users[0].status = (db_get_b(0, SPEAK, ACTIVE_STATE, true) != 0);
+ m_active_users[0].message = (db_get_b(0, SPEAK, ACTIVE_MSG, true) != 0);
}
//------------------------------------------------------------------------------
void ConfigDatabase::save()
{
- db_set_ws(NULL, SPEAK, ENGINE, m_voice_desc.engine.c_str());
- db_set_ws(NULL, SPEAK, VOICE, m_voice_desc.voice.c_str());
- db_set_dw(NULL, SPEAK, VOLUME, m_voice_desc.volume);
- db_set_dw(NULL, SPEAK, PITCH, m_voice_desc.pitch);
- db_set_dw(NULL, SPEAK, RATE, m_voice_desc.rate);
+ db_set_ws(0, SPEAK, ENGINE, m_voice_desc.engine.c_str());
+ db_set_ws(0, SPEAK, VOICE, m_voice_desc.voice.c_str());
+ db_set_dw(0, SPEAK, VOLUME, m_voice_desc.volume);
+ db_set_dw(0, SPEAK, PITCH, m_voice_desc.pitch);
+ db_set_dw(0, SPEAK, RATE, m_voice_desc.rate);
- db_set_dw(NULL, SPEAK, ACTIVE_FLAGS, m_active_flags);
+ db_set_dw(0, SPEAK, ACTIVE_FLAGS, m_active_flags);
- db_set_ws(NULL, SPEAK, WELCOME_MSG, m_welcome_msg.c_str());
+ db_set_ws(0, SPEAK, WELCOME_MSG, m_welcome_msg.c_str());
for (ActiveUsersMap::iterator i = m_active_users.begin(); i != m_active_users.end(); ++i)
{
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index bbbad8fe54..da6828ce61 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -97,7 +97,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (!cursel) {
PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
DBVARIANT dbv = { 0 };
- if (!db_get_ws(NULL, MODULENAME, pa->szModuleName, &dbv)) {
+ if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(dbv.pwszVal));
@@ -111,7 +111,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l size_t value_max_len = mir_strlen(pa->szModuleName) + 8;
char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
mir_snprintf(value, value_max_len, "%s_ignore", pa->szModuleName);
- CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, db_get_b(NULL, MODULENAME, value, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, g_plugin.getByte(value, 0) ? BST_CHECKED : BST_UNCHECKED);
mir_free(value);
}
else {
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l isIgnoreSound = 0;
if (p == nullptr) {
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, pa->szModuleName, &dbv)) {
+ if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
wchar_t longpath[MAX_PATH];
PathToAbsoluteW(dbv.pwszVal, longpath);
Skin_PlaySoundFile(longpath);
@@ -250,11 +250,11 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l delete p;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- db_unset(NULL, MODULENAME, pa->szModuleName);
+ g_plugin.delSetting(pa->szModuleName);
size_t value_max_len = mir_strlen(pa->szModuleName) + 8;
char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
mir_snprintf(value, value_max_len, "%s_ignore", pa->szModuleName);
- db_unset(NULL, MODULENAME, value);
+ g_plugin.delSetting(value);
mir_free(value);
}
else {
@@ -279,7 +279,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
if (p == nullptr) {
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, pa->szModuleName, &dbv)) {
+ if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
wchar_t longpath[MAX_PATH];
PathToAbsoluteW(dbv.pwszVal, longpath);
XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
@@ -322,7 +322,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (it->iscontact)
db_set_ws(it->hContact, MODULENAME, SETTINGSKEY, shortpath);
else
- db_set_ws(NULL, MODULENAME, (LPCSTR)it->hContact, shortpath);
+ g_plugin.setWString((LPCSTR)it->hContact, shortpath);
}
if (it->iscontact)
db_set_b(it->hContact, MODULENAME, SETTINGSIGNOREKEY, it->ignore);
@@ -330,7 +330,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l size_t value_max_len = mir_strlen((const char*)it->hContact) + 8;
char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
mir_snprintf(value, value_max_len, "%s_ignore", (const char*)it->hContact);
- db_set_b(NULL, MODULENAME, value, it->ignore);
+ g_plugin.setByte(value, it->ignore);
mir_free(value);
}
}
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index c29a1ea852..1991619bd8 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -121,9 +121,9 @@ static int ProcessEvent(WPARAM hContact, LPARAM lParam) size_t value_max_len = mir_strlen(pa->szModuleName) + 8;
char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
mir_snprintf(value, value_max_len, "%s_ignore", pa->szModuleName);
- isIgnoreAccSound = db_get_b(NULL, MODULENAME, value, 0);
+ isIgnoreAccSound = g_plugin.getByte(value, 0);
mir_free(value);
- if (!isIgnoreAccSound && !db_get_ws(NULL, MODULENAME, pa->szModuleName, &dbv)) {
+ if (!isIgnoreAccSound && !g_plugin.getWString(pa->szModuleName, &dbv)) {
wchar_t PlaySoundPath[MAX_PATH] = { 0 };
PathToAbsoluteW(dbv.pwszVal, PlaySoundPath);
isAccSound = 0;
@@ -165,9 +165,9 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam) size_t value_max_len = mir_strlen(pa->szModuleName) + 8;
char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
mir_snprintf(value, value_max_len, "%s_ignore", pa->szModuleName);
- isIgnoreAccSound = db_get_b(NULL, MODULENAME, value, 0);
+ isIgnoreAccSound = g_plugin.getByte(value, 0);
mir_free(value);
- if (!isIgnoreAccSound && !db_get_ws(NULL, MODULENAME, pa->szModuleName, &dbv)) {
+ if (!isIgnoreAccSound && !g_plugin.getWString(pa->szModuleName, &dbv)) {
wchar_t PlaySoundPath[MAX_PATH] = { 0 };
PathToAbsoluteW(dbv.pwszVal, PlaySoundPath);
isAccSound = 0;
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index d3b093e8d9..654f529e31 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1719,10 +1719,10 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR SizeX = coord.right - coord.left; PosY = coord.top; SizeY = coord.bottom - coord.top; - db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, PosX); - db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSY, PosY); - db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, SizeX); - db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, SizeY); + db_set_dw(0, YAMN_DBMODULE, YAMN_DBPOSX, PosX); + db_set_dw(0, YAMN_DBMODULE, YAMN_DBPOSY, PosY); + db_set_dw(0, YAMN_DBMODULE, YAMN_DBSIZEX, SizeX); + db_set_dw(0, YAMN_DBMODULE, YAMN_DBSIZEY, SizeY); } KillTimer(hDlg, TIMER_FLASHING); @@ -2047,7 +2047,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR } } CloseHandle(ThreadRunningEV); - if (db_get_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0)) + if (db_get_b(0, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0)) DestroyWindow(hDlg); } break; diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index f40bc54a1e..db6fb2039c 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -116,7 +116,7 @@ BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr) void CheckMenuItems() { - Menu_ShowItem(hMenuItemMain, db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1) != 0); + Menu_ShowItem(hMenuItemMain, db_get_b(0, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1) != 0); } int SystemModulesLoaded(WPARAM, LPARAM) @@ -264,18 +264,18 @@ int CMPlugin::Load() if (nullptr == (ExitEV = CreateEvent(nullptr, TRUE, FALSE, nullptr))) return 1; - PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0); - PosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0); - SizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800); - SizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200); + PosX = db_get_dw(0, YAMN_DBMODULE, YAMN_DBPOSX, 0); + PosY = db_get_dw(0, YAMN_DBMODULE, YAMN_DBPOSY, 0); + SizeX = db_get_dw(0, YAMN_DBMODULE, YAMN_DBSIZEX, 800); + SizeY = db_get_dw(0, YAMN_DBMODULE, YAMN_DBSIZEY, 200); - HeadPosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0); - HeadPosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0); - HeadSizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690); - HeadSizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300); - HeadSplitPos = db_get_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250); + HeadPosX = db_get_dw(0, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0); + HeadPosY = db_get_dw(0, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0); + HeadSizeX = db_get_dw(0, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690); + HeadSizeY = db_get_dw(0, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300); + HeadSplitPos = db_get_w(0, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250); - optDateTime = db_get_b(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime); + optDateTime = db_get_b(0, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime); // Create new window queues for broadcast messages YAMNVar.MessageWnds = WindowList_Create(); diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 8516144847..ff4b4f33d6 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -20,13 +20,13 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- CheckDlgButton(hDlg, IDC_CHECKTTB, db_get_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CHECKTTB, db_get_b(0, YAMN_DBMODULE, YAMN_TTBFCHECK, 1) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_LONGDATE, (optDateTime&SHOWDATELONG) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_SMARTDATE, (optDateTime&SHOWDATENOTODAY) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_NOSECONDS, (optDateTime&SHOWDATENOSECONDS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_MAINMENU, db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_YAMNASPROTO, db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hDlg, IDC_CLOSEONDELETE, db_get_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_MAINMENU, db_get_b(0, YAMN_DBMODULE, YAMN_SHOWMAINMENU, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_YAMNASPROTO, db_get_b(0, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hDlg, IDC_CLOSEONDELETE, db_get_b(0, YAMN_DBMODULE, YAMN_CLOSEDELETE, 0) ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_COMMAND:
@@ -48,10 +48,10 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg, IDC_YAMNASPROTO));
- db_set_b(NULL, YAMN_DBMODULE, YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg, IDC_MAINMENU));
- db_set_b(NULL, YAMN_DBMODULE, YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg, IDC_CLOSEONDELETE));
- db_set_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg, IDC_CHECKTTB));
+ db_set_b(0, YAMN_DBMODULE, YAMN_SHOWASPROTO, IsDlgButtonChecked(hDlg, IDC_YAMNASPROTO));
+ db_set_b(0, YAMN_DBMODULE, YAMN_SHOWMAINMENU, IsDlgButtonChecked(hDlg, IDC_MAINMENU));
+ db_set_b(0, YAMN_DBMODULE, YAMN_CLOSEDELETE, IsDlgButtonChecked(hDlg, IDC_CLOSEONDELETE));
+ db_set_b(0, YAMN_DBMODULE, YAMN_TTBFCHECK, IsDlgButtonChecked(hDlg, IDC_CHECKTTB));
AddTopToolbarIcon(0, 0);
CheckMenuItems();
@@ -60,7 +60,7 @@ INT_PTR CALLBACK DlgProcYAMNOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara if (IsDlgButtonChecked(hDlg, IDC_LONGDATE))optDateTime |= SHOWDATELONG;
if (IsDlgButtonChecked(hDlg, IDC_SMARTDATE))optDateTime |= SHOWDATENOTODAY;
if (IsDlgButtonChecked(hDlg, IDC_NOSECONDS))optDateTime |= SHOWDATENOSECONDS;
- db_set_b(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);
+ db_set_b(0, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);
}
}
break;
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index c8517bda3e..392e6be674 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -11,7 +11,7 @@ static INT_PTR Service_GetCaps(WPARAM wParam, LPARAM) if (wParam == PFLAGNUM_2)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
if (wParam == PFLAGNUM_5) {
- if (db_get_b(NULL, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
+ if (db_get_b(0, YAMN_DBMODULE, YAMN_SHOWASPROTO, 1))
return PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND;
}
@@ -292,7 +292,7 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) int AddTopToolbarIcon(WPARAM, LPARAM)
{
- if (db_get_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
+ if (db_get_b(0, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
if (ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == nullptr) {
TTBButton btn = {};
btn.pszService = MS_YAMN_FORCECHECK;
@@ -318,11 +318,11 @@ int Shutdown(WPARAM, LPARAM) {
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, HeadPosX);
- db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, HeadPosY);
- db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, HeadSizeX);
- db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
- db_set_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
+ db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGPOSX, HeadPosX);
+ db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGPOSY, HeadPosY);
+ db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGSIZEX, HeadSizeX);
+ db_set_dw(0, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
+ db_set_w(0, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
YAMNVar.Shutdown = TRUE;
KillTimer(nullptr, SecTimer);
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index 1e2b70f3f8..38fb1acb89 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -6,79 +6,79 @@ HICON hPopupIcon = nullptr; void LoadModuleDependentOptions() {
if (ServiceExists(MS_AV_DRAWAVATAR))
- options.av_layout = (PopupAvLayout)db_get_b(0, MODULENAME, "AVLayout", PAV_RIGHT);
+ options.av_layout = (PopupAvLayout)g_plugin.getByte("AVLayout", PAV_RIGHT);
else
options.av_layout = PAV_NONE;
- options.time_layout = (PopupTimeLayout)db_get_b(0, MODULENAME, "TimeLayout", (ServiceExists(MS_AV_DRAWAVATAR) ? PT_WITHAV : PT_RIGHT));
+ options.time_layout = (PopupTimeLayout)g_plugin.getByte("TimeLayout", (ServiceExists(MS_AV_DRAWAVATAR) ? PT_WITHAV : PT_RIGHT));
if (options.time_layout == PT_WITHAV && !ServiceExists(MS_AV_DRAWAVATAR))
options.time_layout = PT_RIGHT;
}
void LoadOptions()
{
- options.default_timeout = db_get_dw(0, MODULENAME, "DefaultTimeout", 7);
- options.win_width = db_get_dw(0, MODULENAME, "WinWidth", 220);
- options.win_max_height = db_get_dw(0, MODULENAME, "WinMaxHeight", 400);
- options.location = (PopupLocation)db_get_b(0, MODULENAME, "Location", (BYTE)PL_BOTTOMRIGHT);
- options.opacity = db_get_b(0, MODULENAME, "Opacity", 75);
- options.border = db_get_b(0, MODULENAME, "Border", 1) == 1;
- options.round = db_get_b(0, MODULENAME, "RoundCorners", 1) == 1;
- options.av_round = db_get_b(0, MODULENAME, "AvatarRoundCorners", 1) == 1;
- options.animate = db_get_b(0, MODULENAME, "Animate", 0);
- options.trans_bg = db_get_b(0, MODULENAME, "TransparentBg", 0) == 1;
- options.use_mim_monitor = db_get_b(0, MODULENAME, "UseMimMonitor", 1) == 1;
- options.right_icon = db_get_b(0, MODULENAME, "RightIcon", 0) == 1;
+ options.default_timeout = g_plugin.getDword("DefaultTimeout", 7);
+ options.win_width = g_plugin.getDword("WinWidth", 220);
+ options.win_max_height = g_plugin.getDword("WinMaxHeight", 400);
+ options.location = (PopupLocation)g_plugin.getByte("Location", (BYTE)PL_BOTTOMRIGHT);
+ options.opacity = g_plugin.getByte("Opacity", 75);
+ options.border = g_plugin.getByte("Border", 1) == 1;
+ options.round = g_plugin.getByte("RoundCorners", 1) == 1;
+ options.av_round = g_plugin.getByte("AvatarRoundCorners", 1) == 1;
+ options.animate = g_plugin.getByte("Animate", 0);
+ options.trans_bg = g_plugin.getByte("TransparentBg", 0) == 1;
+ options.use_mim_monitor = g_plugin.getByte("UseMimMonitor", 1) == 1;
+ options.right_icon = g_plugin.getByte("RightIcon", 0) == 1;
options.av_layout = PAV_NONE; // corrected in LoadModuleDependentOptions function above
- options.av_size = db_get_dw(0, MODULENAME, "AVSize", 40); //tweety
- options.text_indent = db_get_dw(0, MODULENAME, "TextIndent", 22);
- options.global_hover = db_get_b(0, MODULENAME, "GlobalHover", 1) == 1;
- options.time_layout = (PopupTimeLayout)db_get_b(0, MODULENAME, "TimeLayout", PT_RIGHT);
+ options.av_size = g_plugin.getDword("AVSize", 40); //tweety
+ options.text_indent = g_plugin.getDword("TextIndent", 22);
+ options.global_hover = g_plugin.getByte("GlobalHover", 1) == 1;
+ options.time_layout = (PopupTimeLayout)g_plugin.getByte("TimeLayout", PT_RIGHT);
char buff[128];
for (int i = 0; i < 10; i++) {
mir_snprintf(buff, "DisableStatus%d", i - 1); // -1 because i forgot offline status earlier!
- options.disable_status[i] = (db_get_b(0, MODULENAME, buff, 0) == 1);
+ options.disable_status[i] = (g_plugin.getByte(buff, 0) == 1);
}
- options.disable_full_screen = db_get_b(0, MODULENAME, "DisableFullScreen", 1) == 1;
- options.drop_shadow = db_get_b(0, MODULENAME, "DropShadow", 0) == 1;
- options.sb_width = db_get_dw(0, MODULENAME, "SidebarWidth", 22);
- options.padding = db_get_dw(0, MODULENAME, "Padding", 4);
- options.av_padding = db_get_dw(0, MODULENAME, "AvatarPadding", 4);
+ options.disable_full_screen = g_plugin.getByte("DisableFullScreen", 1) == 1;
+ options.drop_shadow = g_plugin.getByte("DropShadow", 0) == 1;
+ options.sb_width = g_plugin.getDword("SidebarWidth", 22);
+ options.padding = g_plugin.getDword("Padding", 4);
+ options.av_padding = g_plugin.getDword("AvatarPadding", 4);
}
void SaveOptions()
{
- db_set_dw(0, MODULENAME, "DefaultTimeout", options.default_timeout);
- db_set_dw(0, MODULENAME, "WinWidth", options.win_width);
- db_set_dw(0, MODULENAME, "WinMaxHeight", options.win_max_height);
- db_set_b(0, MODULENAME, "Location", (BYTE)options.location);
- db_set_b(0, MODULENAME, "Opacity", (BYTE)options.opacity);
- db_set_b(0, MODULENAME, "Border", (options.border ? 1 : 0));
- db_set_b(0, MODULENAME, "RoundCorners", (options.round ? 1 : 0));
- db_set_b(0, MODULENAME, "AvatarRoundCorners", (options.av_round ? 1 : 0));
- db_set_b(0, MODULENAME, "Animate", options.animate);
- db_set_b(0, MODULENAME, "TransparentBg", (options.trans_bg ? 1 : 0));
- db_set_b(0, MODULENAME, "UseMimMonitor", (options.use_mim_monitor ? 1 : 0));
- db_set_b(0, MODULENAME, "RightIcon", (options.right_icon ? 1 : 0));
+ g_plugin.setDword("DefaultTimeout", options.default_timeout);
+ g_plugin.setDword("WinWidth", options.win_width);
+ g_plugin.setDword("WinMaxHeight", options.win_max_height);
+ g_plugin.setByte("Location", (BYTE)options.location);
+ g_plugin.setByte("Opacity", (BYTE)options.opacity);
+ g_plugin.setByte("Border", (options.border ? 1 : 0));
+ g_plugin.setByte("RoundCorners", (options.round ? 1 : 0));
+ g_plugin.setByte("AvatarRoundCorners", (options.av_round ? 1 : 0));
+ g_plugin.setByte("Animate", options.animate);
+ g_plugin.setByte("TransparentBg", (options.trans_bg ? 1 : 0));
+ g_plugin.setByte("UseMimMonitor", (options.use_mim_monitor ? 1 : 0));
+ g_plugin.setByte("RightIcon", (options.right_icon ? 1 : 0));
if (ServiceExists(MS_AV_DRAWAVATAR))
- db_set_b(0, MODULENAME, "AVLayout", (BYTE)options.av_layout);
- db_set_dw(0, MODULENAME, "AVSize", options.av_size);
- db_set_dw(0, MODULENAME, "TextIndent", options.text_indent);
- db_set_b(0, MODULENAME, "GlobalHover", (options.global_hover ? 1 : 0));
- db_set_b(0, MODULENAME, "TimeLayout", (BYTE)options.time_layout);
+ g_plugin.setByte("AVLayout", (BYTE)options.av_layout);
+ g_plugin.setDword("AVSize", options.av_size);
+ g_plugin.setDword("TextIndent", options.text_indent);
+ g_plugin.setByte("GlobalHover", (options.global_hover ? 1 : 0));
+ g_plugin.setByte("TimeLayout", (BYTE)options.time_layout);
char buff[128];
for (int i = 0; i < 9; i++) {
mir_snprintf(buff, "DisableStatus%d", i - 1);
- db_set_b(0, MODULENAME, buff, options.disable_status[i] ? 1 : 0);
+ g_plugin.setByte(buff, options.disable_status[i] ? 1 : 0);
}
- db_set_b(0, MODULENAME, "DisableFullScreen", (options.disable_full_screen ? 1 : 0));
- db_set_b(0, MODULENAME, "DropShadow", (options.drop_shadow ? 1 : 0));
- db_set_dw(0, MODULENAME, "SidebarWidth", options.sb_width);
- db_set_dw(0, MODULENAME, "Padding", options.padding);
- db_set_dw(0, MODULENAME, "AvatarPadding", options.av_padding);
+ g_plugin.setByte("DisableFullScreen", (options.disable_full_screen ? 1 : 0));
+ g_plugin.setByte("DropShadow", (options.drop_shadow ? 1 : 0));
+ g_plugin.setDword("SidebarWidth", options.sb_width);
+ g_plugin.setDword("Padding", options.padding);
+ g_plugin.setDword("AvatarPadding", options.av_padding);
}
void ShowExamplePopups()
@@ -453,11 +453,11 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam char setting[256];
for (auto &pc : arClasses) {
mir_snprintf(setting, "%s/Timeout", pc->pszName);
- db_set_w(0, MODULENAME, setting, pc->iSeconds);
+ g_plugin.setWord(setting, pc->iSeconds);
mir_snprintf(setting, "%s/TextCol", pc->pszName);
- db_set_dw(0, MODULENAME, setting, (DWORD)pc->colorText);
+ g_plugin.setDword(setting, (DWORD)pc->colorText);
mir_snprintf(setting, "%s/BgCol", pc->pszName);
- db_set_dw(0, MODULENAME, setting, (DWORD)pc->colorBack);
+ g_plugin.setDword(setting, (DWORD)pc->colorBack);
}
return TRUE;
}
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 78c66f4f97..0a801b28b5 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -6,7 +6,7 @@ static HANDLE hEventNotify; void StripBBCodesInPlace(wchar_t *text)
{
- if (text == nullptr || db_get_b(0, MODULENAME, "StripBBCodes", 1) == 0)
+ if (text == nullptr || g_plugin.getByte("StripBBCodes", 1) == 0)
return;
int read = 0, write = 0;
@@ -338,12 +338,12 @@ static INT_PTR RegisterPopupClass(WPARAM, LPARAM lParam) char setting[256];
mir_snprintf(setting, "%s/Timeout", pc->pszName);
- pc->iSeconds = db_get_w(0, MODULENAME, setting, pc->iSeconds);
+ pc->iSeconds = g_plugin.getWord(setting, pc->iSeconds);
if (pc->iSeconds == (WORD)-1) pc->iSeconds = -1;
mir_snprintf(setting, "%s/TextCol", pc->pszName);
- pc->colorText = (COLORREF)db_get_dw(0, MODULENAME, setting, (DWORD)pc->colorText);
+ pc->colorText = (COLORREF)g_plugin.getDword(setting, (DWORD)pc->colorText);
mir_snprintf(setting, "%s/BgCol", pc->pszName);
- pc->colorBack = (COLORREF)db_get_dw(0, MODULENAME, setting, (DWORD)pc->colorBack);
+ pc->colorBack = (COLORREF)g_plugin.getDword(setting, (DWORD)pc->colorBack);
arClasses.insert(pc);
return (INT_PTR)pc;
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 92617028c8..8d9a401489 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -214,23 +214,23 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent) int CMPlugin::Load()
{
// Load plugin options from DB
- hForwardFrom = (MCONTACT)db_get_dw(NULL, MODULENAME, "ForwardFrom", 0);
- hForwardTo = (MCONTACT)db_get_dw(NULL, MODULENAME, "ForwardTo", 0);
+ hForwardFrom = (MCONTACT)g_plugin.getDword("ForwardFrom", 0);
+ hForwardTo = (MCONTACT)g_plugin.getDword("ForwardTo", 0);
- iForwardOnStatus = db_get_dw(NULL, MODULENAME, "ForwardOnStatus", STATUS_OFFLINE | STATUS_AWAY | STATUS_NA);
+ iForwardOnStatus = g_plugin.getDword("ForwardOnStatus", STATUS_OFFLINE | STATUS_AWAY | STATUS_NA);
- wchar_t *szForwardTemplate = db_get_wsa(NULL, MODULENAME, "ForwardTemplate");
+ wchar_t *szForwardTemplate = g_plugin.getWStringA("ForwardTemplate");
if (szForwardTemplate){
wcsncpy(tszForwardTemplate, szForwardTemplate, _countof(tszForwardTemplate));
mir_free(szForwardTemplate);
}
else wcsncpy(tszForwardTemplate, L"%u: %m", MAXTEMPLATESIZE-1);
- iSplit = db_get_dw(NULL, MODULENAME, "Split", 0);
- iSplitMaxSize = db_get_dw(NULL, MODULENAME, "SplitMaxSize", 100);
- iSendParts = db_get_dw(NULL, MODULENAME, "SendParts", 0);
- iMarkRead = db_get_dw(NULL, MODULENAME, "MarkRead", 0);
- iSendAndHistory = db_get_dw(NULL, MODULENAME, "SendAndHistory", 1);
+ iSplit = g_plugin.getDword("Split", 0);
+ iSplitMaxSize = g_plugin.getDword("SplitMaxSize", 100);
+ iSendParts = g_plugin.getDword("SendParts", 0);
+ iMarkRead = g_plugin.getDword("MarkRead", 0);
+ iSendAndHistory = g_plugin.getDword("SendAndHistory", 1);
// hook events
HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded);
diff --git a/plugins/YARelay/src/options.cpp b/plugins/YARelay/src/options.cpp index 5082c2f6bd..7e4d1eceef 100644 --- a/plugins/YARelay/src/options.cpp +++ b/plugins/YARelay/src/options.cpp @@ -168,15 +168,15 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, iSplitMaxSize = 1;
// write to database
- db_set_dw(NULL, MODULENAME, "ForwardFrom", (DWORD)hForwardFrom);
- db_set_dw(NULL, MODULENAME, "ForwardTo", (DWORD)hForwardTo);
- db_set_dw(NULL, MODULENAME, "ForwardOnStatus", iForwardOnStatus);
- db_set_ws(NULL, MODULENAME, "ForwardTemplate", tszForwardTemplate);
- db_set_dw(NULL, MODULENAME, "Split", iSplit);
- db_set_dw(NULL, MODULENAME, "SplitMaxSize", iSplitMaxSize);
- db_set_dw(NULL, MODULENAME, "SendParts", iSendParts);
- db_set_dw(NULL, MODULENAME, "MarkRead", iMarkRead);
- db_set_dw(NULL, MODULENAME, "SendAndHistory", iSendAndHistory);
+ g_plugin.setDword("ForwardFrom", (DWORD)hForwardFrom);
+ g_plugin.setDword("ForwardTo", (DWORD)hForwardTo);
+ g_plugin.setDword("ForwardOnStatus", iForwardOnStatus);
+ g_plugin.setWString("ForwardTemplate", tszForwardTemplate);
+ g_plugin.setDword("Split", iSplit);
+ g_plugin.setDword("SplitMaxSize", iSplitMaxSize);
+ g_plugin.setDword("SendParts", iSendParts);
+ g_plugin.setDword("MarkRead", iMarkRead);
+ g_plugin.setDword("SendAndHistory", iSendAndHistory);
return TRUE;
}
break;
diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index eacb760c32..d9ae7f3020 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -37,7 +37,7 @@ CMPlugin::CMPlugin() : static void UpdateMenuItem()
{
- Menu_ModifyItem(noSoundMenu, db_get_b(NULL, "Skin", "UseSound", 1) ? DISABLE_SOUND : ENABLE_SOUND);
+ Menu_ModifyItem(noSoundMenu, db_get_b(0, "Skin", "UseSound", 1) ? DISABLE_SOUND : ENABLE_SOUND);
}
// Called when the sound setting in the database is changed
@@ -51,9 +51,9 @@ static int SoundSettingChanged(WPARAM, LPARAM lParam) int SetNotify(const long status)
{
- db_set_b(NULL, "Skin", "UseSound", (BYTE)!(db_get_dw(NULL, MODULENAME, "NoSound", DEFAULT_NOSOUND) & status));
- db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)(db_get_dw(NULL, MODULENAME, "NoBlink", DEFAULT_NOBLINK) & status));
- db_set_b(NULL, "CList", "NoIconBlink", (BYTE)(db_get_dw(NULL, MODULENAME, "NoCLCBlink", DEFAULT_NOCLCBLINK) & status));
+ db_set_b(0, "Skin", "UseSound", (BYTE)!(g_plugin.getDword("NoSound", DEFAULT_NOSOUND) & status));
+ db_set_b(0, "CList", "DisableTrayFlash", (BYTE)(g_plugin.getDword("NoBlink", DEFAULT_NOBLINK) & status));
+ db_set_b(0, "CList", "NoIconBlink", (BYTE)(g_plugin.getDword("NoCLCBlink", DEFAULT_NOCLCBLINK) & status));
UpdateMenuItem();
return 0;
@@ -93,10 +93,10 @@ int CMPlugin::Load() noSoundMenu = Menu_AddMainMenuItem(&mi);
CreateServiceFunction(mi.pszService, NoSoundMenuCommand);
- int bHideMenu = db_get_b(NULL, MODULENAME, "HideMenu", 100);
+ int bHideMenu = g_plugin.getByte("HideMenu", 100);
if (bHideMenu != 100) {
Menu_SetVisible(noSoundMenu, !bHideMenu);
- db_unset(0, MODULENAME, "HideMenu");
+ g_plugin.delSetting("HideMenu");
}
UpdateMenuItem();
diff --git a/plugins/ZeroNotification/src/options.cpp b/plugins/ZeroNotification/src/options.cpp index ba4970f54b..aa42e238a3 100644 --- a/plugins/ZeroNotification/src/options.cpp +++ b/plugins/ZeroNotification/src/options.cpp @@ -76,9 +76,9 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM, LPARA SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOBLINK), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOBLINK), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOCLCBLINK), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_NOCLCBLINK), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); - FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOSOUND), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), db_get_dw(NULL, MODULENAME, "NoSound", DEFAULT_NOSOUND)); - FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOBLINK), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), db_get_dw(NULL, MODULENAME, "NoBlink", DEFAULT_NOBLINK)); - FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOCLCBLINK), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), db_get_dw(NULL, MODULENAME, "NoCLCBlink", DEFAULT_NOCLCBLINK)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOSOUND), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), g_plugin.getDword("NoSound", DEFAULT_NOSOUND)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOBLINK), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), g_plugin.getDword("NoBlink", DEFAULT_NOBLINK)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_NOCLCBLINK), statusValues, sizeof(statusValues) / sizeof(statusValues[0]), g_plugin.getDword("NoCLCBlink", DEFAULT_NOCLCBLINK)); return TRUE; case WM_COMMAND: @@ -111,12 +111,12 @@ static INT_PTR CALLBACK DlgProcNoSoundOpts(HWND hwndDlg, UINT msg, WPARAM, LPARA case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_dw(NULL, MODULENAME, "NoSound", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOSOUND))); - db_set_dw(NULL, MODULENAME, "NoBlink", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOBLINK))); - db_set_dw(NULL, MODULENAME, "NoCLCBlink", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOCLCBLINK))); + g_plugin.setDword("NoSound", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOSOUND))); + g_plugin.setDword("NoBlink", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOBLINK))); + g_plugin.setDword("NoCLCBlink", MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_NOCLCBLINK))); - test = db_get_w(NULL, "CList", "Status", 0); - SetNotify(Proto_Status2Flag(db_get_w(NULL, "CList", "Status", 0))); + test = db_get_w(0, "CList", "Status", 0); + SetNotify(Proto_Status2Flag(db_get_w(0, "CList", "Status", 0))); return TRUE; } break; diff --git a/plugins/mTextControl/src/textusers.cpp b/plugins/mTextControl/src/textusers.cpp index b0d27d16e4..22abd621ae 100644 --- a/plugins/mTextControl/src/textusers.cpp +++ b/plugins/mTextControl/src/textusers.cpp @@ -45,8 +45,8 @@ HANDLE DLL_CALLCONV MTI_TextUserAdd(const char *userTitle, DWORD options) textUserNew->name = new char[mir_strlen(userTitle) + 1];
mir_strcpy(textUserNew->name, userTitle);
textUserNew->options =
- (db_get_dw(0, MODULENAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK);
- db_set_dw(0, MODULENAME, userTitle, textUserNew->options);
+ (g_plugin.getDword(userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK);
+ g_plugin.setDword(userTitle, textUserNew->options);
textUserNew->prev = textUserLast;
textUserNew->next = nullptr;
if (textUserLast) {
@@ -73,12 +73,12 @@ void TextUserSetOptions(HANDLE userHandle, DWORD options) void TextUsersSave()
{
for (TextUser *textUser = textUserFirst; textUser; textUser = textUser->next)
- db_set_dw(0, MODULENAME, textUser->name, textUser->options);
+ g_plugin.setDword(textUser->name, textUser->options);
}
void TextUsersReset()
{
for (TextUser *textUser = textUserFirst; textUser; textUser = textUser->next)
textUser->options =
- (db_get_dw(0, MODULENAME, textUser->name, 0)&MTEXT_FANCY_MASK) | (textUser->options&MTEXT_SYSTEM_MASK);
+ (g_plugin.getDword(textUser->name, 0)&MTEXT_FANCY_MASK) | (textUser->options&MTEXT_SYSTEM_MASK);
}
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 9269daf7ea..a3b9346e88 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -19,7 +19,7 @@ void logmsg2(char *str) void showmsgwnd(unsigned int param)
{
logmsg("showmsgwnd");
- if (db_get_b(NULL, MODULENAME, "showMessageWindow", DEFAULT_SHOWMSGWIN))
+ if (g_plugin.getByte("showMessageWindow", DEFAULT_SHOWMSGWIN))
CallService(MS_MSG_SENDMESSAGEW, (WPARAM)param, 0);
}
@@ -31,7 +31,7 @@ LRESULT ShowOSD(wchar_t *str, int timeout, COLORREF color, MCONTACT user) return 0;
if (timeout == 0)
- timeout = db_get_dw(NULL, MODULENAME, "timeout", DEFAULT_TIMEOUT);
+ timeout = g_plugin.getDword("timeout", DEFAULT_TIMEOUT);
osdmsg om;
om.text = str;
@@ -49,22 +49,22 @@ int ProtoAck(WPARAM, LPARAM lparam) logmsg("ProtoAck");
- if (!db_get_b(NULL, MODULENAME, "a_user", DEFAULT_ANNOUNCESTATUS))
+ if (!g_plugin.getByte("a_user", DEFAULT_ANNOUNCESTATUS))
return 0;
- if (!(db_get_dw(NULL, MODULENAME, "showWhen", DEFAULT_SHOWWHEN)&(1 << (db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE) - ID_STATUS_OFFLINE))))
+ if (!(g_plugin.getDword("showWhen", DEFAULT_SHOWWHEN)&(1 << (db_get_w(0, "CList", "Status", ID_STATUS_OFFLINE) - ID_STATUS_OFFLINE))))
return 0;
if (ack->type == ACKTYPE_STATUS) {
- if (!db_get_b(NULL, MODULENAME, "showMyStatus", DEFAULT_SHOWMYSTATUS))
+ if (!g_plugin.getByte("showMyStatus", DEFAULT_SHOWMYSTATUS))
return 0;
if (ack->result == ACKRESULT_SUCCESS && (LPARAM)ack->hProcess != ack->lParam) {
- DWORD ann = db_get_dw(NULL, MODULENAME, "announce", DEFAULT_ANNOUNCE);
+ DWORD ann = g_plugin.getDword("announce", DEFAULT_ANNOUNCE);
if (ann & (1 << (ack->lParam - ID_STATUS_OFFLINE))) {
wchar_t buffer[512];
mir_snwprintf(buffer, TranslateT("%s is %s"), Clist_GetContactDisplayName(ack->hContact), Clist_GetStatusModeDescription(ack->lParam, 0));
- ShowOSD(buffer, 0, db_get_dw(NULL, MODULENAME, "clr_status", DEFAULT_CLRSTATUS), ack->hContact);
+ ShowOSD(buffer, 0, g_plugin.getDword("clr_status", DEFAULT_CLRSTATUS), ack->hContact);
}
}
}
@@ -102,14 +102,14 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) {
MCONTACT hContact = (MCONTACT)wParam;
WORD newStatus = HIWORD(lParam);
- DWORD ann = db_get_dw(NULL, MODULENAME, "announce", DEFAULT_ANNOUNCE);
+ DWORD ann = g_plugin.getDword("announce", DEFAULT_ANNOUNCE);
logmsg("ContactStatusChanged1");
- if (!db_get_b(NULL, MODULENAME, "a_user", DEFAULT_ANNOUNCESTATUS))
+ if (!g_plugin.getByte("a_user", DEFAULT_ANNOUNCESTATUS))
return 0;
- if (!(db_get_dw(NULL, MODULENAME, "showWhen", DEFAULT_SHOWWHEN)&(1 << (db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE) - ID_STATUS_OFFLINE))))
+ if (!(g_plugin.getDword("showWhen", DEFAULT_SHOWWHEN)&(1 << (db_get_w(0, "CList", "Status", ID_STATUS_OFFLINE) - ID_STATUS_OFFLINE))))
return 0;
if (!(ann&(1 << (newStatus - ID_STATUS_OFFLINE))))
@@ -124,7 +124,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) wchar_t bufferW[512];
mir_snwprintf(bufferW, TranslateT("%s is %s"), Clist_GetContactDisplayName(wParam), Clist_GetStatusModeDescription(newStatus, 0));
- ShowOSD(bufferW, 0, db_get_dw(NULL, MODULENAME, "clr_status", DEFAULT_CLRSTATUS), hContact);
+ ShowOSD(bufferW, 0, g_plugin.getDword("clr_status", DEFAULT_CLRSTATUS), hContact);
return 0;
}
@@ -143,10 +143,10 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) if (dbe.flags & DBEF_SENT)
return 0;
- if (db_get_b(NULL, MODULENAME, "messages", DEFAULT_ANNOUNCEMESSAGES) == 0)
+ if (g_plugin.getByte("messages", DEFAULT_ANNOUNCEMESSAGES) == 0)
return 0;
- if (!(db_get_dw(NULL, MODULENAME, "showWhen", DEFAULT_SHOWWHEN)&(1 << (db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE) - ID_STATUS_OFFLINE))))
+ if (!(g_plugin.getDword("showWhen", DEFAULT_SHOWWHEN)&(1 << (db_get_w(0, "CList", "Status", ID_STATUS_OFFLINE) - ID_STATUS_OFFLINE))))
return 0;
logmsg("HookedNewEvent2");
@@ -155,7 +155,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) wcsncpy(buf, DEFAULT_MESSAGEFORMAT, _countof(buf));
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "message_format", &dbv)) {
+ if (!g_plugin.getWString("message_format", &dbv)) {
mir_wstrcpy(buf, dbv.pwszVal);
db_free(&dbv);
}
@@ -197,7 +197,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) wchar_t buffer[512];
mir_snwprintf(buffer, buf, c1, c2);
- ShowOSD(buffer, 0, db_get_dw(NULL, MODULENAME, "clr_msg", DEFAULT_CLRMSG), wParam);
+ ShowOSD(buffer, 0, g_plugin.getDword("clr_msg", DEFAULT_CLRMSG), wParam);
mir_free(c1);
mir_free(c2);
diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp index cea0f87793..9136649854 100644 --- a/plugins/wbOSD/src/options.cpp +++ b/plugins/wbOSD/src/options.cpp @@ -103,53 +103,53 @@ void loadDBSettings(plgsettings *ps) {
logmsg("loadDBSettings");
- ps->align = db_get_b(NULL, MODULENAME, "align", DEFAULT_ALIGN);
- ps->salign = db_get_b(NULL, MODULENAME, "salign", DEFAULT_SALIGN);
- ps->altShadow = db_get_b(NULL, MODULENAME, "altShadow", DEFAULT_ALTSHADOW);
- ps->transparent = db_get_b(NULL, MODULENAME, "transparent", DEFAULT_TRANPARENT);
- ps->showShadow = db_get_b(NULL, MODULENAME, "showShadow", DEFAULT_SHOWSHADOW);
- ps->messages = db_get_b(NULL, MODULENAME, "messages", DEFAULT_ANNOUNCEMESSAGES);
- ps->a_user = db_get_b(NULL, MODULENAME, "a_user", DEFAULT_ANNOUNCESTATUS);
- ps->distance = db_get_b(NULL, MODULENAME, "distance", DEFAULT_DISTANCE);
- ps->winx = db_get_dw(NULL, MODULENAME, "winx", DEFAULT_WINX);
- ps->winy = db_get_dw(NULL, MODULENAME, "winy", DEFAULT_WINY);
- ps->winxpos = db_get_dw(NULL, MODULENAME, "winxpos", DEFAULT_WINXPOS);
- ps->winypos = db_get_dw(NULL, MODULENAME, "winypos", DEFAULT_WINYPOS);
- ps->alpha = db_get_b(NULL, MODULENAME, "alpha", DEFAULT_ALPHA);
- ps->showmystatus = db_get_b(NULL, MODULENAME, "showMyStatus", DEFAULT_SHOWMYSTATUS);
- ps->timeout = db_get_dw(NULL, MODULENAME, "timeout", DEFAULT_TIMEOUT);
- ps->clr_msg = db_get_dw(NULL, MODULENAME, "clr_msg", DEFAULT_CLRMSG);
- ps->clr_status = db_get_dw(NULL, MODULENAME, "clr_status", DEFAULT_CLRSTATUS);
- ps->clr_shadow = db_get_dw(NULL, MODULENAME, "clr_shadow", DEFAULT_CLRSHADOW);
- ps->bkclr = db_get_dw(NULL, MODULENAME, "bkclr", DEFAULT_BKCLR);
-
- ps->showMsgWindow = db_get_b(NULL, MODULENAME, "showMessageWindow", DEFAULT_SHOWMSGWIN);
- ps->showWhen = db_get_dw(NULL, MODULENAME, "showWhen", DEFAULT_SHOWWHEN);
+ ps->align = g_plugin.getByte("align", DEFAULT_ALIGN);
+ ps->salign = g_plugin.getByte("salign", DEFAULT_SALIGN);
+ ps->altShadow = g_plugin.getByte("altShadow", DEFAULT_ALTSHADOW);
+ ps->transparent = g_plugin.getByte("transparent", DEFAULT_TRANPARENT);
+ ps->showShadow = g_plugin.getByte("showShadow", DEFAULT_SHOWSHADOW);
+ ps->messages = g_plugin.getByte("messages", DEFAULT_ANNOUNCEMESSAGES);
+ ps->a_user = g_plugin.getByte("a_user", DEFAULT_ANNOUNCESTATUS);
+ ps->distance = g_plugin.getByte("distance", DEFAULT_DISTANCE);
+ ps->winx = g_plugin.getDword("winx", DEFAULT_WINX);
+ ps->winy = g_plugin.getDword("winy", DEFAULT_WINY);
+ ps->winxpos = g_plugin.getDword("winxpos", DEFAULT_WINXPOS);
+ ps->winypos = g_plugin.getDword("winypos", DEFAULT_WINYPOS);
+ ps->alpha = g_plugin.getByte("alpha", DEFAULT_ALPHA);
+ ps->showmystatus = g_plugin.getByte("showMyStatus", DEFAULT_SHOWMYSTATUS);
+ ps->timeout = g_plugin.getDword("timeout", DEFAULT_TIMEOUT);
+ ps->clr_msg = g_plugin.getDword("clr_msg", DEFAULT_CLRMSG);
+ ps->clr_status = g_plugin.getDword("clr_status", DEFAULT_CLRSTATUS);
+ ps->clr_shadow = g_plugin.getDword("clr_shadow", DEFAULT_CLRSHADOW);
+ ps->bkclr = g_plugin.getDword("bkclr", DEFAULT_BKCLR);
+
+ ps->showMsgWindow = g_plugin.getByte("showMessageWindow", DEFAULT_SHOWMSGWIN);
+ ps->showWhen = g_plugin.getDword("showWhen", DEFAULT_SHOWWHEN);
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "message_format", &dbv)) {
+ if (!g_plugin.getWString("message_format", &dbv)) {
mir_wstrcpy(ps->msgformat, dbv.pwszVal);
db_free(&dbv);
}
else mir_wstrcpy(ps->msgformat, DEFAULT_MESSAGEFORMAT);
- ps->announce = db_get_dw(NULL, MODULENAME, "announce", DEFAULT_ANNOUNCE);
-
- ps->lf.lfHeight = db_get_dw(NULL, MODULENAME, "fntHeight", DEFAULT_FNT_HEIGHT);
- ps->lf.lfWidth = db_get_dw(NULL, MODULENAME, "fntWidth", DEFAULT_FNT_WIDTH);
- ps->lf.lfEscapement = db_get_dw(NULL, MODULENAME, "fntEscapement", DEFAULT_FNT_ESCAPEMENT);
- ps->lf.lfOrientation = db_get_dw(NULL, MODULENAME, "fntOrientation", DEFAULT_FNT_ORIENTATION);
- ps->lf.lfWeight = db_get_dw(NULL, MODULENAME, "fntWeight", DEFAULT_FNT_WEIGHT);
- ps->lf.lfItalic = db_get_b(NULL, MODULENAME, "fntItalic", DEFAULT_FNT_ITALIC);
- ps->lf.lfUnderline = db_get_b(NULL, MODULENAME, "fntUnderline", DEFAULT_FNT_UNDERLINE);
- ps->lf.lfStrikeOut = db_get_b(NULL, MODULENAME, "fntStrikeout", DEFAULT_FNT_STRIKEOUT);
- ps->lf.lfCharSet = db_get_b(NULL, MODULENAME, "fntCharSet", DEFAULT_FNT_CHARSET);
- ps->lf.lfOutPrecision = db_get_b(NULL, MODULENAME, "fntOutPrecision", DEFAULT_FNT_OUTPRECISION);
- ps->lf.lfClipPrecision = db_get_b(NULL, MODULENAME, "fntClipPrecision", DEFAULT_FNT_CLIPRECISION);
- ps->lf.lfQuality = db_get_b(NULL, MODULENAME, "fntQuality", DEFAULT_FNT_QUALITY);
- ps->lf.lfPitchAndFamily = db_get_b(NULL, MODULENAME, "fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
-
- if (!db_get_ws(NULL, MODULENAME, "fntFaceName", &dbv)) {
+ ps->announce = g_plugin.getDword("announce", DEFAULT_ANNOUNCE);
+
+ ps->lf.lfHeight = g_plugin.getDword("fntHeight", DEFAULT_FNT_HEIGHT);
+ ps->lf.lfWidth = g_plugin.getDword("fntWidth", DEFAULT_FNT_WIDTH);
+ ps->lf.lfEscapement = g_plugin.getDword("fntEscapement", DEFAULT_FNT_ESCAPEMENT);
+ ps->lf.lfOrientation = g_plugin.getDword("fntOrientation", DEFAULT_FNT_ORIENTATION);
+ ps->lf.lfWeight = g_plugin.getDword("fntWeight", DEFAULT_FNT_WEIGHT);
+ ps->lf.lfItalic = g_plugin.getByte("fntItalic", DEFAULT_FNT_ITALIC);
+ ps->lf.lfUnderline = g_plugin.getByte("fntUnderline", DEFAULT_FNT_UNDERLINE);
+ ps->lf.lfStrikeOut = g_plugin.getByte("fntStrikeout", DEFAULT_FNT_STRIKEOUT);
+ ps->lf.lfCharSet = g_plugin.getByte("fntCharSet", DEFAULT_FNT_CHARSET);
+ ps->lf.lfOutPrecision = g_plugin.getByte("fntOutPrecision", DEFAULT_FNT_OUTPRECISION);
+ ps->lf.lfClipPrecision = g_plugin.getByte("fntClipPrecision", DEFAULT_FNT_CLIPRECISION);
+ ps->lf.lfQuality = g_plugin.getByte("fntQuality", DEFAULT_FNT_QUALITY);
+ ps->lf.lfPitchAndFamily = g_plugin.getByte("fntPitchAndFamily", DEFAULT_FNT_PITCHANDFAM);
+
+ if (!g_plugin.getWString("fntFaceName", &dbv)) {
mir_wstrcpy(ps->lf.lfFaceName, dbv.pwszVal);
db_free(&dbv);
}
@@ -161,52 +161,52 @@ void saveDBSettings(plgsettings *ps) {
logmsg("saveDBSettings");
- db_set_b(NULL, MODULENAME, "showShadow", ps->showShadow);
- db_set_b(NULL, MODULENAME, "altShadow", ps->altShadow);
- db_set_b(NULL, MODULENAME, "distance", ps->distance);
-
- db_set_dw(NULL, MODULENAME, "winx", ps->winx);
- db_set_dw(NULL, MODULENAME, "winy", ps->winy);
- db_set_dw(NULL, MODULENAME, "winxpos", ps->winxpos);
- db_set_dw(NULL, MODULENAME, "winypos", ps->winypos);
-
- db_set_b(NULL, MODULENAME, "alpha", ps->alpha);
- db_set_dw(NULL, MODULENAME, "timeout", ps->timeout);
-
- db_set_b(NULL, MODULENAME, "transparent", ps->transparent);
- db_set_b(NULL, MODULENAME, "messages", ps->messages);
- db_set_b(NULL, MODULENAME, "a_user", ps->a_user);
- db_set_ws(NULL, MODULENAME, "message_format", ps->msgformat);
-
- db_set_b(NULL, MODULENAME, "align", ps->align);
- db_set_b(NULL, MODULENAME, "salign", ps->salign);
-
- db_set_b(NULL, MODULENAME, "showMyStatus", ps->showmystatus);
-
- db_set_dw(NULL, MODULENAME, "clr_msg", ps->clr_msg);
- db_set_dw(NULL, MODULENAME, "clr_shadow", ps->clr_shadow);
- db_set_dw(NULL, MODULENAME, "clr_status", ps->clr_status);
- db_set_dw(NULL, MODULENAME, "bkclr", ps->bkclr);
-
- db_set_dw(NULL, MODULENAME, "fntHeight", ps->lf.lfHeight);
- db_set_dw(NULL, MODULENAME, "fntWidth", ps->lf.lfWidth);
- db_set_dw(NULL, MODULENAME, "fntEscapement", ps->lf.lfEscapement);
- db_set_dw(NULL, MODULENAME, "fntOrientation", ps->lf.lfOrientation);
- db_set_dw(NULL, MODULENAME, "fntWeight", ps->lf.lfWeight);
- db_set_b(NULL, MODULENAME, "fntItalic", ps->lf.lfItalic);
- db_set_b(NULL, MODULENAME, "fntUnderline", ps->lf.lfUnderline);
- db_set_b(NULL, MODULENAME, "fntStrikeout", ps->lf.lfStrikeOut);
- db_set_b(NULL, MODULENAME, "fntCharSet", ps->lf.lfCharSet);
- db_set_b(NULL, MODULENAME, "fntOutPrecision", ps->lf.lfOutPrecision);
- db_set_b(NULL, MODULENAME, "fntClipPrecision", ps->lf.lfClipPrecision);
- db_set_b(NULL, MODULENAME, "fntQuality", ps->lf.lfQuality);
- db_set_b(NULL, MODULENAME, "fntPitchAndFamily", ps->lf.lfPitchAndFamily);
- db_set_ws(NULL, MODULENAME, "fntFaceName", ps->lf.lfFaceName);
-
- db_set_dw(NULL, MODULENAME, "announce", ps->announce);
-
- db_set_b(NULL, MODULENAME, "showMessageWindow", ps->showMsgWindow);
- db_set_dw(NULL, MODULENAME, "showWhen", ps->showWhen);
+ g_plugin.setByte("showShadow", ps->showShadow);
+ g_plugin.setByte("altShadow", ps->altShadow);
+ g_plugin.setByte("distance", ps->distance);
+
+ g_plugin.setDword("winx", ps->winx);
+ g_plugin.setDword("winy", ps->winy);
+ g_plugin.setDword("winxpos", ps->winxpos);
+ g_plugin.setDword("winypos", ps->winypos);
+
+ g_plugin.setByte("alpha", ps->alpha);
+ g_plugin.setDword("timeout", ps->timeout);
+
+ g_plugin.setByte("transparent", ps->transparent);
+ g_plugin.setByte("messages", ps->messages);
+ g_plugin.setByte("a_user", ps->a_user);
+ g_plugin.setWString("message_format", ps->msgformat);
+
+ g_plugin.setByte("align", ps->align);
+ g_plugin.setByte("salign", ps->salign);
+
+ g_plugin.setByte("showMyStatus", ps->showmystatus);
+
+ g_plugin.setDword("clr_msg", ps->clr_msg);
+ g_plugin.setDword("clr_shadow", ps->clr_shadow);
+ g_plugin.setDword("clr_status", ps->clr_status);
+ g_plugin.setDword("bkclr", ps->bkclr);
+
+ g_plugin.setDword("fntHeight", ps->lf.lfHeight);
+ g_plugin.setDword("fntWidth", ps->lf.lfWidth);
+ g_plugin.setDword("fntEscapement", ps->lf.lfEscapement);
+ g_plugin.setDword("fntOrientation", ps->lf.lfOrientation);
+ g_plugin.setDword("fntWeight", ps->lf.lfWeight);
+ g_plugin.setByte("fntItalic", ps->lf.lfItalic);
+ g_plugin.setByte("fntUnderline", ps->lf.lfUnderline);
+ g_plugin.setByte("fntStrikeout", ps->lf.lfStrikeOut);
+ g_plugin.setByte("fntCharSet", ps->lf.lfCharSet);
+ g_plugin.setByte("fntOutPrecision", ps->lf.lfOutPrecision);
+ g_plugin.setByte("fntClipPrecision", ps->lf.lfClipPrecision);
+ g_plugin.setByte("fntQuality", ps->lf.lfQuality);
+ g_plugin.setByte("fntPitchAndFamily", ps->lf.lfPitchAndFamily);
+ g_plugin.setWString("fntFaceName", ps->lf.lfFaceName);
+
+ g_plugin.setDword("announce", ps->announce);
+
+ g_plugin.setByte("showMessageWindow", ps->showMsgWindow);
+ g_plugin.setDword("showWhen", ps->showWhen);
}
INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam)
@@ -364,9 +364,9 @@ xxx: saveDBSettings(ps);
SetWindowPos(g_hWnd, nullptr, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetLayeredWindowAttributes(g_hWnd,
- db_get_dw(NULL, MODULENAME, "bkclr", DEFAULT_BKCLR),
- db_get_b(NULL, MODULENAME, "alpha", DEFAULT_ALPHA),
- (db_get_b(NULL, MODULENAME, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ g_plugin.getDword("bkclr", DEFAULT_BKCLR),
+ g_plugin.getByte("alpha", DEFAULT_ALPHA),
+ (g_plugin.getByte("transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
InvalidateRect(g_hWnd, nullptr, TRUE);
SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
@@ -397,7 +397,7 @@ xxx: ps[1] = ps[0]; //apply current settings at closing
saveDBSettings(ps);
- SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, MODULENAME, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, MODULENAME, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, MODULENAME, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ SetLayeredWindowAttributes(g_hWnd, g_plugin.getDword("bkclr", DEFAULT_BKCLR), g_plugin.getByte("alpha", DEFAULT_ALPHA), (g_plugin.getByte("transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
InvalidateRect(g_hWnd, nullptr, TRUE);
break;
}
diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index 4be73bf5f1..2d480c6be2 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -163,10 +163,10 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM ms = (osdmsg*)mir_alloc(sizeof(osdmsg));
ms->text = mir_wstrdup((wchar_t *)wParam);
if (lParam == 0)
- lParam = db_get_dw(NULL, MODULENAME, "timeout", DEFAULT_TIMEOUT);
+ lParam = g_plugin.getDword("timeout", DEFAULT_TIMEOUT);
ms->timeout = lParam;
ms->callback = nullptr;
- ms->color = db_get_dw(NULL, MODULENAME, "clr_msg", DEFAULT_CLRMSG);
+ ms->color = g_plugin.getDword("clr_msg", DEFAULT_CLRMSG);
ms->param = 0;
SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0);
mir_free(ms->text);
@@ -278,15 +278,15 @@ int MainInit(WPARAM, LPARAM) g_hWnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, szClassName, L"WannaBeOSD",
WS_POPUP,
- db_get_dw(NULL, MODULENAME, "winxpos", DEFAULT_WINXPOS),
- db_get_dw(NULL, MODULENAME, "winypos", DEFAULT_WINYPOS),
- db_get_dw(NULL, MODULENAME, "winx", DEFAULT_WINX),
- db_get_dw(NULL, MODULENAME, "winy", DEFAULT_WINY),
+ g_plugin.getDword("winxpos", DEFAULT_WINXPOS),
+ g_plugin.getDword("winypos", DEFAULT_WINYPOS),
+ g_plugin.getDword("winx", DEFAULT_WINX),
+ g_plugin.getDword("winy", DEFAULT_WINY),
HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(g_hWnd, GWLP_USERDATA, 0);
- SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, MODULENAME, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, MODULENAME, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, MODULENAME, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
+ SetLayeredWindowAttributes(g_hWnd, g_plugin.getDword("bkclr", DEFAULT_BKCLR), g_plugin.getByte("alpha", DEFAULT_ALPHA), (g_plugin.getByte("transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA);
CreateServiceFunction("OSD/Announce", OSDAnnounce);
|