From 744dda0a74a4afa69bb2e27088f1c0f01a8891d9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 12 Nov 2024 18:00:55 +0300 Subject: SRMM options unification --- plugins/TabSRMM/src/msgdlgother.cpp | 4 +--- plugins/TabSRMM/src/msgoptions.cpp | 9 +++++---- plugins/TabSRMM/src/msgs.cpp | 5 +++++ plugins/TabSRMM/src/msgs.h | 6 ------ plugins/TabSRMM/src/srmm.cpp | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index b7696c9658..b9b1ca8fd3 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -400,9 +400,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) bool CMsgDialog::GetFirstEvent() { - int historyMode = g_plugin.getByte(m_hContact, SRMSGSET_LOADHISTORY, -1); - if (historyMode == -1) - historyMode = (int)g_plugin.getByte(SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY); + int historyMode = g_plugin.getByte(m_hContact, "LoadHistory", Srmm::iHistoryMode); m_hDbEventFirst = db_event_firstUnread(m_hContact); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 10f6d5a091..aec3b0b1c3 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -799,7 +799,7 @@ public: bool OnInitDialog() override { - switch (g_plugin.getByte(SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) { + switch (Srmm::iHistoryMode) { case LOADHISTORY_UNREAD: chkLoadUnread.SetState(true); break; @@ -827,11 +827,12 @@ public: bool OnApply() override { if (chkLoadCount.GetState()) - g_plugin.setByte(SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT); + Srmm::iHistoryMode = LOADHISTORY_COUNT; else if (chkLoadTime.GetState()) - g_plugin.setByte(SRMSGSET_LOADHISTORY, LOADHISTORY_TIME); + Srmm::iHistoryMode = LOADHISTORY_TIME; else - g_plugin.setByte(SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD); + Srmm::iHistoryMode = LOADHISTORY_UNREAD; + g_plugin.setWord(SRMSGSET_LOADCOUNT, spnLoadCount.GetPosition()); g_plugin.setWord(SRMSGSET_LOADTIME, spnLoadTime.GetPosition()); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 3ebc767a9c..c44bcccc4b 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -689,6 +689,11 @@ int LoadSendRecvMessageModule(void) db_delete_module(0, NEN_OLD_MODULE); } + if (!db_is_module_empty(0, SRMSGMOD)) { + db_copy_module(SRMSGMOD, SRMM_MODULE); + db_delete_module(0, SRMSGMOD); + } + if (M.GetDword("cWarningsV", 0) == 0) db_set_dw(0, SRMSGMOD_T, "cWarningsV", M.GetDword("cWarningsL", 0)); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 9e8bfd4283..05ad07b5a3 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -802,16 +802,10 @@ struct TIconDescW #define IPFONTID_PROTO 3 #define IPFONTID_TIME 4 -#define LOADHISTORY_UNREAD 0 -#define LOADHISTORY_COUNT 1 -#define LOADHISTORY_TIME 2 - #define SRMSGSET_MSGTIMEOUT "MessageTimeout" #define SRMSGDEFSET_MSGTIMEOUT 30000 #define SRMSGSET_MSGTIMEOUT_MIN 5000 // minimum value (5 seconds) -#define SRMSGSET_LOADHISTORY "LoadHistory" -#define SRMSGDEFSET_LOADHISTORY LOADHISTORY_COUNT #define SRMSGSET_LOADCOUNT "LoadCount" #define SRMSGDEFSET_LOADCOUNT 10 #define SRMSGSET_LOADTIME "LoadTime" diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index b8e84de620..88a3d82614 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -52,7 +52,7 @@ PLUGININFOEX pluginInfoEx = { }; CMPlugin::CMPlugin() : - PLUGIN("SRMsg", pluginInfoEx), + PLUGIN(SRMM_MODULE, pluginInfoEx), // main settings bAutoMin(SRMSGMOD_T, "AutoMin", false), -- cgit v1.2.3