diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-22 20:37:53 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-22 20:37:53 +0300 |
commit | 644654ce3a5fef70e07a59dd8e8ee69448829175 (patch) | |
tree | 7afe0f5947d63b4f98578b9ec00733643fa5e1e1 /plugins/TabSRMM/src | |
parent | 6c10f6b8b8564337fb5fb88d31f2403ec2ccce9e (diff) |
fixes #3108 (tabSRMM doesn't take typing notification settings for unknown contacts into consideration) + code cleaning
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/controls.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/srmm.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/typingnotify.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/version.h | 2 |
7 files changed, 17 insertions, 16 deletions
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index e2cfc1d90f..84f1f978cf 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -961,7 +961,7 @@ LONG_PTR CALLBACK CMsgDialog::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM pContainer->m_flags.m_bNoSound ? TranslateT("disabled") : TranslateT("enabled"));
}
else if (sid->dwId == MSG_ICON_UTN && dat->AllowTyping()) {
- int mtnStatus = g_plugin.getByte(dat->m_hContact, SRMSGSET_TYPING, g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
+ int mtnStatus = g_plugin.getByte(dat->m_hContact, SRMSGSET_TYPING, g_plugin.bTypingNew);
mir_snwprintf(wBuf, TranslateT("Sending typing notifications is %s."),
mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 33f53404b2..3168812590 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -468,7 +468,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara case IDC_SELFTYPING: if (AllowTyping()) { - int iCurrentTypingMode = g_plugin.getByte(m_hContact, SRMSGSET_TYPING, g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); + int iCurrentTypingMode = g_plugin.getByte(m_hContact, SRMSGSET_TYPING, g_plugin.bTypingNew); if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && iCurrentTypingMode) { DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; @@ -802,7 +802,7 @@ void CMsgDialog::DM_NotifyTyping(int mode) return; // allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle) - if (!g_plugin.getByte(hContact, SRMSGSET_TYPING, g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) + if (!g_plugin.getByte(hContact, SRMSGSET_TYPING, g_plugin.bTypingNew)) return; if (szProto == nullptr) // should not, but who knows... @@ -833,7 +833,7 @@ void CMsgDialog::DM_NotifyTyping(int mode) // don't send to contacts which are not permanently added to the contact list, // unless the option to ignore added status is set. - if (!Contact_OnList(m_hContact) && !g_plugin.getByte(SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) + if (!Contact_OnList(m_hContact) && !g_plugin.bTypingUnknown) return; // End user check @@ -1223,7 +1223,7 @@ void CMsgDialog::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) if (AllowTyping()) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); - DrawIconEx(hDC, x, y, g_plugin.getByte(m_hContact, SRMSGSET_TYPING, g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? + DrawIconEx(hDC, x, y, g_plugin.getByte(m_hContact, SRMSGSET_TYPING, g_plugin.bTypingNew) ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } else CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], 50); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index e71a21132f..fbc7f439db 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1016,11 +1016,11 @@ class COptTypingDlg : public CDlgBase void RebuildList(CCtrlClc* = nullptr)
{
- uint8_t defType = g_plugin.getByte(SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW);
+ bool defType = g_plugin.bTypingNew;
if (hItemNew && defType)
m_clist.SetCheck(hItemNew, true);
- if (hItemUnknown && g_plugin.getByte(SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
+ if (hItemUnknown && g_plugin.bTypingUnknown)
m_clist.SetCheck(hItemUnknown, true);
for (auto &hContact : Contacts())
@@ -1031,10 +1031,10 @@ class COptTypingDlg : public CDlgBase void SaveList()
{
if (hItemNew)
- g_plugin.setByte(SRMSGSET_TYPINGNEW, m_clist.GetCheck(hItemNew));
+ g_plugin.bTypingNew = m_clist.GetCheck(hItemNew);
if (hItemUnknown)
- g_plugin.setByte(SRMSGSET_TYPINGUNKNOWN, m_clist.GetCheck(hItemUnknown));
+ g_plugin.bTypingUnknown = m_clist.GetCheck(hItemUnknown);
for (auto &hContact : Contacts())
if (HANDLE hItem = m_clist.FindContact(hContact))
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 7c18a6a61b..4ededb3d19 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -836,11 +836,6 @@ struct TIconDescW #define SRMSGDEFSET_BKGOUTCOLOUR RGB(245,245,255)
#define SRMSGSET_TYPING "SupportTyping"
-#define SRMSGSET_TYPINGNEW "DefaultTyping"
-#define SRMSGDEFSET_TYPINGNEW 1
-
-#define SRMSGSET_TYPINGUNKNOWN "UnknownTyping"
-#define SRMSGDEFSET_TYPINGUNKNOWN 0
#define SRMSGSET_SHOWTYPING "ShowTyping"
#define SRMSGDEFSET_SHOWTYPING 1
@@ -1075,6 +1070,7 @@ struct CMPlugin : public PLUGIN<CMPlugin> HANDLE hLogger;
CMOption<bool> bPopups;
+ CMOption<bool> bTypingNew, bTypingUnknown;
CMPlugin();
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 721e96799d..0c4118e01c 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -53,7 +53,9 @@ PLUGININFOEX pluginInfoEx = { CMPlugin::CMPlugin() : PLUGIN<CMPlugin>("SRMsg", pluginInfoEx), - bPopups(TypingModule, "TypingPopup", true) + bPopups(TypingModule, "TypingPopup", true), + bTypingNew(TypingModule, "DefaultTyping", true), + bTypingUnknown(TypingModule, "UnknownTyping", false) {} ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 81318084f1..02f741c5e9 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -67,6 +67,9 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) if (Contact_IsHidden(hContact) || (db_get_dw(hContact, "Ignore", "Mask1", 0) & 1)) // 9 - online notification
return;
+ if (!Contact_OnList(hContact) && !g_plugin.bTypingUnknown)
+ return;
+
if (!g_plugin.bPopups)
return;
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index a8da5e5fe0..9746933cd4 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3
#define __MINOR_VERSION 6
#define __RELEASE_NUM 2
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
|