diff options
author | George Hazan <george.hazan@gmail.com> | 2024-11-12 18:00:55 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-11-12 18:00:55 +0300 |
commit | 744dda0a74a4afa69bb2e27088f1c0f01a8891d9 (patch) | |
tree | 0d260fc4dd522f8869adcd96a4039c5f65f4d132 /plugins | |
parent | f7bbaf7fd984d26dbc150d9743aa14cd5dd23a8c (diff) |
SRMM options unification
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/msgoptions.cpp | 8 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/msgutils.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/srmm.cpp | 1 | ||||
-rw-r--r-- | plugins/Scriver/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 9 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/srmm.cpp | 2 |
10 files changed, 18 insertions, 25 deletions
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 7e6dddeccb..3be675019a 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -585,7 +585,7 @@ public: bool OnInitDialog() override
{
- switch (g_plugin.iHistoryMode) {
+ switch (Srmm::iHistoryMode) {
case LOADHISTORY_UNREAD:
chkLoadUnread.SetState(true);
break;
@@ -617,11 +617,11 @@ public: bool OnApply() override
{
if (chkLoadCount.GetState())
- g_plugin.iHistoryMode = LOADHISTORY_COUNT;
+ Srmm::iHistoryMode = LOADHISTORY_COUNT;
else if (chkLoadTime.GetState())
- g_plugin.iHistoryMode = LOADHISTORY_TIME;
+ Srmm::iHistoryMode = LOADHISTORY_TIME;
else
- g_plugin.iHistoryMode = LOADHISTORY_UNREAD;
+ Srmm::iHistoryMode = LOADHISTORY_UNREAD;
FreeMsgLogIcons();
LoadMsgLogIcons();
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index ea3c677e43..1b6e3572d9 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -209,10 +209,6 @@ int IsAutoPopup(MCONTACT hContact); void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour);
extern int fontOptionsListSize;
-#define LOADHISTORY_UNREAD 0
-#define LOADHISTORY_COUNT 1
-#define LOADHISTORY_TIME 2
-
#define SRMSGSET_BKGCOLOUR "BkgColour"
#define SRMSGDEFSET_BKGCOLOUR GetSysColor(COLOR_WINDOW)
#define SRMSGSET_INPUTBKGCOLOUR "InputBkgColour"
diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 327733cc9f..05159ea6ba 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -117,7 +117,7 @@ bool CMsgDialog::GetFirstEvent() bool notifyUnread = false; if (m_hContact) { - int historyMode = g_plugin.iHistoryMode; + int historyMode = Srmm::iHistoryMode; // This finds the first message to display, it works like shit m_hDbEventFirst = db_event_firstUnread(m_hContact); if (m_hDbEventFirst != 0) { diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp index 242673aefa..1785af45fc 100644 --- a/plugins/Scriver/src/srmm.cpp +++ b/plugins/Scriver/src/srmm.cpp @@ -109,7 +109,6 @@ CMPlugin::CMPlugin() : iActiveAlpha(SRMM_MODULE, "ActiveAlpha", 0),
iInactiveAlpha(SRMM_MODULE, "InactiveAlpha", 0),
iMsgTimeout(SRMM_MODULE, "MessageTimeout", 10),
- iHistoryMode(SRMM_MODULE, "LoadHistory", LOADHISTORY_UNREAD),
iAutoResizeLines(SRMM_MODULE, "AutoResizeLines", 2),
bSoundsFocus(CHAT_MODULE, "SoundsFocus", false),
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h index 731e44ad23..dac05cfe58 100644 --- a/plugins/Scriver/src/stdafx.h +++ b/plugins/Scriver/src/stdafx.h @@ -79,7 +79,7 @@ struct CMPlugin : public PLUGIN<CMPlugin> CMOption<uint8_t> bGroupMessages, bMarkFollowups, bMsgOnNewline, bDrawLines, bHideNames, bIndentText;
CMOption<uint8_t> bUseTabs, bLimitTabs, bLimitChatTabs, bLimitNames, bSeparateChats, bTabCloseButton, bHideOneTab, bTabsAtBottom, bSwitchToActive;
CMOption<uint8_t> bShowTyping, bShowTypingWin, bShowTypingTray, bShowTypingClist, bShowTypingSwitch;
- CMOption<uint8_t> iFlashCount, iHistoryMode;
+ CMOption<uint8_t> iFlashCount;
CMOption<uint16_t> iLimitNames, iLimitTabs, iLimitChatTabs, iLoadCount, iLoadTime, iIndentSize, iAutoResizeLines;
CMOption<uint32_t> iPopFlags, iMsgTimeout, iActiveAlpha, iInactiveAlpha;
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<CMPlugin>("SRMsg", pluginInfoEx),
+ PLUGIN<CMPlugin>(SRMM_MODULE, pluginInfoEx),
// main settings
bAutoMin(SRMSGMOD_T, "AutoMin", false),
|