From 147122758513993f4fd8bdc6c341f21d9d8beaca Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Sat, 25 Apr 2020 17:41:18 +0300
Subject: CLogWindow::LogEvents considered useless and localized inside tabSRMM

---
 plugins/Scriver/src/msglog.cpp      |  4 ----
 plugins/Scriver/src/msgs.h          |  1 -
 plugins/TabSRMM/src/globals.cpp     |  2 +-
 plugins/TabSRMM/src/msgdlgother.cpp | 13 +++++++++++++
 plugins/TabSRMM/src/msglog.cpp      |  5 -----
 plugins/TabSRMM/src/msgs.h          |  5 +----
 plugins/TabSRMM/src/sendqueue.cpp   |  4 ++--
 plugins/TabSRMM/src/templates.cpp   |  2 +-
 8 files changed, 18 insertions(+), 18 deletions(-)

(limited to 'plugins')

diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 1a088be1b7..8e2e2c40ac 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -828,10 +828,6 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool bAppend)
 	m_pDlg.m_hDbEventLast = streamData.hDbEventLast;
 }
 
-void CLogWindow::LogEvents(DBEVENTINFO*, bool)
-{
-}
-
 void CLogWindow::LogEvents(LOGINFO *lin, bool bRedraw)
 {
 	auto *si = m_pDlg.m_si;
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index bc1bb201ad..e25128b5ac 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -38,7 +38,6 @@ public:
 
 	void Attach() override;
 	void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override;
-	void LogEvents(DBEVENTINFO *dbei, bool bAppend) override;
 	void LogEvents(struct LOGINFO *, bool) override;
 	void ScrollToBottom() override;
 	void UpdateOptions() override;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 10b4a25444..e48a705a71 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -536,5 +536,5 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
 	dbei.eventType = EVENTTYPE_STATUSCHANGE;
 	dbei.timestamp = time(0);
 	dbei.szModule = (char*)c->getProto();
-	dat->LogEvent(&dbei);
+	dat->LogEvent(dbei);
 }
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index 249863ec01..8317d4bd0c 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -852,6 +852,19 @@ void CMsgDialog::LoadSplitter()
 		m_iSplitterY = 150;
 }
 
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CMsgDialog::LogEvent(DBEVENTINFO &dbei)
+{
+	dbei.flags |= DBEF_TEMPORARY;
+	
+	MEVENT hDbEvent = db_event_add(m_hContact, &dbei);
+	if (hDbEvent) {
+		m_pLog->LogEvents(hDbEvent, 1, true);
+		db_event_delete(hDbEvent);
+	}
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////
 // draw various elements of the message window, like avatar(s), info panel fields
 // and the color formatting menu
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index cd057cae83..b053d0b47e 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -1207,11 +1207,6 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend)
 	LogEvents(hDbEventFirst, count, fAppend, nullptr);
 }
 
-void CLogWindow::LogEvents(DBEVENTINFO *dbei, bool bAppend)
-{
-	LogEvents(0, 1, bAppend, dbei);
-}
-
 void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend, DBEVENTINFO *dbei_s)
 {
 	CHARRANGE oldSel, sel;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 339e4cbd36..60d429910d 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -311,7 +311,6 @@ public:
 
 	void Attach() override;
 	void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override;
-	void LogEvents(DBEVENTINFO *dbei, bool bAppend) override;
 	void LogEvents(struct LOGINFO *, bool) override;
 	void ScrollToBottom() override;
 	void UpdateOptions() override;
@@ -577,9 +576,7 @@ public:
 		return ((CLogWindow *)m_pLog);
 	}
 
-	__forceinline void LogEvent(DBEVENTINFO *dbei) {
-		m_pLog->LogEvents(dbei, 1);
-	}
+	void LogEvent(DBEVENTINFO &dbei);
 
 	bool IsActive() const override
 	{
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 8f33be1bea..a31bbac0fd 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -358,7 +358,7 @@ void SendQueue::logError(CMsgDialog *dat, int iSendJobIndex, const wchar_t *szEr
 	dbei.cbBlob = (int)iMsgLen;
 	dbei.timestamp = time(0);
 	dbei.szModule = (char *)szErrMsg;
-	dat->LogEvent(&dbei);
+	dat->LogEvent(dbei);
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -554,7 +554,7 @@ int SendQueue::doSendLater(int iJobIndex, CMsgDialog *dat, MCONTACT hContact, bo
 		dbei.timestamp = time(0);
 		dbei.cbBlob = (int)mir_strlen(utfText) + 1;
 		dbei.pBlob = (PBYTE)(char*)utfText;
-		dat->LogEvent(&dbei);
+		dat->LogEvent(dbei);
 
 		if (dat->m_hDbEventFirst == 0)
 			dat->RemakeLog();
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index 7829258d75..4b5cc80143 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -262,7 +262,7 @@ void CTemplateEditDlg::onClick_Preview(CCtrlButton*)
 	m_dwFlags = (iIndex == 0 || iIndex == 1) ? m_dwFlags & ~MWF_LOG_GROUPMODE : m_dwFlags | MWF_LOG_GROUPMODE;
 	mir_snwprintf(m_wszMyNickname, L"My Nickname");
 	m_pLog->Clear();
-	LogEvent(&dbei);
+	LogEvent(dbei);
 	if (changed)
 		memcpy(tSet->szTemplates[inEdit], szTemp, TEMPLATE_LENGTH * sizeof(wchar_t));
 }
-- 
cgit v1.2.3