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/YAPP/src/options.cpp | 100 +++++++++++++++++++++--------------------- plugins/YAPP/src/services.cpp | 8 ++-- 2 files changed, 54 insertions(+), 54 deletions(-) (limited to 'plugins/YAPP') 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; -- cgit v1.2.3