From 53fe3e46177d17b4941610de19f5cc6210700cb4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 21:44:56 +0300 Subject: db_* functions replaced with g_plugin calls --- plugins/FileAsMessage/src/dialog.cpp | 22 +++++++++++----------- plugins/FileAsMessage/src/optionsdlg.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'plugins/FileAsMessage/src') 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; } -- cgit v1.2.3