summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h28
-rw-r--r--libs/win32/mir_app.libbin106654 -> 106740 bytes
-rw-r--r--libs/win64/mir_app.libbin102060 -> 102150 bytes
-rw-r--r--plugins/Scriver/src/chat/chat.h1
-rw-r--r--plugins/Scriver/src/chat/log.cpp56
-rw-r--r--plugins/Scriver/src/chat/window.cpp86
-rw-r--r--plugins/Scriver/src/msgs.cpp4
-rw-r--r--plugins/Scriver/src/msgs.h4
-rw-r--r--plugins/TabSRMM/src/chat_log.cpp13
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp3
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp20
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp114
-rw-r--r--plugins/TabSRMM/src/msgs.cpp4
-rw-r--r--plugins/TabSRMM/src/msgs.h3
-rw-r--r--src/core/stdmsg/src/chat_util.cpp52
-rw-r--r--src/core/stdmsg/src/chat_window.cpp85
-rw-r--r--src/core/stdmsg/src/stdafx.h3
-rw-r--r--src/mir_app/src/chat_log.cpp91
-rw-r--r--src/mir_app/src/chat_svc.cpp12
-rw-r--r--src/mir_app/src/colorchooser.cpp10
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/srmm_base.cpp25
23 files changed, 310 insertions, 308 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index c8d9c9bc27..1b28c454ab 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -178,10 +178,6 @@ struct GCSessionInfoBase
{
MCONTACT hContact;
- bool bFGSet;
- bool bBGSet;
- bool bFilterEnabled;
- bool bNicklistEnabled;
bool bInitDone;
bool bHasToolTip;
bool bTrimmed;
@@ -193,9 +189,6 @@ struct GCSessionInfoBase
wchar_t* ptszTopic;
int iType;
- int iFG;
- int iBG;
- int iLogFilterFlags;
int nUsersInNicklist;
int iEventCount;
int iWidth;
@@ -211,15 +204,12 @@ struct GCSessionInfoBase
int currentHovered;
CChatRoomDlg *pDlg;
- COMMANDINFO* lpCommands;
- COMMANDINFO* lpCurrentCommand;
- LOGINFO* pLog;
- LOGINFO* pLogEnd;
- USERINFO* pUsers;
- USERINFO* pMe;
- STATUSINFO* pStatuses;
-
- wchar_t pszLogFileName[MAX_PATH];
+ COMMANDINFO *lpCommands, *lpCurrentCommand;
+ LOGINFO *pLog, *pLogEnd;
+ USERINFO *pUsers, *pMe;
+ STATUSINFO *pStatuses;
+
+ wchar_t pszLogFileName[MAX_PATH];
};
struct GCLogStreamDataBase
@@ -430,7 +420,7 @@ class MIR_APP_EXPORT CSrmmBaseDialog : public CDlgBase
{
protected:
- CSrmmBaseDialog(HINSTANCE hInst, int idDialog);
+ CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si = nullptr);
protected:
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -441,6 +431,10 @@ protected:
public:
MCONTACT m_hContact;
+ int m_iLogFilterFlags;
+ bool m_bFilterEnabled, m_bNicklistEnabled;
+ bool m_bFGSet, m_bBGSet;
+ COLORREF m_iFG, m_iBG;
__forceinline bool isChat() const { return m_si != nullptr; }
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 37217195ba..1af7147fb5 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index adc426b0eb..c67e4b17a4 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index c742adcb6d..ca620576f1 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -70,7 +70,6 @@ extern GlobalLogSettings g_Settings;
void UpgradeCheck(void);
// log.c
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw);
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp
index ded37a01bc..0499847dac 100644
--- a/plugins/Scriver/src/chat/log.cpp
+++ b/plugins/Scriver/src/chat/log.cpp
@@ -25,25 +25,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EM_GETSCROLLPOS (WM_USER+221)
#endif
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw)
+void CChatRoomDlg::Log_StreamInEvent(LOGINFO* lin, BOOL bRedraw)
{
- if (hwndDlg == 0 || lin == 0 || si == 0)
+ if (m_hwnd == nullptr || lin == nullptr || m_si == nullptr)
return;
- if (!bRedraw && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && si->bFilterEnabled && !(si->iLogFilterFlags & lin->iType))
+ if (!bRedraw && (m_si->iType == GCW_CHATROOM || m_si->iType == GCW_PRIVMESS) && m_bFilterEnabled && !(m_iLogFilterFlags & lin->iType))
return;
BOOL bFlag = FALSE;
- HWND hwndRich = GetDlgItem(hwndDlg, IDC_LOG);
-
LOGSTREAMDATA streamData;
memset(&streamData, 0, sizeof(streamData));
- streamData.hwnd = hwndRich;
- streamData.si = si;
+ streamData.hwnd = m_log.GetHwnd();
+ streamData.si = m_si;
streamData.lin = lin;
streamData.bStripFormat = FALSE;
- streamData.isFirst = bRedraw ? 1 : (GetRichTextLength(hwndRich, CP_ACP, FALSE) == 0);
+ streamData.isFirst = bRedraw ? 1 : (GetRichTextLength(m_log.GetHwnd(), CP_ACP, FALSE) == 0);
EDITSTREAM stream = { 0 };
stream.pfnCallback = Srmm_LogStreamCallback;
@@ -52,21 +50,21 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra
SCROLLINFO scroll;
scroll.cbSize = sizeof(SCROLLINFO);
scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
- GetScrollInfo(hwndRich, SB_VERT, &scroll);
+ GetScrollInfo(m_log.GetHwnd(), SB_VERT, &scroll);
POINT point = { 0 };
- SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point);
+ m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&point);
// do not scroll to bottom if there is a selection
CHARRANGE oldsel, sel, newsel;
- SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&oldsel);
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldsel);
if (oldsel.cpMax != oldsel.cpMin)
- SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
+ m_log.SendMsg(WM_SETREDRAW, FALSE, 0);
// set the insertion point at the bottom
- sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel);
- SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&sel);
+ sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd(), CP_ACP, FALSE);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
// fix for the indent... must be a M$ bug
if (sel.cpMax == 0)
@@ -77,14 +75,14 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra
// get the number of pixels per logical inch
if (bRedraw) {
- SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
+ m_log.SendMsg(WM_SETREDRAW, FALSE, 0);
bFlag = TRUE;
}
// stream in the event(s)
streamData.lin = lin;
streamData.bRedraw = bRedraw;
- SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM)&stream);
+ m_log.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream);
// do smileys
if (g_dat.smileyAddInstalled && (bRedraw || (lin->ptszText &&
@@ -96,33 +94,33 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra
newsel.cpMin = 0;
SMADD_RICHEDIT3 sm = { sizeof(sm) };
- sm.hwndRichEditControl = hwndRich;
- sm.Protocolname = si->pszModule;
+ sm.hwndRichEditControl = m_log.GetHwnd();
+ sm.Protocolname = m_si->pszModule;
sm.rangeToReplace = bRedraw ? nullptr : &newsel;
sm.flags = 0;
sm.disableRedraw = TRUE;
- sm.hContact = si->hContact;
+ sm.hContact = m_hContact;
CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm);
}
// scroll log to bottom if the log was previously scrolled to bottom, else restore old position
if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)
- SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0);
+ SendMessage(GetParent(m_log.GetHwnd()), GC_SCROLLTOBOTTOM, 0, 0);
else
- SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM)&point);
+ m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&point);
// do we need to restore the selection
if (oldsel.cpMax != oldsel.cpMin) {
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel);
- SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwndRich, nullptr, TRUE);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel);
+ m_log.SendMsg(WM_SETREDRAW, TRUE, 0);
+ InvalidateRect(m_log.GetHwnd(), nullptr, TRUE);
}
// need to invalidate the window
if (bFlag) {
- sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel);
- SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwndRich, nullptr, TRUE);
+ sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd(), CP_ACP, FALSE);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ m_log.SendMsg(WM_SETREDRAW, TRUE, 0);
+ InvalidateRect(m_log.GetHwnd(), nullptr, TRUE);
}
}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 9731065f73..b1f3bad9ad 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -304,8 +304,8 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w
u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
if (index >= 0) {
- si->bFGSet = true;
- si->iFG = index;
+ pDlg->m_bFGSet = true;
+ pDlg->m_iFG = index;
}
if (u == BST_UNCHECKED && cf.crTextColor != cr)
@@ -320,8 +320,8 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w
u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR);
if (index >= 0) {
- si->bBGSet = TRUE;
- si->iBG = index;
+ pDlg->m_bBGSet = TRUE;
+ pDlg->m_iBG = index;
}
if (u == BST_UNCHECKED && cf.crBackColor != crB)
CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, BST_CHECKED);
@@ -371,23 +371,23 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w
return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
-static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static SESSION_INFO *si = nullptr;
+ static CChatRoomDlg *pDlg = nullptr;
switch (uMsg) {
case WM_INITDIALOG:
- si = (SESSION_INFO *)lParam;
- CheckDlgButton(hwndDlg, IDC_CHAT_1, si->iLogFilterFlags & GC_EVENT_ACTION ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_2, si->iLogFilterFlags & GC_EVENT_MESSAGE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_3, si->iLogFilterFlags & GC_EVENT_NICK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_4, si->iLogFilterFlags & GC_EVENT_JOIN ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_5, si->iLogFilterFlags & GC_EVENT_PART ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_6, si->iLogFilterFlags & GC_EVENT_TOPIC ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_7, si->iLogFilterFlags & GC_EVENT_ADDSTATUS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_8, si->iLogFilterFlags & GC_EVENT_INFORMATION ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_9, si->iLogFilterFlags & GC_EVENT_QUIT ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_10, si->iLogFilterFlags & GC_EVENT_KICK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHAT_11, si->iLogFilterFlags & GC_EVENT_NOTICE ? BST_CHECKED : BST_UNCHECKED);
+ pDlg = (CChatRoomDlg*)lParam;
+ CheckDlgButton(hwndDlg, IDC_CHAT_1, pDlg->m_iLogFilterFlags & GC_EVENT_ACTION ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_2, pDlg->m_iLogFilterFlags & GC_EVENT_MESSAGE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_3, pDlg->m_iLogFilterFlags & GC_EVENT_NICK ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_4, pDlg->m_iLogFilterFlags & GC_EVENT_JOIN ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_5, pDlg->m_iLogFilterFlags & GC_EVENT_PART ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_6, pDlg->m_iLogFilterFlags & GC_EVENT_TOPIC ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_7, pDlg->m_iLogFilterFlags & GC_EVENT_ADDSTATUS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_8, pDlg->m_iLogFilterFlags & GC_EVENT_INFORMATION ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_9, pDlg->m_iLogFilterFlags & GC_EVENT_QUIT ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_10, pDlg->m_iLogFilterFlags & GC_EVENT_KICK ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHAT_11, pDlg->m_iLogFilterFlags & GC_EVENT_NOTICE ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_CTLCOLOREDIT:
@@ -426,9 +426,9 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
- SendMessage(si->pDlg->GetHwnd(), GC_CHANGEFILTERFLAG, 0, iFlags);
- if (si->bFilterEnabled)
- SendMessage(si->pDlg->GetHwnd(), GC_REDRAWLOG, 0, 0);
+ SendMessage(pDlg->GetHwnd(), GC_CHANGEFILTERFLAG, 0, iFlags);
+ if (pDlg->m_bFilterEnabled)
+ SendMessage(pDlg->GetHwnd(), GC_REDRAWLOG, 0, 0);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
break;
@@ -802,7 +802,7 @@ static void __cdecl phase2(void *lParam)
void CChatRoomDlg::MessageDialogResize(int w, int h)
{
- bool bNick = m_si->iType != GCW_SERVER && m_si->bNicklistEnabled;
+ bool bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled;
bool bToolbar = SendMessage(m_hwndParent, CM_GETTOOLBARSTATUS, 0, 0) != 0;
int hSplitterMinTop = TOOLBAR_HEIGHT + m_minLogBoxHeight, hSplitterMinBottom = m_minEditBoxHeight;
int toolbarHeight = bToolbar ? TOOLBAR_HEIGHT : 0;
@@ -814,7 +814,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h)
ShowWindow(m_splitterX.GetHwnd(), bNick ? SW_SHOW : SW_HIDE);
if (m_si->iType != GCW_SERVER)
- ShowWindow(m_nickList.GetHwnd(), m_si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
+ ShowWindow(m_nickList.GetHwnd(), m_bNicklistEnabled ? SW_SHOW : SW_HIDE);
else
ShowWindow(m_nickList.GetHwnd(), SW_HIDE);
@@ -862,7 +862,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h)
}
CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
- : CScriverWindow(IDD_CHANNEL),
+ : CScriverWindow(IDD_CHANNEL, si),
m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
@@ -882,10 +882,8 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
m_btnShowList(this, IDC_SHOWNICKLIST),
m_btnUnderline(this, IDC_UNDERLINE)
{
- m_si = si;
m_pLog = &m_log;
m_pEntry = &m_message;
- m_hContact = si->hContact;
m_btnOk.OnClick = Callback(this, &CChatRoomDlg::onClick_Ok);
m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::onClick_Filter);
@@ -1103,8 +1101,8 @@ void CChatRoomDlg::onClick_ShowList(CCtrlButton *pButton)
if (!pButton->Enabled() || m_si->iType == GCW_SERVER)
return;
- m_si->bNicklistEnabled = !m_si->bNicklistEnabled;
- pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
+ m_bNicklistEnabled = !m_bNicklistEnabled;
+ pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
SendMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
@@ -1114,9 +1112,9 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton)
if (!pButton->Enabled())
return;
- m_si->bFilterEnabled = !m_si->bFilterEnabled;
- pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
- if (m_si->bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ m_bFilterEnabled = !m_bFilterEnabled;
+ pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2"));
+ if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
else
SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
@@ -1158,9 +1156,9 @@ void CChatRoomDlg::onClick_Color(CCtrlButton *pButton)
if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) {
if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR);
- else if (m_si->bFGSet) {
+ else if (m_bFGSet) {
cf.dwMask = CFM_COLOR;
- cf.crTextColor = pInfo->crColors[m_si->iFG];
+ cf.crTextColor = pInfo->crColors[m_iFG];
if (pInfo->bSingleFormat)
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
else
@@ -1192,9 +1190,9 @@ void CChatRoomDlg::onClick_BkColor(CCtrlButton *pButton)
if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) {
if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR);
- else if (m_si->bBGSet) {
+ else if (m_bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pInfo->crColors[m_si->iBG];
+ cf.crBackColor = pInfo->crColors[m_iBG];
if (pInfo->bSingleFormat)
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
else
@@ -1229,8 +1227,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (uMsg) {
case GC_SETWNDPROPS:
- m_btnShowList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
- m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
+ m_btnShowList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
+ m_btnFilter.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_bFilterEnabled ? "chat_filter" : "chat_filter2"));
{
MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
if (pInfo) {
@@ -1370,13 +1368,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
pLog = pLog->next;
- if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_si->bFilterEnabled || (m_si->iLogFilterFlags&pLog->iType) != 0)
+ if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_bFilterEnabled || (m_iLogFilterFlags & pLog->iType) != 0)
index++;
}
- Log_StreamInEvent(m_hwnd, pLog, m_si, TRUE);
+ Log_StreamInEvent(pLog, TRUE);
mir_forkthread(phase2, m_si);
}
- else Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ else Log_StreamInEvent(m_si->pLogEnd, TRUE);
}
else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
@@ -1384,12 +1382,12 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case GC_REDRAWLOG2:
m_si->LastTime = 0;
if (m_si->pLog)
- Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ Log_StreamInEvent(m_si->pLogEnd, TRUE);
break;
case GC_ADDLOG:
if (m_si->pLogEnd)
- Log_StreamInEvent(m_hwnd, m_si->pLog, m_si, FALSE);
+ Log_StreamInEvent(m_si->pLog, FALSE);
else
SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
@@ -1612,12 +1610,12 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
case GC_CHANGEFILTERFLAG:
- m_si->iLogFilterFlags = lParam;
+ m_iLogFilterFlags = lParam;
break;
case GC_SHOWFILTERMENU:
{
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)m_si);
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)this);
TranslateDialogDefault(hwnd);
GetWindowRect(m_btnFilter.GetHwnd(), &rc);
SetWindowPos(hwnd, HWND_TOP, rc.left - 85, (IsWindowVisible(m_btnFilter.GetHwnd()) || IsWindowVisible(m_btnBold.GetHwnd())) ? rc.top - 206 : rc.top - 186, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 2292031904..ba4bd65404 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -360,8 +360,8 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// CScriverWindow
-CScriverWindow::CScriverWindow(int iDialog)
- : CSrmmBaseDialog(g_hInst, iDialog)
+CScriverWindow::CScriverWindow(int iDialog, SESSION_INFO *si)
+ : CSrmmBaseDialog(g_hInst, iDialog, si)
{
m_autoClose = CLOSE_ON_CANCEL;
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index e7b9e57086..03ae1eee12 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -88,7 +88,7 @@ struct ParentWindowData
class CScriverWindow : public CSrmmBaseDialog
{
protected:
- CScriverWindow(int iDialog);
+ CScriverWindow(int iDialog, SESSION_INFO* = nullptr);
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -174,10 +174,12 @@ class CChatRoomDlg : public CScriverWindow
CSplitter m_splitterX, m_splitterY;
void MessageDialogResize(int w, int h);
+ void Log_StreamInEvent(LOGINFO* lin, BOOL bRedraw);
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
public:
wchar_t m_wszSearch[255];
diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp
index e598846f4d..26884a7ed8 100644
--- a/plugins/TabSRMM/src/chat_log.cpp
+++ b/plugins/TabSRMM/src/chat_log.cpp
@@ -700,6 +700,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
{
LOGINFO *lin = streamData->lin;
MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
+ SESSION_INFO *si = streamData->si;
// ### RTF HEADER
@@ -716,7 +717,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
// ### RTF BODY (one iteration per event that should be streamed in)
while (lin) {
// filter
- if ((streamData->si->iType != GCW_CHATROOM && streamData->si->iType != GCW_PRIVMESS) || !streamData->si->bFilterEnabled || (streamData->si->iLogFilterFlags & lin->iType) != 0) {
+ if ((si->iType != GCW_CHATROOM && si->iType != GCW_PRIVMESS) || !si->pDlg->m_bFilterEnabled || (si->pDlg->m_iLogFilterFlags & lin->iType) != 0) {
if (lin->next != nullptr)
str.Append("\\par ");
@@ -773,9 +774,9 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
wchar_t szTimeStamp[30], szOldTimeStamp[30];
wcsncpy_s(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), _TRUNCATE);
- wcsncpy_s(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), _TRUNCATE);
- if (!g_Settings.bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
- streamData->si->LastTime = lin->time;
+ wcsncpy_s(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, si->LastTime), _TRUNCATE);
+ if (!g_Settings.bShowTimeIfChanged || si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
+ si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, str, L"%s", szTimeStamp);
}
str.Append("\\tab ");
@@ -787,7 +788,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
int crNickIndex = 0;
if (g_Settings.bLogClassicIndicators || g_Settings.bColorizeNicksInLog)
- pszIndicator[0] = GetIndicator(streamData->si, lin->ptszNick, &crNickIndex);
+ pszIndicator[0] = GetIndicator(si, lin->ptszNick, &crNickIndex);
str.Append(pci->Log_SetStyle(lin->bIsMe ? 2 : 1));
str.AppendChar(' ');
@@ -848,7 +849,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw)
streamData.bStripFormat = FALSE;
streamData.dat = this;
- if (!bRedraw && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && si->bFilterEnabled && (si->iLogFilterFlags & lin->iType) == 0)
+ if (!bRedraw && (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS) && m_bFilterEnabled && (m_iLogFilterFlags & lin->iType) == 0)
return;
bool bFlag = false, fDoReplace;
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index bac02dec6b..ab6fe6b62f 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -39,9 +39,6 @@ TMUCSettings g_Settings;
static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi)
{
- si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0)) != 0;
-
- Chat_SetFilters(si);
if (mi) {
mi->idleTimeStamp = time(0);
pci->SM_BroadcastMessage(mi->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE);
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index f0233278df..75d08d6aa3 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -610,18 +610,18 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex)
*/
void Chat_SetFilters(SESSION_INFO *si)
{
- if (si == nullptr)
- return;
-
DWORD dwFlags_default = M.GetDword(CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
DWORD dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0);
- si->iLogFilterFlags = dwFlags_default;
- for (int i = 0; i < 32; i++) {
- DWORD dwBit = 1 << i;
- if (dwMask & dwBit)
- si->iLogFilterFlags = (dwFlags_local & dwBit) ? si->iLogFilterFlags | dwBit : si->iLogFilterFlags & ~dwBit;
+ CChatRoomDlg *pDlg = si->pDlg;
+ if (pDlg) {
+ pDlg->m_iLogFilterFlags = dwFlags_default;
+ for (int i = 0; i < 32; i++) {
+ DWORD dwBit = 1 << i;
+ if (dwMask & dwBit)
+ pDlg->m_iLogFilterFlags = (dwFlags_local & dwBit) ? pDlg->m_iLogFilterFlags | dwBit : pDlg->m_iLogFilterFlags & ~dwBit;
+ }
}
dwFlags_default = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
@@ -648,8 +648,8 @@ void Chat_SetFilters(SESSION_INFO *si)
si->iLogTrayFlags = (dwFlags_local & dwBit) ? si->iLogTrayFlags | dwBit : si->iLogTrayFlags & ~dwBit;
}
- if (si->iLogFilterFlags == 0)
- si->bFilterEnabled = false;
+ if (pDlg != nullptr && pDlg->m_iLogFilterFlags == 0)
+ pDlg->m_bFilterEnabled = 0;
}
char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex)
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 6e10dedfe5..8e588f8c2f 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -253,7 +253,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc)
{
bool bToolbar = !(m_pContainer->dwFlags & CNT_HIDETOOLBAR);
bool bBottomToolbar = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0;
- bool bNick = m_si->iType != GCW_SERVER && m_si->bNicklistEnabled;
+ bool bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled;
bool bInfoPanel = m_pPanel.isActive();
int panelHeight = m_pPanel.getHeight() + 1;
int iSplitterX = m_pContainer->settings->iSplitterX;
@@ -265,8 +265,8 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc)
Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, SW_HIDE);
if (m_si->iType != GCW_SERVER) {
- Utils::showDlgControl(m_hwnd, IDC_LIST, m_si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, m_si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_hwnd, IDC_LIST, m_bNicklistEnabled ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, m_bNicklistEnabled ? SW_SHOW : SW_HIDE);
m_btnNickList.Enable(true);
m_btnFilter.Enable(true);
@@ -868,8 +868,8 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w
UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
if (index >= 0) {
- mwdat->m_si->bFGSet = true;
- mwdat->m_si->iFG = index;
+ mwdat->m_bFGSet = true;
+ mwdat->m_iFG = index;
}
if (u == BST_UNCHECKED && cf.crTextColor != cr)
@@ -884,8 +884,8 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w
UINT u = IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR);
if (index >= 0) {
- mwdat->m_si->bBGSet = true;
- mwdat->m_si->iBG = index;
+ mwdat->m_bBGSet = true;
+ mwdat->m_iBG = index;
}
if (u == BST_UNCHECKED && cf.crBackColor != crB)
@@ -965,22 +965,22 @@ static UINT _eventorder[] =
GC_EVENT_NOTICE
};
-static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
- si = (SESSION_INFO*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
+ pDlg = (CChatRoomDlg*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
{
- DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0);
- DWORD dwFlags = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", 0);
+ DWORD dwMask = db_get_dw(pDlg->m_hContact, CHAT_MODULE, "FilterMask", 0);
+ DWORD dwFlags = db_get_dw(pDlg->m_hContact, CHAT_MODULE, "FilterFlags", 0);
- DWORD dwPopupMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0);
- DWORD dwPopupFlags = db_get_dw(si->hContact, CHAT_MODULE, "PopupFlags", 0);
+ DWORD dwPopupMask = db_get_dw(pDlg->m_hContact, CHAT_MODULE, "PopupMask", 0);
+ DWORD dwPopupFlags = db_get_dw(pDlg->m_hContact, CHAT_MODULE, "PopupFlags", 0);
- DWORD dwTrayMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0);
- DWORD dwTrayFlags = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", 0);
+ DWORD dwTrayMask = db_get_dw(pDlg->m_hContact, CHAT_MODULE, "TrayIconMask", 0);
+ DWORD dwTrayFlags = db_get_dw(pDlg->m_hContact, CHAT_MODULE, "TrayIconFlags", 0);
for (int i = 0; i < _countof(_eventorder); i++) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwMask & _eventorder[i] ? (dwFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
@@ -1007,17 +1007,17 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
}
- if (iFlags&GC_EVENT_ADDSTATUS)
+ if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
- if (si) {
+ if (pDlg) {
if (dwMask == 0) {
- db_unset(si->hContact, CHAT_MODULE, "FilterFlags");
- db_unset(si->hContact, CHAT_MODULE, "FilterMask");
+ db_unset(pDlg->m_hContact, CHAT_MODULE, "FilterFlags");
+ db_unset(pDlg->m_hContact, CHAT_MODULE, "FilterMask");
}
else {
- db_set_dw(si->hContact, CHAT_MODULE, "FilterFlags", iFlags);
- db_set_dw(si->hContact, CHAT_MODULE, "FilterMask", dwMask);
+ db_set_dw(pDlg->m_hContact, CHAT_MODULE, "FilterFlags", iFlags);
+ db_set_dw(pDlg->m_hContact, CHAT_MODULE, "FilterMask", dwMask);
}
}
@@ -1032,14 +1032,14 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
- if (si) {
+ if (pDlg) {
if (dwMask == 0) {
- db_unset(si->hContact, CHAT_MODULE, "PopupFlags");
- db_unset(si->hContact, CHAT_MODULE, "PopupMask");
+ db_unset(pDlg->m_hContact, CHAT_MODULE, "PopupFlags");
+ db_unset(pDlg->m_hContact, CHAT_MODULE, "PopupMask");
}
else {
- db_set_dw(si->hContact, CHAT_MODULE, "PopupFlags", iFlags);
- db_set_dw(si->hContact, CHAT_MODULE, "PopupMask", dwMask);
+ db_set_dw(pDlg->m_hContact, CHAT_MODULE, "PopupFlags", iFlags);
+ db_set_dw(pDlg->m_hContact, CHAT_MODULE, "PopupMask", dwMask);
}
}
@@ -1053,19 +1053,19 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
- if (si) {
+ if (pDlg) {
if (dwMask == 0) {
- db_unset(si->hContact, CHAT_MODULE, "TrayIconFlags");
- db_unset(si->hContact, CHAT_MODULE, "TrayIconMask");
+ db_unset(pDlg->m_hContact, CHAT_MODULE, "TrayIconFlags");
+ db_unset(pDlg->m_hContact, CHAT_MODULE, "TrayIconMask");
}
else {
- db_set_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", iFlags);
- db_set_dw(si->hContact, CHAT_MODULE, "TrayIconMask", dwMask);
+ db_set_dw(pDlg->m_hContact, CHAT_MODULE, "TrayIconFlags", iFlags);
+ db_set_dw(pDlg->m_hContact, CHAT_MODULE, "TrayIconMask", dwMask);
}
- Chat_SetFilters(si);
- SendMessage(si->pDlg->GetHwnd(), GC_CHANGEFILTERFLAG, 0, iFlags);
- if (si->bFilterEnabled)
- SendMessage(si->pDlg->GetHwnd(), GC_REDRAWLOG, 0, 0);
+ Chat_SetFilters(pDlg->m_si);
+ SendMessage(pDlg->GetHwnd(), GC_CHANGEFILTERFLAG, 0, iFlags);
+ if (pDlg->m_bFilterEnabled)
+ SendMessage(pDlg->GetHwnd(), GC_REDRAWLOG, 0, 0);
}
}
DestroyWindow(hwndDlg);
@@ -1520,7 +1520,7 @@ static void __cdecl phase2(void * lParam)
// which is usually a (tabbed) child of a container class window.
CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
- : CTabBaseDlg(IDD_CHANNEL),
+ : CTabBaseDlg(IDD_CHANNEL, si),
m_btnOk(this, IDOK),
m_list(this, IDC_LIST),
m_btnBold(this, IDC_BOLD),
@@ -1533,9 +1533,9 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
m_btnUnderline(this, IDC_UNDERLINE),
m_btnNickList(this, IDC_SHOWNICKLIST)
{
- m_si = si;
- m_hContact = si->hContact;
- m_szProto = GetContactProto(si->hContact);
+ m_szProto = GetContactProto(m_hContact);
+ m_bFilterEnabled = db_get_b(m_hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled) != 0;
+ Chat_SetFilters(m_si);
m_btnOk.OnClick = Callback(this, &CChatRoomDlg::OnClick_OK);
m_btnFilter.OnClick = Callback(this, &CChatRoomDlg::OnClick_Filter);
@@ -1767,22 +1767,22 @@ void CChatRoomDlg::OnClick_Filter(CCtrlButton *pButton)
if (!pButton->Enabled())
return;
- if (m_si->iLogFilterFlags == 0 && !m_si->bFilterEnabled) {
+ if (m_iLogFilterFlags == 0 && !m_bFilterEnabled) {
MessageBox(0, TranslateT("The filter cannot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK);
- m_si->bFilterEnabled = false;
+ m_bFilterEnabled = false;
}
- else m_si->bFilterEnabled = !m_si->bFilterEnabled;
+ else m_bFilterEnabled = !m_bFilterEnabled;
m_btnFilter.SendMsg(BUTTONSETOVERLAYICON,
- (LPARAM)(m_si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
+ (LPARAM)(m_bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
- if (m_si->bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) {
+ if (m_bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) {
SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
return;
}
SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0);
- db_set_b(m_si->hContact, CHAT_MODULE, "FilterEnabled", (BYTE)m_si->bFilterEnabled);
+ db_set_b(m_si->hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled);
}
void CChatRoomDlg::OnClick_History(CCtrlButton *pButton)
@@ -1808,7 +1808,7 @@ void CChatRoomDlg::OnClick_ShowNickList(CCtrlButton *pButton)
if (m_si->iType == GCW_SERVER)
return;
- m_si->bNicklistEnabled = !m_si->bNicklistEnabled;
+ m_bNicklistEnabled = !m_bNicklistEnabled;
SendMessage(m_hwnd, WM_SIZE, 0, 0);
if (CSkin::m_skinEnabled)
@@ -1854,9 +1854,9 @@ void CChatRoomDlg::OnClick_Color(CCtrlButton *pButton)
if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) {
if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR);
- else if (m_si->bFGSet) {
+ else if (m_bFGSet) {
cf.dwMask = CFM_COLOR;
- cf.crTextColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_si->iFG];
+ cf.crTextColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_iFG];
m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
@@ -1881,9 +1881,9 @@ void CChatRoomDlg::OnClick_BkColor(CCtrlButton *pButton)
if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) {
if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR);
- else if (m_si->bBGSet) {
+ else if (m_bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_si->iBG];
+ cf.crBackColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_iBG];
m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
@@ -1991,7 +1991,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
m_list.SetItemHeight(0, g_Settings.iNickListFontHeight);
InvalidateRect(m_list.GetHwnd(), nullptr, TRUE);
- m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
+ m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0);
SendMessage(m_hwnd, WM_SIZE, 0, 0);
SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0);
break;
@@ -2017,7 +2017,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus);
mir_snwprintf(szTemp,
(m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user%s)") : TranslateT("%s: chat room (%u users%s)"),
- szNick, m_si->nUsersInNicklist, m_si->bFilterEnabled ? TranslateT(", event filter active") : L"");
+ szNick, m_si->nUsersInNicklist, m_bFilterEnabled ? TranslateT(", event filter active") : L"");
break;
case GCW_PRIVMESS:
hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus);
@@ -2162,7 +2162,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (pLog->next == nullptr)
break;
pLog = pLog->next;
- if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_si->bFilterEnabled || (m_si->iLogFilterFlags&pLog->iType) != 0)
+ if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_bFilterEnabled || (m_iLogFilterFlags & pLog->iType) != 0)
index++;
}
StreamInEvents(pLog, m_si, TRUE);
@@ -2470,12 +2470,12 @@ LABEL_SHOWWINDOW:
break;
case GC_CHANGEFILTERFLAG:
- if (m_si->iLogFilterFlags == 0 && m_si->bFilterEnabled)
+ if (m_iLogFilterFlags == 0 && m_bFilterEnabled)
SendMessage(m_hwnd, WM_COMMAND, IDC_FILTER, 0);
break;
case GC_SHOWFILTERMENU:
- m_hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_pContainer->hwnd, FilterWndProc, (LPARAM)m_si);
+ m_hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_pContainer->hwnd, FilterWndProc, (LPARAM)this);
TranslateDialogDefault(m_hwndFilter);
RECT rcFilter;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index cd20c73006..d2b5330478 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -118,8 +118,8 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// basic window class
-CTabBaseDlg::CTabBaseDlg(int iResource)
- : CSrmmBaseDialog(g_hInst, iResource),
+CTabBaseDlg::CTabBaseDlg(int iResource, SESSION_INFO *si)
+ : CSrmmBaseDialog(g_hInst, iResource, si),
m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
m_pPanel(this),
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index d1213b9395..e2e8960a26 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -353,7 +353,7 @@ public:
char *m_enteredText;
public:
- CTabBaseDlg(int iDialogId);
+ CTabBaseDlg(int iDialogId, SESSION_INFO* = nullptr);
virtual ~CTabBaseDlg() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -468,6 +468,7 @@ class CChatRoomDlg : public CTabBaseDlg
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
virtual CThumbBase* CreateThumb(CProxyWindow *pProxy) const override;
virtual void ClearLog() override;
diff --git a/src/core/stdmsg/src/chat_util.cpp b/src/core/stdmsg/src/chat_util.cpp
index b9a44e45f6..f4d514d635 100644
--- a/src/core/stdmsg/src/chat_util.cpp
+++ b/src/core/stdmsg/src/chat_util.cpp
@@ -21,20 +21,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw)
+void CChatRoomDlg::Log_StreamInEvent(LOGINFO *lin, BOOL bRedraw)
{
- if (hwndDlg == 0 || lin == 0 || si == 0)
+ if (m_hwnd == nullptr || lin == nullptr || m_si == nullptr)
return;
- if (!bRedraw && si->iType == GCW_CHATROOM && si->bFilterEnabled && (si->iLogFilterFlags & lin->iType) == 0)
+ if (!bRedraw && m_si->iType == GCW_CHATROOM && m_bFilterEnabled && (m_iLogFilterFlags & lin->iType) == 0)
return;
- HWND hwndRich = GetDlgItem(hwndDlg, IDC_LOG);
-
LOGSTREAMDATA streamData;
memset(&streamData, 0, sizeof(streamData));
- streamData.hwnd = hwndRich;
- streamData.si = si;
+ streamData.hwnd = m_log.GetHwnd();
+ streamData.si = m_si;
streamData.lin = lin;
streamData.bStripFormat = FALSE;
@@ -47,20 +45,20 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra
SCROLLINFO scroll;
scroll.cbSize = sizeof(SCROLLINFO);
scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
- GetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &scroll);
+ GetScrollInfo(m_log.GetHwnd(), SB_VERT, &scroll);
POINT point = {};
- SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point);
+ SendMessage(m_log.GetHwnd(), EM_GETSCROLLPOS, 0, (LPARAM)&point);
// do not scroll to bottom if there is a selection
CHARRANGE oldsel, sel;
- SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&oldsel);
+ SendMessage(m_log.GetHwnd(), EM_EXGETSEL, 0, (LPARAM)&oldsel);
if (oldsel.cpMax != oldsel.cpMin)
- SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
+ SendMessage(m_log.GetHwnd(), WM_SETREDRAW, FALSE, 0);
//set the insertion point at the bottom
- sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel);
+ sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd());
+ SendMessage(m_log.GetHwnd(), EM_EXSETSEL, 0, (LPARAM)&sel);
// fix for the indent... must be a M$ bug
if (sel.cpMax == 0)
@@ -75,14 +73,14 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra
pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
ReleaseDC(NULL, hdc);
- SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0);
+ SendMessage(m_log.GetHwnd(), WM_SETREDRAW, FALSE, 0);
bFlag = TRUE;
}
// stream in the event(s)
streamData.lin = lin;
streamData.bRedraw = bRedraw;
- SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM)&stream);
+ SendMessage(m_log.GetHwnd(), EM_STREAMIN, wp, (LPARAM)&stream);
// do smileys
if (SmileyAddInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) {
@@ -94,33 +92,33 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra
SMADD_RICHEDIT3 sm = {};
sm.cbSize = sizeof(sm);
- sm.hwndRichEditControl = hwndRich;
- sm.Protocolname = si->pszModule;
+ sm.hwndRichEditControl = m_log.GetHwnd();
+ sm.Protocolname = m_si->pszModule;
sm.rangeToReplace = bRedraw ? NULL : &newsel;
sm.disableRedraw = TRUE;
- sm.hContact = si->hContact;
+ sm.hContact = m_si->hContact;
CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm);
}
// scroll log to bottom if the log was previously scrolled to bottom, else restore old position
if (bRedraw || (UINT)scroll.nPos >= (UINT)scroll.nMax - scroll.nPage - 5 || scroll.nMax - scroll.nMin - scroll.nPage < 50)
- SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0);
+ SendMessage(GetParent(m_log.GetHwnd()), GC_SCROLLTOBOTTOM, 0, 0);
else
- SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM)&point);
+ SendMessage(m_log.GetHwnd(), EM_SETSCROLLPOS, 0, (LPARAM)&point);
// do we need to restore the selection
if (oldsel.cpMax != oldsel.cpMin) {
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel);
- SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwndRich, NULL, TRUE);
+ SendMessage(m_log.GetHwnd(), EM_EXSETSEL, 0, (LPARAM)&oldsel);
+ SendMessage(m_log.GetHwnd(), WM_SETREDRAW, TRUE, 0);
+ InvalidateRect(m_log.GetHwnd(), NULL, TRUE);
}
// need to invalidate the window
if (bFlag) {
- sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel);
- SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(hwndRich, NULL, TRUE);
+ sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd());
+ SendMessage(m_log.GetHwnd(), EM_EXSETSEL, 0, (LPARAM)&sel);
+ SendMessage(m_log.GetHwnd(), WM_SETREDRAW, TRUE, 0);
+ InvalidateRect(m_log.GetHwnd(), NULL, TRUE);
}
}
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index cf7cf376ac..7292b9aa00 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -42,7 +42,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc)
BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1);
BOOL bToolbar = bFormat || bControl;
BOOL bSend = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowSend", 0);
- BOOL bNick = si->iType != GCW_SERVER && si->bNicklistEnabled;
+ BOOL bNick = si->iType != GCW_SERVER && m_bNicklistEnabled;
switch (urc->wId) {
case IDOK:
@@ -95,6 +95,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
{
MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
HWND hwndDlg = GetParent(hwnd);
+ CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE sel;
switch (msg) {
@@ -494,8 +495,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
UINT u = IsDlgButtonChecked(hwndDlg, IDC_COLOR);
if (index >= 0) {
- dat->si->bFGSet = true;
- dat->si->iFG = index;
+ pDlg->m_bFGSet = true;
+ pDlg->m_iFG = index;
}
if (u == BST_UNCHECKED && cf.crTextColor != g_Settings.MessageAreaColor)
@@ -510,8 +511,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
UINT u = IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR);
if (index >= 0) {
- dat->si->bBGSet = TRUE;
- dat->si->iBG = index;
+ pDlg->m_bBGSet = TRUE;
+ pDlg->m_iBG = index;
}
if (u == BST_UNCHECKED && cf.crBackColor != crB)
CheckDlgButton(hwndDlg, IDC_BKGCOLOR, BST_CHECKED);
@@ -559,23 +560,23 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
-static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static SESSION_INFO *si = NULL;
+ static CChatRoomDlg *pDlg = NULL;
switch (uMsg) {
case WM_INITDIALOG:
- si = (SESSION_INFO*)lParam;
- CheckDlgButton(hwndDlg, IDC_1, si->iLogFilterFlags & GC_EVENT_ACTION ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_2, si->iLogFilterFlags & GC_EVENT_MESSAGE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_3, si->iLogFilterFlags & GC_EVENT_NICK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_4, si->iLogFilterFlags & GC_EVENT_JOIN ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_5, si->iLogFilterFlags & GC_EVENT_PART ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_6, si->iLogFilterFlags & GC_EVENT_TOPIC ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_7, si->iLogFilterFlags & GC_EVENT_ADDSTATUS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_8, si->iLogFilterFlags & GC_EVENT_INFORMATION ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_9, si->iLogFilterFlags & GC_EVENT_QUIT ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_10, si->iLogFilterFlags & GC_EVENT_KICK ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_11, si->iLogFilterFlags & GC_EVENT_NOTICE ? BST_CHECKED : BST_UNCHECKED);
+ pDlg = (CChatRoomDlg*)lParam;
+ CheckDlgButton(hwndDlg, IDC_1, pDlg->m_iLogFilterFlags & GC_EVENT_ACTION ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_2, pDlg->m_iLogFilterFlags & GC_EVENT_MESSAGE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_3, pDlg->m_iLogFilterFlags & GC_EVENT_NICK ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_4, pDlg->m_iLogFilterFlags & GC_EVENT_JOIN ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_5, pDlg->m_iLogFilterFlags & GC_EVENT_PART ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_6, pDlg->m_iLogFilterFlags & GC_EVENT_TOPIC ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_7, pDlg->m_iLogFilterFlags & GC_EVENT_ADDSTATUS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_8, pDlg->m_iLogFilterFlags & GC_EVENT_INFORMATION ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_9, pDlg->m_iLogFilterFlags & GC_EVENT_QUIT ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_10, pDlg->m_iLogFilterFlags & GC_EVENT_KICK ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_11, pDlg->m_iLogFilterFlags & GC_EVENT_NOTICE ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_CTLCOLOREDIT:
@@ -615,7 +616,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
iFlags |= GC_EVENT_REMOVESTATUS;
SendMessage(GetParent(hwndDlg), GC_CHANGEFILTERFLAG, 0, iFlags);
- if (si->bFilterEnabled)
+ if (pDlg->m_bFilterEnabled)
SendMessage(GetParent(hwndDlg), GC_REDRAWLOG, 0, 0);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
@@ -826,7 +827,7 @@ static void __cdecl phase2(void * lParam)
/////////////////////////////////////////////////////////////////////////////////////////
CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) :
- CSrmmBaseDialog(g_hInst, g_Settings.bTabsEnable ? IDD_CHANNEL_TAB : IDD_CHANNEL),
+ CSrmmBaseDialog(g_hInst, g_Settings.bTabsEnable ? IDD_CHANNEL_TAB : IDD_CHANNEL, si),
m_nickList(this, IDC_LIST),
m_message(this, IDC_MESSAGE),
m_log(this, IDC_LOG),
@@ -848,10 +849,8 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) :
m_splitterX(this, IDC_SPLITTERX),
m_splitterY(this, IDC_SPLITTERY)
{
- m_si = si;
m_pLog = &m_log;
m_pEntry = &m_message;
- m_hContact = si->hContact;
m_autoClose = 0;
m_forceResizable = true;
@@ -972,9 +971,9 @@ void CChatRoomDlg::OnClick_Color(CCtrlButton *pButton)
if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) {
if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR);
- else if (m_si->bFGSet) {
+ else if (m_bFGSet) {
cf.dwMask = CFM_COLOR;
- cf.crTextColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_si->iFG];
+ cf.crTextColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_iFG];
SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
@@ -997,9 +996,9 @@ void CChatRoomDlg::OnClick_BkColor(CCtrlButton *pButton)
if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) {
if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR);
- else if (m_si->bBGSet) {
+ else if (m_bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_si->iBG];
+ cf.crBackColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_iBG];
SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
@@ -1015,9 +1014,9 @@ void CChatRoomDlg::OnClick_Filter(CCtrlButton *pButton)
if (!pButton->Enabled())
return;
- m_si->bFilterEnabled = !m_si->bFilterEnabled;
- SendDlgItemMessage(m_hwnd, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_si->bFilterEnabled ? "filter" : "filter2", FALSE));
- if (m_si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ m_bFilterEnabled = !m_bFilterEnabled;
+ SendDlgItemMessage(m_hwnd, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bFilterEnabled ? "filter" : "filter2", FALSE));
+ if (m_bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
else
SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
@@ -1038,8 +1037,8 @@ void CChatRoomDlg::OnClick_NickList(CCtrlButton *pButton)
if (!pButton->Enabled() || m_si->iType == GCW_SERVER)
return;
- m_si->bNicklistEnabled = !m_si->bNicklistEnabled;
- pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
+ m_bNicklistEnabled = !m_bNicklistEnabled;
+ pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
SendMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
SendMessage(m_hwnd, WM_SIZE, 0, 0);
@@ -1207,8 +1206,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (uMsg) {
case GC_SETWNDPROPS:
- SendDlgItemMessage(m_hwnd, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_si->bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
- SendDlgItemMessage(m_hwnd, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_si->bFilterEnabled ? "filter" : "filter2", FALSE));
+ SendDlgItemMessage(m_hwnd, IDC_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bNicklistEnabled ? "nicklist" : "nicklist2", FALSE));
+ SendDlgItemMessage(m_hwnd, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bFilterEnabled ? "filter" : "filter2", FALSE));
{
MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
EnableWindow(m_btnBold.GetHwnd(), mi->bBold);
@@ -1325,7 +1324,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1);
BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1);
BOOL bSend = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowSend", 0);
- BOOL bNick = m_si->iType != GCW_SERVER && m_si->bNicklistEnabled;
+ BOOL bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled;
ShowWindow(m_btnBold.GetHwnd(), bFormat ? SW_SHOW : SW_HIDE);
ShowWindow(m_btnItalic.GetHwnd(), bFormat ? SW_SHOW : SW_HIDE);
@@ -1340,7 +1339,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
ShowWindow(m_btnOk.GetHwnd(), bSend ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
if (m_si->iType != GCW_SERVER)
- ShowWindow(m_nickList.GetHwnd(), m_si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
+ ShowWindow(m_nickList.GetHwnd(), m_bNicklistEnabled ? SW_SHOW : SW_HIDE);
else
ShowWindow(m_nickList.GetHwnd(), SW_HIDE);
@@ -1381,13 +1380,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
pLog = pLog->next;
- if (m_si->iType != GCW_CHATROOM || !m_si->bFilterEnabled || (m_si->iLogFilterFlags&pLog->iType) != 0)
+ if (m_si->iType != GCW_CHATROOM || !m_bFilterEnabled || (m_iLogFilterFlags&pLog->iType) != 0)
index++;
}
- Log_StreamInEvent(m_hwnd, pLog, m_si, TRUE);
+ Log_StreamInEvent(pLog, TRUE);
mir_forkthread(phase2, m_si);
}
- else Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ else Log_StreamInEvent(m_si->pLogEnd, TRUE);
}
else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
@@ -1395,12 +1394,12 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case GC_REDRAWLOG2:
m_si->LastTime = 0;
if (m_si->pLog)
- Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ Log_StreamInEvent(m_si->pLogEnd, TRUE);
break;
case GC_ADDLOG:
if (m_si->pLogEnd)
- Log_StreamInEvent(m_hwnd, m_si->pLog, m_si, FALSE);
+ Log_StreamInEvent(m_si->pLog, FALSE);
else
SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
@@ -1572,12 +1571,12 @@ LABEL_SHOWWINDOW:
return 0;
case GC_CHANGEFILTERFLAG:
- m_si->iLogFilterFlags = lParam;
+ m_iLogFilterFlags = lParam;
break;
case GC_SHOWFILTERMENU:
{
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)m_si);
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)this);
TranslateDialogDefault(hwnd);
GetWindowRect(m_btnFilter.GetHwnd(), &rc);
SetWindowPos(hwnd, HWND_TOP, rc.left - 85, (IsWindowVisible(m_btnFilter.GetHwnd()) || IsWindowVisible(m_btnBold.GetHwnd())) ? rc.top - 206 : rc.top - 186, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index f15624007b..b18ac615ae 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -173,6 +173,8 @@ class CChatRoomDlg : public CSrmmBaseDialog
{
friend struct CTabbedWindow;
+ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
HWND m_hwndStatus;
CCtrlEdit m_message, m_log;
@@ -186,6 +188,7 @@ class CChatRoomDlg : public CSrmmBaseDialog
{ return (g_Settings.bTabsEnable) ? GetParent(m_hwndParent) : m_hwnd;
}
+ void Log_StreamInEvent(LOGINFO *lin, BOOL bRedraw);
void SaveWindowPosition(bool bUpdateSession);
void SetWindowPosition();
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index 9faa8c85a4..2a7ab9234f 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -191,36 +191,38 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, bool simpleMode, CMStringA &
static void AddEventToBuffer(CMStringA &buf, LOGSTREAMDATA *streamData)
{
+ LOGINFO *lin = streamData->lin;
+
wchar_t szTemp[512], szTemp2[512];
wchar_t* pszNick = NULL;
- if (streamData->lin->ptszNick) {
- if (g_Settings->bLogLimitNames && mir_wstrlen(streamData->lin->ptszNick) > 20) {
- mir_wstrncpy(szTemp2, streamData->lin->ptszNick, 20);
+ if (lin->ptszNick) {
+ if (g_Settings->bLogLimitNames && mir_wstrlen(lin->ptszNick) > 20) {
+ mir_wstrncpy(szTemp2, lin->ptszNick, 20);
mir_wstrncpy(szTemp2 + 20, L"...", 4);
}
- else mir_wstrncpy(szTemp2, streamData->lin->ptszNick, 511);
+ else mir_wstrncpy(szTemp2, lin->ptszNick, 511);
- if (streamData->lin->ptszUserInfo)
- mir_snwprintf(szTemp, L"%s (%s)", szTemp2, streamData->lin->ptszUserInfo);
+ if (lin->ptszUserInfo)
+ mir_snwprintf(szTemp, L"%s (%s)", szTemp2, lin->ptszUserInfo);
else
wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
}
- switch (streamData->lin->iType) {
+ switch (lin->iType) {
case GC_EVENT_MESSAGE:
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, false, buf, L"%s", streamData->lin->ptszText);
+ if (lin->ptszText)
+ Log_AppendRTF(streamData, false, buf, L"%s", lin->ptszText);
break;
case GC_EVENT_ACTION:
- if (streamData->lin->ptszNick && streamData->lin->ptszText) {
- Log_AppendRTF(streamData, true, buf, L"%s ", streamData->lin->ptszNick);
- Log_AppendRTF(streamData, false, buf, L"%s", streamData->lin->ptszText);
+ if (lin->ptszNick && lin->ptszText) {
+ Log_AppendRTF(streamData, true, buf, L"%s ", lin->ptszNick);
+ Log_AppendRTF(streamData, false, buf, L"%s", lin->ptszText);
}
break;
case GC_EVENT_JOIN:
if (pszNick) {
- if (!streamData->lin->bIsMe)
+ if (!lin->bIsMe)
Log_AppendRTF(streamData, true, buf, TranslateT("%s has joined"), pszNick);
else
Log_AppendRTF(streamData, false, buf, TranslateT("You have joined %s"), streamData->si->ptszName);
@@ -229,54 +231,54 @@ static void AddEventToBuffer(CMStringA &buf, LOGSTREAMDATA *streamData)
case GC_EVENT_PART:
if (pszNick)
Log_AppendRTF(streamData, true, buf, TranslateT("%s has left"), pszNick);
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, true, buf, L": %s", streamData->lin->ptszText);
+ if (lin->ptszText)
+ Log_AppendRTF(streamData, true, buf, L": %s", lin->ptszText);
break;
case GC_EVENT_QUIT:
if (pszNick)
Log_AppendRTF(streamData, true, buf, TranslateT("%s has disconnected"), pszNick);
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, false, buf, L": %s", streamData->lin->ptszText);
+ if (lin->ptszText)
+ Log_AppendRTF(streamData, false, buf, L": %s", lin->ptszText);
break;
case GC_EVENT_NICK:
- if (pszNick && streamData->lin->ptszText) {
- if (!streamData->lin->bIsMe)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
+ if (pszNick && lin->ptszText) {
+ if (!lin->bIsMe)
+ Log_AppendRTF(streamData, true, buf, TranslateT("%s is now known as %s"), pszNick, lin->ptszText);
else
- Log_AppendRTF(streamData, true, buf, TranslateT("You are now known as %s"), streamData->lin->ptszText);
+ Log_AppendRTF(streamData, true, buf, TranslateT("You are now known as %s"), lin->ptszText);
}
break;
case GC_EVENT_KICK:
- if (streamData->lin->ptszNick && streamData->lin->ptszStatus)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s kicked %s"), streamData->lin->ptszStatus, streamData->lin->ptszNick);
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, false, buf, L": %s", streamData->lin->ptszText);
+ if (lin->ptszNick && lin->ptszStatus)
+ Log_AppendRTF(streamData, true, buf, TranslateT("%s kicked %s"), lin->ptszStatus, lin->ptszNick);
+ if (lin->ptszText)
+ Log_AppendRTF(streamData, false, buf, L": %s", lin->ptszText);
break;
case GC_EVENT_NOTICE:
- if (pszNick && streamData->lin->ptszText) {
+ if (pszNick && lin->ptszText) {
Log_AppendRTF(streamData, true, buf, TranslateT("Notice from %s: "), pszNick);
- Log_AppendRTF(streamData, false, buf, L"%s", streamData->lin->ptszText);
+ Log_AppendRTF(streamData, false, buf, L"%s", lin->ptszText);
}
break;
case GC_EVENT_TOPIC:
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, false, buf, TranslateT("The topic is '%s%s'"), streamData->lin->ptszText, L"%r");
- if (streamData->lin->ptszNick)
+ if (lin->ptszText)
+ Log_AppendRTF(streamData, false, buf, TranslateT("The topic is '%s%s'"), lin->ptszText, L"%r");
+ if (lin->ptszNick)
Log_AppendRTF(streamData, true, buf,
- streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)") : TranslateT(" (set by %s)"),
- streamData->lin->ptszNick, streamData->lin->ptszUserInfo);
+ lin->ptszUserInfo ? TranslateT(" (set by %s on %s)") : TranslateT(" (set by %s)"),
+ lin->ptszNick, lin->ptszUserInfo);
break;
case GC_EVENT_INFORMATION:
- if (streamData->lin->ptszText)
- Log_AppendRTF(streamData, false, buf, (streamData->lin->bIsMe) ? L"--> %s" : L"%s", streamData->lin->ptszText);
+ if (lin->ptszText)
+ Log_AppendRTF(streamData, false, buf, (lin->bIsMe) ? L"--> %s" : L"%s", lin->ptszText);
break;
case GC_EVENT_ADDSTATUS:
- if (streamData->lin->ptszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s enables '%s' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
+ if (lin->ptszNick && lin->ptszText && lin->ptszStatus)
+ Log_AppendRTF(streamData, true, buf, TranslateT("%s enables '%s' status for %s"), lin->ptszText, lin->ptszStatus, lin->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
- if (streamData->lin->ptszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendRTF(streamData, TRUE, buf, TranslateT("%s disables '%s' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
+ if (lin->ptszNick && lin->ptszText && lin->ptszStatus)
+ Log_AppendRTF(streamData, TRUE, buf, TranslateT("%s disables '%s' status for %s"), lin->ptszText, lin->ptszStatus, lin->ptszNick);
break;
}
}
@@ -291,7 +293,8 @@ wchar_t* MakeTimeStamp(wchar_t *pszStamp, time_t time)
char* Log_CreateRTF(LOGSTREAMDATA *streamData)
{
- MODULEINFO *mi = chatApi.MM_FindModule(streamData->si->pszModule);
+ SESSION_INFO *si = streamData->si;
+ MODULEINFO *mi = chatApi.MM_FindModule(si->pszModule);
// guesstimate amount of memory for the RTF
CMStringA buf;
@@ -304,8 +307,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
// ### RTF BODY (one iteration per event that should be streamed in)
for (LOGINFO *lin = streamData->lin; lin; lin = lin->prev) {
// filter
- if (streamData->si->iType == GCW_CHATROOM || streamData->si->iType == GCW_PRIVMESS)
- if (streamData->si->bFilterEnabled && (streamData->si->iLogFilterFlags & lin->iType) == 0)
+ if (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS)
+ if (si->pDlg->m_bFilterEnabled && (si->pDlg->m_iLogFilterFlags & lin->iType) == 0)
continue;
// create new line, and set font and color
@@ -343,9 +346,9 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
wchar_t szTimeStamp[30], szOldTimeStamp[30];
mir_wstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
- mir_wstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
- if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
- streamData->si->LastTime = lin->time;
+ mir_wstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, si->LastTime), 30);
+ if (!g_Settings->bShowTimeIfChanged || si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
+ si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, buf, L"%s", szTimeStamp);
}
buf.Append("\\tab ");
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index a3f8f492d0..8256520450 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -229,20 +229,8 @@ EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession(
si->wStatus = ID_STATUS_ONLINE;
si->iType = iType;
si->ptszName = mir_wstrdup(ptszName);
- si->iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0);
- si->bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0) != 0;
- si->bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1) != 0;
si->currentHovered = -1;
- if (mi->bColor) {
- si->iFG = 4;
- si->bFGSet = true;
- }
- if (mi->bBkgColor) {
- si->iBG = 2;
- si->bBGSet = true;
- }
-
wchar_t szTemp[256];
if (si->iType == GCW_SERVER)
mir_snwprintf(szTemp, L"Server: %s", si->ptszName);
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp
index b33d296a81..942ef2ff8e 100644
--- a/src/mir_app/src/colorchooser.cpp
+++ b/src/mir_app/src/colorchooser.cpp
@@ -140,8 +140,8 @@ public:
int ctrlId = GetDlgCtrlID(m_hwndChooser);
if (m_bForeground) {
- m_si->bFGSet = true;
- m_si->iFG = iCurrentHotTrack;
+ m_si->pDlg->m_bFGSet = true;
+ m_si->pDlg->m_iFG = iCurrentHotTrack;
if (IsDlgButtonChecked(hWindow, ctrlId)) {
cf.dwMask = CFM_COLOR;
cf.crTextColor = m_pModule->crColors[iCurrentHotTrack];
@@ -149,8 +149,8 @@ public:
}
}
else {
- m_si->bBGSet = true;
- m_si->iBG = iCurrentHotTrack;
+ m_si->pDlg->m_bBGSet = true;
+ m_si->pDlg->m_iBG = iCurrentHotTrack;
if (IsDlgButtonChecked(hWindow, ctrlId)) {
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = m_pModule->crColors[iCurrentHotTrack];
@@ -224,7 +224,7 @@ public:
iThisRow++;
}
- if (m_bForeground && m_si->bFGSet && m_si->iFG == i || !m_bForeground && m_si->bBGSet && m_si->iBG == i) {
+ if (m_bForeground && m_si->pDlg->m_bFGSet && m_si->pDlg->m_iFG == i || !m_bForeground && m_si->pDlg->m_bBGSet && m_si->pDlg->m_iBG == i) {
rc.top = (iThisRow - 1) * 20 + 1 + 20;
rc.left = (iThisColumn - 1) * 25 + 1 + 1;
rc.bottom = iThisRow * 20 - 1 + 20;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index e725d21d0f..d6414d4a10 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -399,7 +399,7 @@ Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QAEXK@Z @402 NONAME
-??0CSrmmBaseDialog@@IAE@PAUHINSTANCE__@@H@Z @403 NONAME
+??0CSrmmBaseDialog@@IAE@PAUHINSTANCE__@@HPAUSESSION_INFO@@@Z @403 NONAME
??0CSrmmBaseDialog@@QAE@ABV0@@Z @404 NONAME
??1CSrmmBaseDialog@@UAE@XZ @405 NONAME
??4CSrmmBaseDialog@@QAEAAV0@ABV0@@Z @406 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b23014f010..1c66d0534a 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -399,7 +399,7 @@ Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QEAAXK@Z @402 NONAME
-??0CSrmmBaseDialog@@IEAA@PEAUHINSTANCE__@@H@Z @403 NONAME
+??0CSrmmBaseDialog@@IEAA@PEAUHINSTANCE__@@HPEAUSESSION_INFO@@@Z @403 NONAME
??0CSrmmBaseDialog@@QEAA@AEBV0@@Z @404 NONAME
??1CSrmmBaseDialog@@UEAA@XZ @405 NONAME
??4CSrmmBaseDialog@@QEAAAEAV0@AEBV0@@Z @406 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 65f6c65d3c..0d007ea68f 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -23,15 +23,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+#include "chat.h"
+
extern HCURSOR g_hCurHyperlinkHand;
-CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog) :
+CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si) :
CDlgBase(hInst, idDialog),
- m_si(nullptr),
+ m_si(si),
m_pLog(nullptr),
m_pEntry(nullptr),
m_hContact(0)
{
+ m_bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0) != 0;
+ m_bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1) != 0;
+ m_iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0);
+
+ if (si) {
+ m_hContact = si->hContact;
+
+ MODULEINFO *mi = chatApi.MM_FindModule(si->pszModule);
+ if (mi == nullptr) {
+ if (mi->bColor) {
+ m_iFG = 4;
+ m_bFGSet = true;
+ }
+ if (mi->bBkgColor) {
+ m_iBG = 2;
+ m_bBGSet = true;
+ }
+ }
+ }
}
INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)