diff options
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/chat_log.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 28 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 4 |
4 files changed, 18 insertions, 22 deletions
diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp index 49e573aed3..a5e18db220 100644 --- a/plugins/TabSRMM/src/chat_log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -296,7 +296,7 @@ void CLogWindow::CreateChatRtfEvent(RtfChatLogStreamData *streamData, const LOGI SESSION_INFO *si = streamData->si;
CMStringA &str = streamData->buf;
- if (streamData->iStartEvent != 0)
+ if (streamData->idx != 0)
str.Append("\\par ");
if (m_pDlg.m_bDividerWanted) {
@@ -304,7 +304,7 @@ void CLogWindow::CreateChatRtfEvent(RtfChatLogStreamData *streamData, const LOGI if (szStyle_div[0] == 0)
mir_snprintf(szStyle_div, "\\f%u\\cf%u\\ul0\\b%d\\i%d\\fs%u", 17, 18, 0, 0, 5);
- if (streamData->iStartEvent != si->arEvents.getCount() - 1 || !streamData->bAppend)
+ if (streamData->idx != si->arEvents.getCount()-1 || !streamData->bRedraw)
str.AppendFormat("\\qc\\sl-1\\highlight%d %s ---------------------------------------------------------------------------------------\\par ", 18, szStyle_div);
m_pDlg.m_bDividerWanted = false;
}
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 5043f45e8d..b04236acfb 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -41,7 +41,7 @@ void CMsgDialog::ActivateTooltip(int iCtrlId, const wchar_t *pwszMessage) /////////////////////////////////////////////////////////////////////////////////////////
-void CMsgDialog::AddLog()
+void CMsgDialog::AddLog(const LOGINFO &lin)
{
if (g_plugin.bUseDividers) {
if (g_plugin.bDividersUsePopupConfig) {
@@ -56,7 +56,7 @@ void CMsgDialog::AddLog() }
}
- CSuper::AddLog();
+ CSuper::AddLog(lin);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 89cd3e7d34..04045292b2 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1226,21 +1226,20 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend, DB::Ev /////////////////////////////////////////////////////////////////////////////////////////
-void CLogWindow::LogEvents(SESSION_INFO *si, int iStart, bool bAppend)
+void CLogWindow::LogEvents(const LOGINFO *lin)
{
- if (m_rtf.GetHwnd() == nullptr || si == nullptr)
+ if (m_rtf.GetHwnd() == nullptr)
return;
- auto &lin = si->arEvents[iStart];
- if (!bAppend && m_pDlg.AllowTyping() && !(m_pDlg.m_iLogFilterFlags & lin.iType))
- return;
+ auto si = m_pDlg.getChat();
+ bool bRedraw = lin == nullptr;
bool bFlag = false, bDoReplace, bAtBottom = AtBottom();
RtfChatLogStreamData streamData;
streamData.pLog = this;
streamData.si = si;
- streamData.iStartEvent = iStart;
+ streamData.lin = lin;
streamData.bStripFormat = FALSE;
POINT point = { 0 };
@@ -1258,13 +1257,10 @@ void CLogWindow::LogEvents(SESSION_INFO *si, int iStart, bool bAppend) // fix for the indent... must be a M$ bug
if (sel.cpMax == 0)
- bAppend = TRUE;
-
- // should the event(s) be appended to the current log
- WPARAM wp = bAppend ? SF_RTF : SFF_SELECTION | SF_RTF;
+ bRedraw = TRUE;
// get the number of pixels per logical inch
- if (bAppend) {
+ if (bRedraw) {
HDC hdc = GetDC(nullptr);
g_chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
g_chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
@@ -1273,16 +1269,16 @@ void CLogWindow::LogEvents(SESSION_INFO *si, int iStart, bool bAppend) bFlag = true;
}
- StreamChatRtfEvents(&streamData, bAppend);
+ StreamChatRtfEvents(&streamData, bRedraw);
// for new added events, only replace in message or action events.
// no need to replace smileys or math formulas elsewhere
- bDoReplace = (bAppend || (lin.ptszText && (lin.iType == GC_EVENT_MESSAGE || lin.iType == GC_EVENT_ACTION)));
+ bDoReplace = (bRedraw || (lin && lin->ptszText && (lin->iType == GC_EVENT_MESSAGE || lin->iType == GC_EVENT_ACTION)));
// replace marked nicknames with hyperlinks to make the nicks clickable
if (g_Settings.bClickableNicks) {
FINDTEXTEX fi, fi2;
- fi.chrg.cpMin = bAppend ? 0 : sel.cpMin;
+ fi.chrg.cpMin = bRedraw ? 0 : sel.cpMin;
fi.chrg.cpMax = -1;
fi.lpstrText = CLICKNICK_BEGIN;
@@ -1326,7 +1322,7 @@ void CLogWindow::LogEvents(SESSION_INFO *si, int iStart, bool bAppend) SMADD_RICHEDIT3 sm = { sizeof(sm) };
sm.hwndRichEditControl = m_rtf.GetHwnd();
sm.Protocolname = si->pszModule;
- sm.rangeToReplace = bAppend ? nullptr : &newsel;
+ sm.rangeToReplace = bRedraw ? nullptr : &newsel;
sm.disableRedraw = TRUE;
sm.hContact = si->hContact;
CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm);
@@ -1350,7 +1346,7 @@ void CLogWindow::LogEvents(SESSION_INFO *si, int iStart, bool bAppend) }
// scroll log to bottom if the log was previously scrolled to bottom, else restore old position
- if (bAppend || bAtBottom)
+ if (bRedraw || bAtBottom)
ScrollToBottom(false, false);
else
m_rtf.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&point);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 439f506308..69582f562d 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -593,7 +593,7 @@ public: LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override;
- void AddLog() override;
+ void AddLog(const LOGINFO &lin) override;
void CloseTab() override;
void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override;
void EventAdded(MEVENT, const DB::EventInfo &dbei) override;
@@ -696,7 +696,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(SESSION_INFO *si, int iStart, bool) override;
+ void LogEvents(const LOGINFO *lin) override;
void ScrollToBottom() override;
void UpdateOptions() override;
|