From 002cd89c27ead6c16027a51a4314c7e766f0bb18 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 9 Aug 2023 13:22:54 +0300 Subject: =?UTF-8?q?fixes=20#3625=20(=D0=A1=D0=BA=D1=80=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=88=D1=80=D0=B8=D1=84=D1=82=D0=BE=D0=B2=20=D0=B8=20?= =?UTF-8?q?=D1=86=D0=B2=D0=B5=D1=82=D0=BE=D0=B2=20=D0=B2=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=B5=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B6=D1=83=D1=80?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D0=B0=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?,=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B2=20=D0=BA=D0=B0=D1=87?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B2=D0=B5=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=B2=D1=8B=D0=B1=D1=80=D0=B0=D0=BD=20=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BE=D0=BD=D0=BD=D0=B8=D0=B9=20=D0=B6=D1=83?= =?UTF-8?q?=D1=80=D0=BD=D0=B0=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/m_chat_int.h | 3 ++- include/m_srmm_int.h | 4 ++++ libs/win32/mir_app.lib | Bin 269214 -> 269824 bytes libs/win64/mir_app.lib | Bin 268350 -> 268960 bytes plugins/Scriver/src/chat_options.cpp | 8 +++++--- plugins/Scriver/src/msgoptions.cpp | 8 +++++--- plugins/TabSRMM/src/chat_options.cpp | 8 +++++--- plugins/TabSRMM/src/msgoptions.cpp | 8 +++++--- src/core/stdmsg/src/chat_options.cpp | 10 ++++++---- src/core/stdmsg/src/msgoptions.cpp | 8 +++++--- src/mir_app/src/chat_svc.cpp | 7 ++++--- src/mir_app/src/ei_defaulticons.cpp | 2 +- src/mir_app/src/mir_app.def | 2 ++ src/mir_app/src/mir_app64.def | 2 ++ src/mir_app/src/srmm_log.cpp | 22 +++++++++++++--------- 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 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 +#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 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 2fd5b0ee76..fa0772e1ae 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib 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 Chat::bPopupOnJoin(CHAT_MODULE, "PopupOnJoin", false); CMOption Chat::bDoubleClick4Privat(CHAT_MODULE, "DoubleClick4Privat", false); CMOption Chat::bShowContactStatus(CHAT_MODULE, "ShowContactStatus", true); CMOption Chat::bContactStatusFirst(CHAT_MODULE, "ContactStatusFirst", false); +CMOption Chat::bEnableCustomLogs(SRMM_MODULE, "EnableCustomLogs", false); CMOption Chat::bFlashWindow(CHAT_MODULE, "FlashWindow", false); CMOption 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 g_arLogClasses(1, PtrKeySortT); -static CMOption g_bEnableCustomLogs("SRMM", "EnableCustomLogs", 0); +static CMOption 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; } -- cgit v1.2.3