From 78ffd40384ed8a7df3f5bccb3480e7c424bbb90c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 11 Dec 2021 16:51:29 +0300 Subject: Fixes #2982: - status change events are now considered tabSRMM specific and are generated only for tabSRMM embedded log viewer - code cleaning --- plugins/TabSRMM/src/chat_manager.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 4 ++-- plugins/TabSRMM/src/globals.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgdlgother.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.h | 1 + plugins/TabSRMM/src/msgoptions.cpp | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/TabSRMM/src/chat_manager.cpp b/plugins/TabSRMM/src/chat_manager.cpp index ff8db52d88..4219dd649b 100644 --- a/plugins/TabSRMM/src/chat_manager.cpp +++ b/plugins/TabSRMM/src/chat_manager.cpp @@ -129,7 +129,7 @@ void OnCreateNick(const SESSION_INFO *si, const LOGINFO *lin, CMStringW &wszNick else wszNick.Append(lin->ptszNick); int logMode = (si->pDlg) ? si->pDlg->m_iLogMode : 1; - if (g_Settings.bClickableNicks && !logMode && !lin->bSimple) { + if (g_Settings.bClickableNicks && logMode == WANT_BUILTIN_LOG && !lin->bSimple) { wszNick.Insert(0, CLICKNICK_BEGIN); wszNick.Append(CLICKNICK_END); } diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index b34ab7f6e6..8525ef002b 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -632,7 +632,7 @@ void CMsgDialog::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) if (IsIconic(m_pContainer->m_hwnd)) m_bDeferredScroll = true; - if (m_iLogMode == 0) + if (m_iLogMode == WANT_BUILTIN_LOG) ((CLogWindow *)m_pLog)->ScrollToBottom(wParam != 0, lParam != 0); else m_pLog->ScrollToBottom(); @@ -781,7 +781,7 @@ void CMsgDialog::DM_ThemeChanged() m_hTheme = OpenThemeData(m_hwnd, L"EDIT"); if (m_hTheme != nullptr || (CSkin::m_skinEnabled && !item_log->IGNORED)) { - if (m_iLogMode == 0) + if (m_iLogMode == WANT_BUILTIN_LOG) LOG()->DisableStaticEdge(); if (isChat()) diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index e9b8777437..ca14910848 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -498,7 +498,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) return; CMsgDialog *dat = c->getDat(); - if (dat == nullptr || !c->isValid()) + if (dat == nullptr || !c->isValid() || dat->m_iLogMode != WANT_BUILTIN_LOG) return; MCONTACT hContact = c->getContact(); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a2100c9fcb..5e73f4b7fa 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -927,7 +927,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*) return; bool bUseSelection = false; - if (m_iLogMode == 0) { + if (m_iLogMode == WANT_BUILTIN_LOG) { CHARRANGE sel; LOG()->WndProc(EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 36012b25f3..e1e16473fe 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -864,7 +864,7 @@ void CMsgDialog::LoadSplitter() void CMsgDialog::LogEvent(DBEVENTINFO &dbei) { - if (m_iLogMode != 0) { + if (m_iLogMode != WANT_BUILTIN_LOG) { dbei.flags |= DBEF_TEMPORARY; MEVENT hDbEvent = db_event_add(m_hContact, &dbei); diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 3c55317d47..1ba25439b7 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -27,6 +27,7 @@ #ifndef _MSGDLGUTILS_H #define _MSGDLGUTILS_H +#define WANT_BUILTIN_LOG 0 #define WANT_IEVIEW_LOG 1 #define WANT_HPP_LOG 2 diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 9df4fd1f6a..90614c249f 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -486,7 +486,6 @@ static TOptionListItem lvItemsMsg[] = { 0, LPGENW("Enable \"Paste and send\" feature"), 0, LOI_TYPE_SETTING, (UINT_PTR)"pasteandsend", 1 }, { 0, LPGENW("Allow BBCode formatting in outgoing messages"), 0, LOI_TYPE_SETTING, (UINT_PTR)"sendformat", 1 }, { 0, LPGENW("Automatically split long messages (experimental, use with care)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"autosplit", 2 }, - { 0, LPGENW("Log status changes"), 0, LOI_TYPE_SETTING, (UINT_PTR)"logstatuschanges", 2 }, { 0, LPGENW("Use the same splitter height for all sessions"), 1, LOI_TYPE_SETTING, (UINT_PTR)"usesamesplitsize", 2 }, { 0, LPGENW("Automatically copy selected text"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autocopy", 2 }, { 0, nullptr, 0, 0, 0, 0 } @@ -847,6 +846,7 @@ static TOptionListItem lvItemsLog[] = { 0, LPGENW("Show seconds in timestamps"), 1, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_SHOWSECONDS, 2 }, { 0, LPGENW("Use contacts local time (if timezone info available)"), 0, LOI_TYPE_FLAG, (UINT_PTR)MWF_LOG_LOCALTIME, 2 }, { 0, LPGENW("Draw grid lines"), 1, LOI_TYPE_FLAG, MWF_LOG_GRID, 0 }, + { 0, LPGENW("Log status changes"), 0, LOI_TYPE_SETTING, (UINT_PTR)"logstatuschanges", 0 }, { 0, LPGENW("Event type icons in the message log"), 1, LOI_TYPE_FLAG, MWF_LOG_SHOWICONS, 3 }, { 0, LPGENW("Text symbols as event markers"), 0, LOI_TYPE_FLAG, MWF_LOG_SYMBOLS, 3 }, { 0, LPGENW("Use incoming/outgoing icons"), 1, LOI_TYPE_FLAG, MWF_LOG_INOUTICONS, 3 }, -- cgit v1.2.3