diff options
-rw-r--r-- | include/m_srmm_int.h | 26 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 266552 -> 268168 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 265636 -> 267288 bytes | |||
-rw-r--r-- | plugins/IEView/src/ieview_logger.cpp | 30 | ||||
-rw-r--r-- | plugins/NewStory/src/history_log.cpp | 12 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_log.cpp | 17 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 5 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 5 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 13 | ||||
-rw-r--r-- | src/mir_app/src/srmm_log_hpp.cpp | 2 |
14 files changed, 76 insertions, 42 deletions
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h index 767fbe3d13..8f824846dc 100644 --- a/include/m_srmm_int.h +++ b/include/m_srmm_int.h @@ -103,6 +103,7 @@ MIR_APP_DLL(void) Srmm_ClickToolbarIcon(MCONTACT hContact, int idFrom, HWND hwnd // SRMM log window container
class CMsgDialog;
+struct LOGINFO;
class MIR_APP_EXPORT CSrmmLogWindow
{
@@ -112,7 +113,7 @@ class MIR_APP_EXPORT CSrmmLogWindow protected:
CMsgDialog &m_pDlg;
- CSrmmLogWindow(CMsgDialog &pDlg) :
+ __forceinline CSrmmLogWindow(CMsgDialog &pDlg) :
m_pDlg(pDlg)
{}
@@ -128,14 +129,14 @@ public: virtual HWND GetHwnd() = 0;
virtual wchar_t* GetSelection() = 0;
virtual void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) = 0;
- virtual void LogEvents(const struct LOGINFO *lin) = 0;
+ virtual void LogChatEvents(const LOGINFO *lin) = 0;
virtual void Resize() = 0;
virtual void ScrollToBottom() = 0;
virtual void UpdateOptions() {};
virtual INT_PTR Notify(WPARAM, LPARAM) { return 0; }
- __inline CMsgDialog& GetDialog() const
+ __forceinline CMsgDialog& GetDialog() const
{ return m_pDlg;
}
};
@@ -146,6 +147,24 @@ MIR_APP_DLL(HANDLE) RegisterSrmmLog(CMPlugin *pPlugin, const char *pszShortName, MIR_APP_DLL(void) UnregisterSrmmLog(HANDLE);
/////////////////////////////////////////////////////////////////////////////////////////
+// Simple single-event based logger
+
+class MIR_APP_EXPORT CSimpleLogWindow : public CSrmmLogWindow
+{
+ CSimpleLogWindow(const CSimpleLogWindow &) = delete;
+ CSimpleLogWindow &operator=(const CSimpleLogWindow &) = delete;
+
+ void LogChatEvents(const struct LOGINFO *lin) override;
+
+protected:
+ __forceinline CSimpleLogWindow(CMsgDialog &pDlg) :
+ CSrmmLogWindow(pDlg)
+ {}
+
+ virtual void LogChatEvent(const LOGINFO &lin) = 0;
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Standard built-in RTF logger class
struct RtfLogStreamBase
@@ -300,6 +319,7 @@ public: CTimer timerFlash, timerType, timerNickList, timerRedraw;
void ClearLog();
+ bool IsSuitableEvent(const LOGINFO &lin) const;
void RedrawLog();
void ScheduleRedrawLog();
void ShowColorChooser(int iCtrlId);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex e0077abe30..fa6af1650c 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex b57b969b2e..23b88a96d5 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/IEView/src/ieview_logger.cpp b/plugins/IEView/src/ieview_logger.cpp index 5ab19373d0..20391f34a3 100644 --- a/plugins/IEView/src/ieview_logger.cpp +++ b/plugins/IEView/src/ieview_logger.cpp @@ -27,13 +27,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// // CIeviewLogWindow class -class CIeviewLogWindow : public CSrmmLogWindow +class CIeviewLogWindow : public CSimpleLogWindow { HWND m_hwnd = nullptr; public: CIeviewLogWindow(CMsgDialog &pDlg) : - CSrmmLogWindow(pDlg) + CSimpleLogWindow(pDlg) { } @@ -105,7 +105,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////// - void LogEvent(const LOGINFO *lin) + void LogChatEvent(const LOGINFO &lin) override { IEVIEWEVENTDATA ied = {}; ied.dwFlags = IEEDF_UNICODE_NICK; @@ -118,12 +118,12 @@ public: event.eventData = &ied; event.count = 1; - ied.szNick.w = lin->ptszNick; - ied.szText.w = lin->ptszText; - ied.time = lin->time; - ied.bIsMe = lin->bIsMe; + ied.szNick.w = lin.ptszNick; + ied.szText.w = lin.ptszText; + ied.time = lin.time; + ied.bIsMe = lin.bIsMe; - switch (lin->iType) { + switch (lin.iType) { case GC_EVENT_MESSAGE: ied.iType = IEED_GC_EVENT_MESSAGE; ied.dwData = IEEDD_GC_SHOW_NICK; @@ -167,19 +167,7 @@ public: ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; HandleIEEvent(0, LPARAM(&event)); } - - void LogEvents(const LOGINFO *lin) override - { - if (lin == nullptr) { - for (auto &it : m_pDlg.getChat()->arEvents) - LogEvent(it); - } - else LogEvent(lin); - - if (lin) - ScrollToBottom(); - } - + void Resize() override { RECT rcRichEdit; diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp index 35f3b47c97..8c9775706b 100644 --- a/plugins/NewStory/src/history_log.cpp +++ b/plugins/NewStory/src/history_log.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" -class CNewStoryLogWindow : public CSrmmLogWindow +class CNewStoryLogWindow : public CSimpleLogWindow { HWND m_hwnd = nullptr; public: CNewStoryLogWindow(CMsgDialog &pDlg) : - CSrmmLogWindow(pDlg) + CSimpleLogWindow(pDlg) { } @@ -60,13 +60,9 @@ public: SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0); } - void LogEvents(const LOGINFO *lin) override + void LogChatEvent(const LOGINFO &lin) override { - if (lin == nullptr) { - for (auto &it: m_pDlg.getChat()->arEvents) - SendMessage(m_hwnd, NSM_ADDCHATEVENT, (WPARAM)m_pDlg.getChat(), (LPARAM)it); - } - else SendMessage(m_hwnd, NSM_ADDCHATEVENT, (WPARAM)m_pDlg.getChat(), (LPARAM)lin); + SendMessage(m_hwnd, NSM_ADDCHATEVENT, (WPARAM)m_pDlg.getChat(), (LPARAM)&lin); } void Resize() override diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 5cc9a73cb5..4901a9f1fb 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -662,7 +662,7 @@ public: ////////////////////////////////////////////////////////////////////////////////////////
- void LogEvents(const LOGINFO *lin) override
+ void LogChatEvents(const LOGINFO *lin) override
{
if (m_rtf.GetHwnd() == nullptr)
return;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 8e3a2fab60..b5fc4ca97a 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1235,7 +1235,7 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend, DB::Ev /////////////////////////////////////////////////////////////////////////////////////////
-void CLogWindow::LogEvents(const LOGINFO *lin)
+void CLogWindow::LogChatEvents(const LOGINFO *lin)
{
if (m_rtf.GetHwnd() == nullptr)
return;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 1bd350f520..4aef4ccf63 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -692,7 +692,7 @@ public: void AppendUnicodeString(CMStringA &str, const wchar_t *pwszBuf) override;
void Attach() override;
void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override;
- void LogEvents(const LOGINFO *lin) override;
+ void LogChatEvents(const LOGINFO *lin) override;
void ScrollToBottom() override;
void UpdateOptions() override;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index be2b6aef3a..7daad7b64e 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -492,7 +492,7 @@ public: /////////////////////////////////////////////////////////////////////////////////////////
- void LogEvents(const LOGINFO *lin) override
+ void LogChatEvents(const LOGINFO *lin) override
{
auto *si = m_pDlg.getChat();
bool bRedraw = lin == nullptr;
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index 91895d3046..5891173849 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -140,7 +140,7 @@ static DWORD CALLBACK ChatLogStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, L LBL_Next:
if (dat->idx < events.getCount()) {
auto &lin = events[dat->idx];
- if (si->iType == GCW_SERVER || (si->pDlg->m_iLogFilterFlags & lin.iType) != 0)
+ if (si->pDlg->IsSuitableEvent(lin))
dat->pLog->CreateChatRtfEvent(dat, lin);
dat->idx++;
if (dat->buf.IsEmpty())
@@ -419,3 +419,18 @@ void FreeMsgLogBitmaps(void) for (int i = 0; i < _countof(pLogIconBmpBits); i++)
mir_free(pLogIconBmpBits[i]);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CSimpleLogWindow::LogChatEvents(const struct LOGINFO *lin)
+{
+ if (lin == nullptr) {
+ for (auto &it : m_pDlg.getChat()->arEvents)
+ if (m_pDlg.IsSuitableEvent(*it))
+ LogChatEvent(*it);
+ }
+ else LogChatEvent(*lin);
+
+ if (lin)
+ ScrollToBottom();
+}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index e9772a9c25..b0cd5e4020 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -890,3 +890,8 @@ Clist_GroupSaveExpanded @1003 NONAME ?Proto_GetContactInstance@@YGPAUPROTO_INTERFACE@@I@Z @1007 NONAME
?complete@FILE_BLOB@DB@@QAEX_J@Z @1008 NONAME
?setName@FILE_BLOB@DB@@QAEXPB_W@Z @1009 NONAME
+??0CSimpleLogWindow@@IAE@AAVCMsgDialog@@@Z @1010 NONAME
+??1CSimpleLogWindow@@UAE@XZ @1011 NONAME
+??_7CSimpleLogWindow@@6B@ @1012 NONAME
+?IsSuitableEvent@CSrmmBaseDialog@@QBE_NABULOGINFO@@@Z @1013 NONAME
+?LogChatEvents@CSimpleLogWindow@@EAEXPBULOGINFO@@@Z @1014 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 81ce7fd596..c5cbd85268 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -890,3 +890,8 @@ Clist_GroupSaveExpanded @1003 NONAME ?Proto_GetContactInstance@@YAPEAUPROTO_INTERFACE@@I@Z @1007 NONAME
?complete@FILE_BLOB@DB@@QEAAX_J@Z @1008 NONAME
?setName@FILE_BLOB@DB@@QEAAXPEB_W@Z @1009 NONAME
+??0CSimpleLogWindow@@IEAA@AEAVCMsgDialog@@@Z @1010 NONAME
+??1CSimpleLogWindow@@UEAA@XZ @1011 NONAME
+??_7CSimpleLogWindow@@6B@ @1012 NONAME
+?IsSuitableEvent@CSrmmBaseDialog@@QEBA_NAEBULOGINFO@@@Z @1013 NONAME
+?LogChatEvents@CSimpleLogWindow@@EEAAXPEBULOGINFO@@@Z @1014 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 34f57f0b16..1279950097 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -614,8 +614,8 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) void CSrmmBaseDialog::AddLog(const LOGINFO &lin)
{
- if (m_si->iType == GCW_SERVER || (m_iLogFilterFlags & lin.iType))
- m_pLog->LogEvents(&lin);
+ if (IsSuitableEvent(lin))
+ m_pLog->LogChatEvents(&lin);
}
bool CSrmmBaseDialog::AllowTyping() const
@@ -628,6 +628,11 @@ void CSrmmBaseDialog::ClearLog() m_pLog->Clear();
}
+bool CSrmmBaseDialog::IsSuitableEvent(const LOGINFO &lin) const
+{
+ return (m_si->iType == GCW_SERVER || (m_iLogFilterFlags & lin.iType));
+}
+
void CSrmmBaseDialog::UpdateOptions()
{
MODULEINFO *mi = m_si->pMI;
@@ -650,7 +655,7 @@ void CSrmmBaseDialog::RedrawLog() m_si->LastTime = 0;
if (m_si->arEvents.getCount())
- m_pLog->LogEvents(nullptr);
+ m_pLog->LogChatEvents(nullptr);
else
ClearLog();
}
@@ -706,7 +711,7 @@ void CSrmmBaseDialog::UpdateChatLog() }
m_si->bHistoryInit = true;
- m_pLog->LogEvents(nullptr);
+ m_pLog->LogChatEvents(nullptr);
}
void CSrmmBaseDialog::UpdateFilterButton()
diff --git a/src/mir_app/src/srmm_log_hpp.cpp b/src/mir_app/src/srmm_log_hpp.cpp index 9a70d495a7..9e9e65a86f 100644 --- a/src/mir_app/src/srmm_log_hpp.cpp +++ b/src/mir_app/src/srmm_log_hpp.cpp @@ -179,7 +179,7 @@ public: CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
}
- void LogEvents(const LOGINFO *lin) override
+ void LogChatEvents(const LOGINFO *lin) override
{
if (lin == nullptr) {
for (auto &it : m_pDlg.getChat()->arEvents)
|