summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/IEView/src/ieview_logger.cpp113
-rw-r--r--plugins/NewStory/src/history_log.cpp9
-rw-r--r--plugins/Scriver/src/msglog.cpp31
-rw-r--r--plugins/TabSRMM/src/chat_log.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp4
-rw-r--r--plugins/TabSRMM/src/msglog.cpp28
-rw-r--r--plugins/TabSRMM/src/msgs.h4
7 files changed, 102 insertions, 91 deletions
diff --git a/plugins/IEView/src/ieview_logger.cpp b/plugins/IEView/src/ieview_logger.cpp
index 6f613882c2..5ab19373d0 100644
--- a/plugins/IEView/src/ieview_logger.cpp
+++ b/plugins/IEView/src/ieview_logger.cpp
@@ -103,7 +103,9 @@ public:
HandleIEEvent(0, LPARAM(&event));
}
- void LogEvents(SESSION_INFO *si, int iStart, bool bRedraw) override
+ ////////////////////////////////////////////////////////////////////////////////////////
+
+ void LogEvent(const LOGINFO *lin)
{
IEVIEWEVENTDATA ied = {};
ied.dwFlags = IEEDF_UNICODE_NICK;
@@ -116,60 +118,65 @@ public:
event.eventData = &ied;
event.count = 1;
- for (int i = iStart; i < si->arEvents.getCount(); i++) {
- auto &lin = si->arEvents[i];
-
- ied.szNick.w = lin.ptszNick;
- ied.szText.w = lin.ptszText;
- ied.time = lin.time;
- ied.bIsMe = lin.bIsMe;
-
- switch (lin.iType) {
- case GC_EVENT_MESSAGE:
- ied.iType = IEED_GC_EVENT_MESSAGE;
- ied.dwData = IEEDD_GC_SHOW_NICK;
- break;
- case GC_EVENT_ACTION:
- ied.iType = IEED_GC_EVENT_ACTION;
- break;
- case GC_EVENT_JOIN:
- ied.iType = IEED_GC_EVENT_JOIN;
- break;
- case GC_EVENT_PART:
- ied.iType = IEED_GC_EVENT_PART;
- break;
- case GC_EVENT_QUIT:
- ied.iType = IEED_GC_EVENT_QUIT;
- break;
- case GC_EVENT_NICK:
- ied.iType = IEED_GC_EVENT_NICK;
- break;
- case GC_EVENT_KICK:
- ied.iType = IEED_GC_EVENT_KICK;
- break;
- case GC_EVENT_NOTICE:
- ied.iType = IEED_GC_EVENT_NOTICE;
- break;
- case GC_EVENT_TOPIC:
- ied.iType = IEED_GC_EVENT_TOPIC;
- break;
- case GC_EVENT_INFORMATION:
- ied.iType = IEED_GC_EVENT_INFORMATION;
- break;
- case GC_EVENT_ADDSTATUS:
- ied.iType = IEED_GC_EVENT_ADDSTATUS;
- break;
- case GC_EVENT_REMOVESTATUS:
- ied.iType = IEED_GC_EVENT_REMOVESTATUS;
- break;
- }
-
- ied.dwData |= IEEDD_GC_SHOW_TIME | IEEDD_GC_SHOW_ICON;
- ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
- HandleIEEvent(0, LPARAM(&event));
+ ied.szNick.w = lin->ptszNick;
+ ied.szText.w = lin->ptszText;
+ ied.time = lin->time;
+ ied.bIsMe = lin->bIsMe;
+
+ switch (lin->iType) {
+ case GC_EVENT_MESSAGE:
+ ied.iType = IEED_GC_EVENT_MESSAGE;
+ ied.dwData = IEEDD_GC_SHOW_NICK;
+ break;
+ case GC_EVENT_ACTION:
+ ied.iType = IEED_GC_EVENT_ACTION;
+ break;
+ case GC_EVENT_JOIN:
+ ied.iType = IEED_GC_EVENT_JOIN;
+ break;
+ case GC_EVENT_PART:
+ ied.iType = IEED_GC_EVENT_PART;
+ break;
+ case GC_EVENT_QUIT:
+ ied.iType = IEED_GC_EVENT_QUIT;
+ break;
+ case GC_EVENT_NICK:
+ ied.iType = IEED_GC_EVENT_NICK;
+ break;
+ case GC_EVENT_KICK:
+ ied.iType = IEED_GC_EVENT_KICK;
+ break;
+ case GC_EVENT_NOTICE:
+ ied.iType = IEED_GC_EVENT_NOTICE;
+ break;
+ case GC_EVENT_TOPIC:
+ ied.iType = IEED_GC_EVENT_TOPIC;
+ break;
+ case GC_EVENT_INFORMATION:
+ ied.iType = IEED_GC_EVENT_INFORMATION;
+ break;
+ case GC_EVENT_ADDSTATUS:
+ ied.iType = IEED_GC_EVENT_ADDSTATUS;
+ break;
+ case GC_EVENT_REMOVESTATUS:
+ ied.iType = IEED_GC_EVENT_REMOVESTATUS;
+ break;
+ }
+
+ ied.dwData |= IEEDD_GC_SHOW_TIME | IEEDD_GC_SHOW_ICON;
+ 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 (bRedraw)
+ if (lin)
ScrollToBottom();
}
diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp
index 87b0b7fc9d..35f3b47c97 100644
--- a/plugins/NewStory/src/history_log.cpp
+++ b/plugins/NewStory/src/history_log.cpp
@@ -60,10 +60,13 @@ public:
SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0);
}
- void LogEvents(SESSION_INFO *si, int iStart, bool) override
+ void LogEvents(const LOGINFO *lin) override
{
- for (int i=iStart; i < si->arEvents.getCount(); i++)
- SendMessage(m_hwnd, NSM_ADDCHATEVENT, (WPARAM)m_pDlg.getChat(), (LPARAM)&si->arEvents[i]);
+ 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);
}
void Resize() override
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index cf5d714c83..8715878381 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -318,6 +318,8 @@ public:
m_rtf.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
}
+ ////////////////////////////////////////////////////////////////////////////////////////
+
void CreateRtfHeader(RtfLogStreamData *streamData) override
{
HDC hdc = GetDC(nullptr);
@@ -355,6 +357,8 @@ public:
buf.Append("}");
}
+ ////////////////////////////////////////////////////////////////////////////////////////
+
bool CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbei) override
{
if (!DbEventIsShown(dbei))
@@ -549,6 +553,8 @@ public:
return true;
}
+ ////////////////////////////////////////////////////////////////////////////////////////
+
void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override
{
if (!bAppend)
@@ -643,21 +649,20 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
- void LogEvents(SESSION_INFO *si, int iStart, bool bAppend) override
+ void LogEvents(const LOGINFO *lin) override
{
- if (m_rtf.GetHwnd() == nullptr || si == nullptr)
+ if (m_rtf.GetHwnd() == nullptr)
return;
- auto &lin = si->arEvents[iStart];
- if (!bAppend && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && !(m_pDlg.m_iLogFilterFlags & lin.iType))
- return;
+ auto *si = m_pDlg.getChat();
+ bool bRedraw = lin == nullptr;
RtfChatLogStreamData streamData;
streamData.pLog = this;
streamData.si = si;
- streamData.iStartEvent = iStart;
+ streamData.lin = lin;
streamData.bStripFormat = FALSE;
- streamData.bIsFirst = bAppend ? 1 : m_rtf.GetRichTextLength() == 0;
+ streamData.bIsFirst = bRedraw ? 1 : m_rtf.GetRichTextLength() == 0;
SCROLLINFO scroll;
scroll.cbSize = sizeof(SCROLLINFO);
@@ -680,20 +685,20 @@ public:
// fix for the indent... must be a M$ bug
if (sel.cpMax == 0)
- bAppend = TRUE;
+ bRedraw = TRUE;
// get the number of pixels per logical inch
bool bFlag = false;
- if (bAppend) {
+ if (bRedraw) {
m_rtf.SetDraw(false);
bFlag = true;
}
// stream in the event(s)
- StreamChatRtfEvents(&streamData, bAppend);
+ StreamChatRtfEvents(&streamData, bRedraw);
// do smileys
- if (g_dat.smileyAddInstalled && (bAppend || (lin.ptszText && lin.iType != GC_EVENT_JOIN && lin.iType != GC_EVENT_NICK && lin.iType != GC_EVENT_ADDSTATUS && lin.iType != GC_EVENT_REMOVESTATUS))) {
+ if (g_dat.smileyAddInstalled && (bRedraw || (lin && lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) {
newsel.cpMax = -1;
newsel.cpMin = sel.cpMin;
if (newsel.cpMin < 0)
@@ -702,7 +707,7 @@ public:
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.flags = 0;
sm.disableRedraw = TRUE;
sm.hContact = m_pDlg.m_hContact;
@@ -710,7 +715,7 @@ public:
}
// scroll log to bottom if the log was previously scrolled to bottom, else restore old position
- if (bAppend || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)
+ if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)
ScrollToBottom();
else
m_rtf.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&point);
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;