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/TipperYM/src/options.cpp | 262 +++++++++++++++++------------------ plugins/TipperYM/src/popwin.cpp | 4 +- plugins/TipperYM/src/skin_parser.cpp | 8 +- plugins/TipperYM/src/subst.cpp | 2 +- plugins/TipperYM/src/tipper.cpp | 6 +- 5 files changed, 141 insertions(+), 141 deletions(-) (limited to 'plugins/TipperYM') 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(); -- cgit v1.2.3