summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-08-09 13:22:54 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-08-09 13:22:54 +0300
commit002cd89c27ead6c16027a51a4314c7e766f0bb18 (patch)
treead4f0f4bd9d00b966659b8eca32446b290027df2
parent49c1cd8e49395fdd10050c176df63a4c548deb87 (diff)
fixes #3625 (Скрывать настройки шрифтов и цветов встроенного журнала плагина сообщений, если в качестве журнала выбран сторонний журнал)
-rw-r--r--include/m_chat_int.h3
-rw-r--r--include/m_srmm_int.h4
-rw-r--r--libs/win32/mir_app.libbin269214 -> 269824 bytes
-rw-r--r--libs/win64/mir_app.libbin268350 -> 268960 bytes
-rw-r--r--plugins/Scriver/src/chat_options.cpp8
-rw-r--r--plugins/Scriver/src/msgoptions.cpp8
-rw-r--r--plugins/TabSRMM/src/chat_options.cpp8
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp8
-rw-r--r--src/core/stdmsg/src/chat_options.cpp10
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp8
-rw-r--r--src/mir_app/src/chat_svc.cpp7
-rw-r--r--src/mir_app/src/ei_defaulticons.cpp2
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/srmm_log.cpp22
15 files changed, 59 insertions, 33 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 83034f9677..66b0b2fdf9 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -400,7 +400,8 @@ namespace Chat
bDoubleClick4Privat,
bLogIndentEnabled,
bLogLimitNames,
- bStripFormat;
+ bStripFormat,
+ bEnableCustomLogs;
extern MIR_APP_EXPORT CMOption<uint32_t>
iPopupFlags,
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h
index 8f824846dc..bbcd04093f 100644
--- a/include/m_srmm_int.h
+++ b/include/m_srmm_int.h
@@ -27,6 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_gui.h>
+#define SRMM_MODULE "SRMM"
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// toolbar button internal representation
@@ -146,6 +148,8 @@ typedef CSrmmLogWindow *(MIR_CDECL *pfnSrmmLogCreator)(CMsgDialog &pDlg);
MIR_APP_DLL(HANDLE) RegisterSrmmLog(CMPlugin *pPlugin, const char *pszShortName, const wchar_t *pwszScreenName, pfnSrmmLogCreator fnBuilder);
MIR_APP_DLL(void) UnregisterSrmmLog(HANDLE);
+MIR_APP_DLL(bool) Srmm_IsCustomLogUsed();
+
/////////////////////////////////////////////////////////////////////////////////////////
// Simple single-event based logger
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 18b9205c9e..674ab1edcf 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 2fd5b0ee76..fa0772e1ae 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/src/chat_options.cpp b/plugins/Scriver/src/chat_options.cpp
index df21a3b7bf..2c1a041325 100644
--- a/plugins/Scriver/src/chat_options.cpp
+++ b/plugins/Scriver/src/chat_options.cpp
@@ -363,7 +363,9 @@ void ChatOptInitialize(WPARAM wParam)
odp.szTab.a = LPGEN("General");
g_plugin.addOptions(wParam, &odp);
- odp.pDialog = new CLogOptsDlg();
- odp.szTab.a = LPGEN("Log formatting");
- g_plugin.addOptions(wParam, &odp);
+ if (!Chat::bEnableCustomLogs) {
+ odp.pDialog = new CLogOptsDlg();
+ odp.szTab.a = LPGEN("Log formatting");
+ g_plugin.addOptions(wParam, &odp);
+ }
}
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index 3ffb686ae7..b51cddc4fa 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -805,9 +805,11 @@ int OptInitialise(WPARAM wParam, LPARAM)
odp.szTab.a = LPGEN("Layout");
g_plugin.addOptions(wParam, &odp);
- odp.pDialog = new CLogOptionsDlg();
- odp.szTab.a = LPGEN("Event log");
- g_plugin.addOptions(wParam, &odp);
+ if (!Srmm_IsCustomLogUsed()) {
+ odp.pDialog = new CLogOptionsDlg();
+ odp.szTab.a = LPGEN("Event log");
+ g_plugin.addOptions(wParam, &odp);
+ }
////////////////////////////////////////////////////////////////////////////////////////
odp.szGroup.a = LPGEN("Message sessions");
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp
index 40c2c9ca4e..0294bb5c45 100644
--- a/plugins/TabSRMM/src/chat_options.cpp
+++ b/plugins/TabSRMM/src/chat_options.cpp
@@ -895,9 +895,11 @@ void Chat_Options(WPARAM wParam)
odp.pDialog = new CChatSettingsDlg();
g_plugin.addOptions(wParam, &odp);
- odp.szTab.a = LPGEN("Log formatting");
- odp.pDialog = new CChatLogOptionDlg();
- g_plugin.addOptions(wParam, &odp);
+ if (!Chat::bEnableCustomLogs) {
+ odp.szTab.a = LPGEN("Log formatting");
+ odp.pDialog = new CChatLogOptionDlg();
+ g_plugin.addOptions(wParam, &odp);
+ }
odp.szTab.a = LPGEN("Highlighting");
odp.pDialog = new CHighlighOptionDlg();
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 6da1cec94f..ab56521362 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -1480,9 +1480,11 @@ int OptInitialise(WPARAM wParam, LPARAM lParam)
odp.pDialog = new COptContainersDlg();
g_plugin.addOptions(wParam, &odp);
- odp.szTab.a = LPGEN("Message log");
- odp.pDialog = new COptLogDlg();
- g_plugin.addOptions(wParam, &odp);
+ if (!Srmm_IsCustomLogUsed()) {
+ odp.szTab.a = LPGEN("Message log");
+ odp.pDialog = new COptLogDlg();
+ g_plugin.addOptions(wParam, &odp);
+ }
odp.szTab.a = LPGEN("Advanced tweaks");
odp.pDialog = new COptAdvancedDlg();
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp
index da48cd223a..a2354b48a2 100644
--- a/src/core/stdmsg/src/chat_options.cpp
+++ b/src/core/stdmsg/src/chat_options.cpp
@@ -332,9 +332,11 @@ int ChatOptionsInitialize(WPARAM wParam)
odp.pDialog = new COptMainDlg();
g_plugin.addOptions(wParam, &odp);
- odp.position = 910000001;
- odp.szTab.a = LPGEN("Chat log");
- odp.pDialog = new COptLogDlg();
- g_plugin.addOptions(wParam, &odp);
+ if (!Chat::bEnableCustomLogs) {
+ odp.position = 910000001;
+ odp.szTab.a = LPGEN("Chat log");
+ odp.pDialog = new COptLogDlg();
+ g_plugin.addOptions(wParam, &odp);
+ }
return 0;
}
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 2988457505..4209ce01ea 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -571,9 +571,11 @@ int OptInitialise(WPARAM wParam, LPARAM)
odp.pDialog = new COptionMainDlg();
g_plugin.addOptions(wParam, &odp);
- odp.szTab.a = LPGEN("Messaging log");
- odp.pDialog = new COptionLogDlg();
- g_plugin.addOptions(wParam, &odp);
+ if (!Srmm_IsCustomLogUsed()) {
+ odp.szTab.a = LPGEN("Messaging log");
+ odp.pDialog = new COptionLogDlg();
+ g_plugin.addOptions(wParam, &odp);
+ }
odp.szTab.a = LPGEN("Typing notify");
odp.pDialog = new COptionTypingDlg();
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 2f94b557f8..73c6eb540a 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -29,6 +29,7 @@ CMOption<bool> Chat::bPopupOnJoin(CHAT_MODULE, "PopupOnJoin", false);
CMOption<bool> Chat::bDoubleClick4Privat(CHAT_MODULE, "DoubleClick4Privat", false);
CMOption<bool> Chat::bShowContactStatus(CHAT_MODULE, "ShowContactStatus", true);
CMOption<bool> Chat::bContactStatusFirst(CHAT_MODULE, "ContactStatusFirst", false);
+CMOption<bool> Chat::bEnableCustomLogs(SRMM_MODULE, "EnableCustomLogs", false);
CMOption<bool> Chat::bFlashWindow(CHAT_MODULE, "FlashWindow", false);
CMOption<bool> Chat::bFlashWindowHighlight(CHAT_MODULE, "FlashWindowHighlight", false);
@@ -778,15 +779,15 @@ MIR_APP_DLL(void) Chat_UpdateOptions()
MIR_APP_DLL(int) Chat_IsMuted(MCONTACT hContact)
{
- return db_get_b(hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+ return db_get_b(hContact, SRMM_MODULE, "MuteMode", CHATMODE_NORMAL);
}
MIR_APP_DLL(void) Chat_Mute(MCONTACT hContact, int mode)
{
if (mode != CHATMODE_NORMAL)
- db_set_b(hContact, "SRMM", "MuteMode", mode);
+ db_set_b(hContact, SRMM_MODULE, "MuteMode", mode);
else
- db_unset(hContact, "SRMM", "MuteMode");
+ db_unset(hContact, SRMM_MODULE, "MuteMode");
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/ei_defaulticons.cpp b/src/mir_app/src/ei_defaulticons.cpp
index 763150027c..680572479d 100644
--- a/src/mir_app/src/ei_defaulticons.cpp
+++ b/src/mir_app/src/ei_defaulticons.cpp
@@ -184,7 +184,7 @@ static int SettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
- if (!strcmp(cws->szModule, "SRMM") && !strcmp(cws->szSetting, "MuteMode")) {
+ if (!strcmp(cws->szModule, SRMM_MODULE) && !strcmp(cws->szSetting, "MuteMode")) {
SetChatMute(hContact, cws->value.type == DBVT_DELETED ? CHATMODE_NORMAL : cws->value.bVal);
return 0;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index a16c766518..10f24a17e6 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -899,3 +899,5 @@ Clist_GroupSaveExpanded @1003 NONAME
??0MAsyncObject@@QAE@XZ @1016 NONAME
??1MAsyncObject@@UAE@XZ @1017 NONAME
??_7MAsyncObject@@6B@ @1018 NONAME
+?bEnableCustomLogs@Chat@@3V?$CMOption@_N@@A @1019 NONAME
+?Srmm_IsCustomLogUsed@@YG_NXZ @1020 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index ac7492986a..11ad367219 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -899,3 +899,5 @@ Clist_GroupSaveExpanded @1003 NONAME
??0MAsyncObject@@QEAA@XZ @1016 NONAME
??1MAsyncObject@@UEAA@XZ @1017 NONAME
??_7MAsyncObject@@6B@ @1018 NONAME
+?bEnableCustomLogs@Chat@@3V?$CMOption@_N@@A @1019 NONAME
+?Srmm_IsCustomLogUsed@@YA_NXZ @1020 NONAME
diff --git a/src/mir_app/src/srmm_log.cpp b/src/mir_app/src/srmm_log.cpp
index 3821b78b59..bbbcc7fac0 100644
--- a/src/mir_app/src/srmm_log.cpp
+++ b/src/mir_app/src/srmm_log.cpp
@@ -44,7 +44,7 @@ struct LoggerClass
static OBJLIST<LoggerClass> g_arLogClasses(1, PtrKeySortT);
-static CMOption<uint8_t> g_bEnableCustomLogs("SRMM", "EnableCustomLogs", 0);
+static CMOption<char *> g_logger(SRMM_MODULE, "Logger", "built-in");
/////////////////////////////////////////////////////////////////////////////////////////
@@ -55,14 +55,14 @@ static bool sttEnableCustomLogs(CMsgDialog *pDlg)
return true;
// if custom log viewers are disable, use build-in one
- if (!g_bEnableCustomLogs)
+ if (!Chat::bEnableCustomLogs)
return false;
// check if custom viewers are forbidden for this particular account
auto *szProto = Proto_GetBaseAccountName(pDlg->m_hContact);
if (szProto) {
// hidden setting !!!!!!!!
- CMStringA szProtoList(db_get_sm(0, "SRMM", "DisableCustomLogsForProto"));
+ CMStringA szProtoList(db_get_sm(0, SRMM_MODULE, "DisableCustomLogsForProto"));
int iStart = 0;
while (true) {
@@ -84,7 +84,7 @@ CSrmmLogWindow* Srmm_GetLogWindow(CMsgDialog *pDlg)
if (sttEnableCustomLogs(pDlg)) {
CMStringA szViewerName(db_get_sm(pDlg->m_hContact, SRMSGMOD, "Logger"));
if (szViewerName.IsEmpty())
- szViewerName = db_get_sm(0, "SRMM", "Logger", "built-in");
+ szViewerName = g_logger;
for (auto &it : g_arLogClasses)
if (szViewerName == it->szShortName)
@@ -98,6 +98,11 @@ CSrmmLogWindow* Srmm_GetLogWindow(CMsgDialog *pDlg)
return nullptr; // shall never happen
}
+MIR_APP_DLL(bool) Srmm_IsCustomLogUsed()
+{
+ return mir_strcmp(g_logger, "built-in") != 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// options dialog
@@ -114,7 +119,7 @@ public:
m_list(this, IDC_LIST),
chkCustomLogs(this, IDC_ENABLE_CUSTOM)
{
- CreateLink(chkCustomLogs, g_bEnableCustomLogs);
+ CreateLink(chkCustomLogs, Chat::bEnableCustomLogs);
m_list.OnSelChange = Callback(this, &CSrmmLogOptionsDlg::onChange_List);
}
@@ -122,11 +127,10 @@ public:
bool OnInitDialog() override
{
pDialog = this;
- ptrA szCurr(db_get_sa(0, "SRMM", "Logger", "built-in"));
for (auto &it : g_arLogClasses) {
int idx = m_list.AddString(TranslateW_LP(it->wszScreenName, it->pPlugin), LPARAM(it));
- if (!mir_strcmp(szCurr, it->szShortName))
+ if (!mir_strcmp(g_logger, it->szShortName))
m_list.SetCurSel(idx);
}
@@ -139,8 +143,8 @@ public:
if (idx == -1)
return false;
- auto *pLogger = (LoggerClass *)m_list.GetItemData(idx);
- db_set_s(0, "SRMM", "Logger", pLogger->szShortName);
+ if (auto *pLogger = (LoggerClass *)m_list.GetItemData(idx))
+ g_logger = pLogger->szShortName;
return true;
}