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/Msg_Export/src/FileViewer.cpp | 42 +++++++++++++++++------------------ plugins/Msg_Export/src/main.cpp | 8 +++---- plugins/Msg_Export/src/options.cpp | 10 ++++----- plugins/Msg_Export/src/utils.cpp | 2 +- 4 files changed, 31 insertions(+), 31 deletions(-) (limited to 'plugins/Msg_Export') 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; -- cgit v1.2.3