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/MyDetails/src/data.cpp | 10 +++++----- plugins/MyDetails/src/frame.cpp | 22 +++++++++++----------- plugins/MyDetails/src/options.cpp | 4 ++-- plugins/MyDetails/src/services.cpp | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'plugins/MyDetails/src') 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(); -- cgit v1.2.3