summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver/src/chat/window.cpp')
-rw-r--r--plugins/Scriver/src/chat/window.cpp1712
1 files changed, 829 insertions, 883 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 3655e3c4b7..6536ecf89b 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -29,38 +29,6 @@ struct MESSAGESUBDATA
SESSION_INFO *lastSession;
};
-static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- RECT rc;
-
- switch (msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
-
- case WM_SETCURSOR:
- GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? hCurSplitNS : hCurSplitWE);
- return TRUE;
-
- case WM_LBUTTONDOWN:
- SetCapture(hwnd);
- return 0;
-
- case WM_MOUSEMOVE:
- if (GetCapture() == hwnd) {
- GetClientRect(hwnd, &rc);
- SendMessage(GetParent(hwnd), GC_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
- }
- return 0;
-
- case WM_LBUTTONUP:
- ReleaseCapture();
- PostMessage(GetParent(hwnd), WM_SIZE, 0, 0);
- return 0;
- }
- return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
-}
-
static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
{
SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
@@ -173,10 +141,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
MESSAGESUBDATA *dat = (MESSAGESUBDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, si);
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, pDlg);
if (result != -1)
return result;
@@ -231,7 +199,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- TabAutoComplete(hwnd, dat, si);
+ TabAutoComplete(hwnd, dat, pDlg->m_si);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
return 0;
@@ -328,7 +296,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_CONTEXTMENU:
- InputAreaContextMenu(hwnd, wParam, lParam, si->hContact);
+ InputAreaContextMenu(hwnd, wParam, lParam, pDlg->m_hContact);
return TRUE;
case WM_KEYUP:
@@ -347,13 +315,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR;
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bColor) {
- int index = pci->GetColorIndex(si->pszModule, cf.crTextColor);
+ if (pci->MM_FindModule(pDlg->m_si->pszModule) && pci->MM_FindModule(pDlg->m_si->pszModule)->bColor) {
+ int index = pci->GetColorIndex(pDlg->m_si->pszModule, cf.crTextColor);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR);
if (index >= 0) {
- si->bFGSet = TRUE;
- si->iFG = index;
+ pDlg->m_si->bFGSet = TRUE;
+ pDlg->m_si->iFG = index;
}
if (u == BST_UNCHECKED && cf.crTextColor != cr)
@@ -362,14 +330,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_UNCHECKED);
}
- if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bBkgColor) {
- int index = pci->GetColorIndex(si->pszModule, cf.crBackColor);
+ if (pci->MM_FindModule(pDlg->m_si->pszModule) && pci->MM_FindModule(pDlg->m_si->pszModule)->bBkgColor) {
+ int index = pci->GetColorIndex(pDlg->m_si->pszModule, cf.crBackColor);
COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
if (index >= 0) {
- si->bBGSet = TRUE;
- si->iBG = index;
+ pDlg->m_si->bBGSet = TRUE;
+ pDlg->m_si->iBG = index;
}
if (u == BST_UNCHECKED && cf.crBackColor != crB)
CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_CHECKED);
@@ -377,7 +345,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_UNCHECKED);
}
- if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bBold) {
+ if (pci->MM_FindModule(pDlg->m_si->pszModule) && pci->MM_FindModule(pDlg->m_si->pszModule)->bBold) {
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BOLD);
u2 = cf.dwEffects;
u2 &= CFE_BOLD;
@@ -387,7 +355,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_UNCHECKED);
}
- if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bItalics) {
+ if (pci->MM_FindModule(pDlg->m_si->pszModule) && pci->MM_FindModule(pDlg->m_si->pszModule)->bItalics) {
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_ITALICS);
u2 = cf.dwEffects;
u2 &= CFE_ITALIC;
@@ -397,7 +365,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_UNCHECKED);
}
- if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bUnderline) {
+ if (pci->MM_FindModule(pDlg->m_si->pszModule) && pci->MM_FindModule(pDlg->m_si->pszModule)->bUnderline) {
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_UNDERLINE);
u2 = cf.dwEffects;
u2 &= CFE_UNDERLINE;
@@ -510,8 +478,9 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static BOOL inMenu = FALSE;
- SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, si);
+ CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, pDlg);
if (result != -1)
return result;
@@ -573,7 +542,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
CHARRANGE all = { 0, -1 };
HMENU hMenu = NULL;
- UINT uID = CreateGCMenu(hwnd, &hMenu, 1, pt, si, NULL, pszWord);
+ UINT uID = CreateGCMenu(hwnd, &hMenu, 1, pt, pDlg->m_si, NULL, pszWord);
inMenu = FALSE;
switch (uID) {
case 0:
@@ -589,11 +558,11 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
break;
case IDM_CLEAR:
- if (si) {
+ if (pDlg->m_si) {
SetWindowText(hwnd, L"");
- pci->LM_RemoveAll(&si->pLog, &si->pLogEnd);
- si->iEventCount = 0;
- si->LastTime = 0;
+ pci->LM_RemoveAll(&pDlg->m_si->pLog, &pDlg->m_si->pLogEnd);
+ pDlg->m_si->iEventCount = 0;
+ pDlg->m_si->LastTime = 0;
PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
}
break;
@@ -612,7 +581,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
default:
PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, uID);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_LOGMENU, NULL, NULL, uID);
break;
}
DestroyGCMenu(&hMenu, 5);
@@ -630,8 +599,9 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, si);
+ CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, pDlg);
if (result != -1)
return result;
@@ -641,10 +611,10 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
HDC dc = (HDC)wParam;
if (dc) {
int index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
- if (index == LB_ERR || si->nUsersInNicklist <= 0)
+ if (index == LB_ERR || pDlg->m_si->nUsersInNicklist <= 0)
return 0;
- int items = si->nUsersInNicklist - index;
+ int items = pDlg->m_si->nUsersInNicklist - index;
int height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
if (height != LB_ERR) {
@@ -706,7 +676,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
else
item &= 0xFFFF;
- USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, (int)item);
+ USERINFO *ui = pci->SM_GetUserFromIndex(pDlg->m_si->ptszID, pDlg->m_si->pszModule, (int)item);
if (ui) {
HMENU hMenu = 0;
UINT uID;
@@ -716,18 +686,18 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (hti.pt.x == -1 && hti.pt.y == -1)
hti.pt.y += height - 4;
ClientToScreen(hwnd, &hti.pt);
- uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, si, uinew.pszUID, uinew.pszNick);
+ uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, pDlg->m_si, uinew.pszUID, uinew.pszNick);
switch (uID) {
case 0:
break;
case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -754,14 +724,14 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (wParam == VK_RETURN) {
int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
- USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ USERINFO *ui = pci->SM_GetUserFromIndex(pDlg->m_si->ptszID, pDlg->m_si->pszModule, index);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
}
break;
}
if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
- si->szSearch[0] = 0;
+ pDlg->m_wszSearch[0] = 0;
}
break;
@@ -771,32 +741,32 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
* simple incremental search for the user (nick) - list control
* typing esc or movement keys will clear the current search string
*/
- if (wParam == 27 && si->szSearch[0]) { // escape - reset everything
- si->szSearch[0] = 0;
+ if (wParam == 27 && pDlg->m_wszSearch[0]) { // escape - reset everything
+ pDlg->m_wszSearch[0] = 0;
break;
}
- else if (wParam == '\b' && si->szSearch[0]) // backspace
- si->szSearch[mir_wstrlen(si->szSearch) - 1] = '\0';
+ else if (wParam == '\b' && pDlg->m_wszSearch[0]) // backspace
+ pDlg->m_wszSearch[mir_wstrlen(pDlg->m_wszSearch) - 1] = '\0';
else if (wParam < ' ')
break;
else {
wchar_t szNew[2];
szNew[0] = (wchar_t)wParam;
szNew[1] = '\0';
- if (mir_wstrlen(si->szSearch) >= _countof(si->szSearch) - 2) {
+ if (mir_wstrlen(pDlg->m_wszSearch) >= _countof(pDlg->m_wszSearch) - 2) {
MessageBeep(MB_OK);
break;
}
- mir_wstrcat(si->szSearch, szNew);
+ mir_wstrcat(pDlg->m_wszSearch, szNew);
}
- if (si->szSearch[0]) {
+ if (pDlg->m_wszSearch[0]) {
// iterate over the (sorted) list of nicknames and search for the
// string we have
int iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
for (int i = 0; i < iItems; i++) {
- USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i);
+ USERINFO *ui = pci->UM_FindUserFromIndex(pDlg->m_si->pUsers, i);
if (ui) {
- if (!wcsnicmp(ui->pszNick, si->szSearch, mir_wstrlen(si->szSearch))) {
+ if (!wcsnicmp(ui->pszNick, pDlg->m_wszSearch, mir_wstrlen(pDlg->m_wszSearch))) {
SendMessage(hwnd, LB_SETCURSEL, i, 0);
InvalidateRect(hwnd, NULL, FALSE);
return 0;
@@ -805,13 +775,13 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
MessageBeep(MB_OK);
- si->szSearch[mir_wstrlen(si->szSearch) - 1] = '\0';
+ pDlg->m_wszSearch[mir_wstrlen(pDlg->m_wszSearch) - 1] = '\0';
return 0;
}
break;
case WM_MOUSEMOVE:
- Chat_HoverMouse(si, hwnd, lParam, ServiceExists("mToolTip/HideTip"));
+ Chat_HoverMouse(pDlg->m_si, hwnd, lParam, ServiceExists("mToolTip/HideTip"));
break;
}
@@ -845,952 +815,928 @@ static void __cdecl phase2(void *lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-class CChatRoomDlg : public CSrmmBaseDialog
+void CChatRoomDlg::MessageDialogResize(int w, int h)
{
- SESSION_INFO *m_si;
-
- CCtrlEdit m_message, m_log;
- CCtrlListBox m_nickList;
-
- void MessageDialogResize(int w, int h)
- {
- bool bNick = m_si->iType != GCW_SERVER && m_si->bNicklistEnabled;
- bool bToolbar = SendMessage(m_hwndParent, CM_GETTOOLBARSTATUS, 0, 0) != 0;
- int hSplitterMinTop = TOOLBAR_HEIGHT + m_si->m_minLogBoxHeight, hSplitterMinBottom = m_si->m_minEditBoxHeight;
- int toolbarHeight = bToolbar ? TOOLBAR_HEIGHT : 0;
-
- m_si->iSplitterY = m_si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
-
- if (h - m_si->iSplitterY < hSplitterMinTop)
- m_si->iSplitterY = h - hSplitterMinTop;
- if (m_si->iSplitterY < hSplitterMinBottom)
- m_si->iSplitterY = hSplitterMinBottom;
+ bool bNick = m_si->iType != GCW_SERVER && m_si->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;
+
+ if (h - m_si->iSplitterY < hSplitterMinTop)
+ m_si->iSplitterY = h - hSplitterMinTop;
+ if (m_si->iSplitterY < hSplitterMinBottom)
+ m_si->iSplitterY = hSplitterMinBottom;
+
+ 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);
+ else
+ ShowWindow(m_nickList.GetHwnd(), SW_HIDE);
+
+ if (m_si->iType == GCW_SERVER) {
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_SHOWNICKLIST), FALSE);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), FALSE);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_CHANMGR), FALSE);
+ }
+ else {
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_SHOWNICKLIST), TRUE);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), TRUE);
+ if (m_si->iType == GCW_CHATROOM)
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_CHANMGR), pci->MM_FindModule(m_si->pszModule)->bChanMgr);
+ }
- ShowWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
- if (m_si->iType != GCW_SERVER)
- ShowWindow(GetDlgItem(m_hwnd, IDC_CHAT_LIST), m_si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
- else
- ShowWindow(GetDlgItem(m_hwnd, IDC_CHAT_LIST), SW_HIDE);
+ HDWP hdwp = BeginDeferWindowPos(5);
+ int toolbarTopY = bToolbar ? h - m_si->iSplitterY - toolbarHeight : h - m_si->iSplitterY;
+ int logBottom = (m_hwndIeview != NULL) ? toolbarTopY / 2 : toolbarTopY;
+
+ hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, 0, bNick ? w - m_si->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_nickList.GetHwnd(), 0, w - m_si->iSplitterX + 2, 0, m_si->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitterX.GetHwnd(), 0, w - m_si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), 0, 0, h - m_si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), 0, 1, h - m_si->iSplitterY + SPLITTER_HEIGHT, w - 2, m_si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
+ EndDeferWindowPos(hdwp);
+
+ SetButtonsPos(m_hwnd, m_hContact, bToolbar);
+
+ if (m_hwndIeview != NULL) {
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_SETPOS;
+ ieWindow.parent = m_hwnd;
+ ieWindow.hwnd = m_hwndIeview;
+ ieWindow.x = 0;
+ ieWindow.y = logBottom + 1;
+ ieWindow.cx = bNick ? w - m_si->iSplitterX : w;
+ ieWindow.cy = logBottom;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
+ }
+ else RedrawWindow(m_log.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
- if (m_si->iType == GCW_SERVER) {
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_SHOWNICKLIST), FALSE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), FALSE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_CHANMGR), FALSE);
- }
- else {
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_SHOWNICKLIST), TRUE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), TRUE);
- if (m_si->iType == GCW_CHATROOM)
- EnableWindow(GetDlgItem(m_hwnd, IDC_CHAT_CHANMGR), pci->MM_FindModule(m_si->pszModule)->bChanMgr);
- }
+ RedrawWindow(m_nickList.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+}
- HDWP hdwp = BeginDeferWindowPos(5);
- int toolbarTopY = bToolbar ? h - m_si->iSplitterY - toolbarHeight : h - m_si->iSplitterY;
- int logBottom = (m_si->m_hwndIeview != NULL) ? toolbarTopY / 2 : toolbarTopY;
-
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_LOG), 0, 1, 0, bNick ? w - m_si->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_CHAT_LIST), 0, w - m_si->iSplitterX + 2, 0, m_si->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_SPLITTERX), 0, w - m_si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_SPLITTERY), 0, 0, h - m_si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 1, h - m_si->iSplitterY + SPLITTER_HEIGHT, w - 2, m_si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
- EndDeferWindowPos(hdwp);
-
- SetButtonsPos(m_hwnd, m_hContact, bToolbar);
-
- if (m_si->m_hwndIeview != NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_SETPOS;
- ieWindow.parent = m_hwnd;
- ieWindow.hwnd = m_si->m_hwndIeview;
- ieWindow.x = 0;
- ieWindow.y = logBottom + 1;
- ieWindow.cx = bNick ? w - m_si->iSplitterX : w;
- ieWindow.cy = logBottom;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- }
- else RedrawWindow(GetDlgItem(m_hwnd, IDC_LOG), NULL, NULL, RDW_INVALIDATE);
+CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
+ : CScriverWindow(IDD_CHANNEL),
+ m_si(si),
+ m_log(this, IDC_LOG),
+ m_message(this, IDC_MESSAGE),
+ m_nickList(this, IDC_CHAT_LIST),
+ m_splitterX(this, IDC_SPLITTERX),
+ m_splitterY(this, IDC_SPLITTERY)
+{
+ m_pLog = &m_log;
+ m_pEntry = &m_message;
+ m_autoClose = 0;
+ m_hContact = si->hContact;
- RedrawWindow(GetDlgItem(m_hwnd, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(m_hwnd, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
- }
+ m_splitterX.OnChange = Callback(this, &CChatRoomDlg::OnSplitterX);
+ m_splitterY.OnChange = Callback(this, &CChatRoomDlg::OnSplitterY);
+}
-public:
- CChatRoomDlg(SESSION_INFO *si)
- : CSrmmBaseDialog(g_hInst, IDD_CHANNEL),
- m_si(si),
- m_log(this, IDC_LOG),
- m_message(this, IDC_MESSAGE),
- m_nickList(this, IDC_CHAT_LIST)
- {
- m_pLog = &m_log;
- m_pEntry = &m_message;
- m_autoClose = 0;
- m_hContact = si->hContact;
+void CChatRoomDlg::OnInitDialog()
+{
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
+
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
+
+ RichUtil_SubClass(m_message.GetHwnd());
+ RichUtil_SubClass(m_log.GetHwnd());
+ RichUtil_SubClass(m_nickList.GetHwnd());
+
+ mir_subclassWindow(m_nickList.GetHwnd(), NicklistSubclassProc);
+ mir_subclassWindow(m_log.GetHwnd(), LogSubclassProc);
+ mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CHAT_COLOR), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow(m_message.GetHwnd(), MessageSubclassProc);
+
+ Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISCHATBUTTON);
+
+ RECT minEditInit;
+ GetWindowRect(m_message.GetHwnd(), &minEditInit);
+ m_minEditBoxHeight = minEditInit.bottom - minEditInit.top;
+ m_minLogBoxHeight = m_minEditBoxHeight;
+
+ m_message.SendMsg(EM_SUBCLASSED, 0, 0);
+ m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
+
+ int mask = (int)m_log.SendMsg(EM_GETEVENTMASK, 0, 0);
+ m_log.SendMsg(EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS);
+ m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0);
+ m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+ m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
+
+ if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) {
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
+ ieWindow.iType = IEW_CREATE;
+ ieWindow.dwMode = IEWM_CHAT;
+ ieWindow.parent = m_hwnd;
+ ieWindow.cx = 200;
+ ieWindow.cy = 300;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
+
+ m_hwndIeview = ieWindow.hwnd;
+
+ IEVIEWEVENT iee = { sizeof(iee) };
+ iee.iType = IEE_CLEAR_LOG;
+ iee.hwnd = m_hwndIeview;
+ iee.hContact = m_hContact;
+ iee.pszProto = m_si->pszModule;
+ CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
}
- virtual void OnInitDialog() override
- {
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
-
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)m_si);
-
- RichUtil_SubClass(m_message.GetHwnd());
- RichUtil_SubClass(m_log.GetHwnd());
- RichUtil_SubClass(m_nickList.GetHwnd());
- mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), SplitterSubclassProc);
- mir_subclassWindow(m_nickList.GetHwnd(), NicklistSubclassProc);
- mir_subclassWindow(m_log.GetHwnd(), LogSubclassProc);
- mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), ButtonSubclassProc);
- mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CHAT_COLOR), ButtonSubclassProc);
- mir_subclassWindow(GetDlgItem(m_hwnd, IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
- mir_subclassWindow(m_message.GetHwnd(), MessageSubclassProc);
-
- Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISCHATBUTTON);
-
- RECT minEditInit;
- GetWindowRect(m_message.GetHwnd(), &minEditInit);
- m_si->m_minEditBoxHeight = minEditInit.bottom - minEditInit.top;
- m_si->m_minLogBoxHeight = m_si->m_minEditBoxHeight;
-
- m_message.SendMsg(EM_SUBCLASSED, 0, 0);
- m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
-
- int mask = (int)m_log.SendMsg(EM_GETEVENTMASK, 0, 0);
- m_log.SendMsg(EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS);
- m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0);
- m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
- m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
-
- if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) {
- IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
- ieWindow.iType = IEW_CREATE;
- ieWindow.dwMode = IEWM_CHAT;
- ieWindow.parent = m_hwnd;
- ieWindow.cx = 200;
- ieWindow.cy = 300;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
-
- m_si->m_hwndIeview = ieWindow.hwnd;
-
- IEVIEWEVENT iee = { sizeof(iee) };
- iee.iType = IEE_CLEAR_LOG;
- iee.hwnd = m_si->m_hwndIeview;
- iee.hContact = m_hContact;
- iee.pszProto = m_si->pszModule;
- CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
- }
+ m_log.SendMsg(EM_HIDESELECTION, TRUE, 0);
- m_log.SendMsg(EM_HIDESELECTION, TRUE, 0);
+ SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0);
+ SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0);
- SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)m_hwnd, m_hContact);
+ PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+}
- SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)m_hwnd, m_hContact);
- PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+void CChatRoomDlg::OnDestroy()
+{
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+
+ m_si->hWnd = NULL;
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
+
+ SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
+ if (m_hwndIeview != NULL) {
+ IEVIEWWINDOW ieWindow;
+ ieWindow.cbSize = sizeof(IEVIEWWINDOW);
+ ieWindow.iType = IEW_DESTROY;
+ ieWindow.hwnd = m_hwndIeview;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- virtual void OnDestroy() override
- {
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
+}
- m_si->hWnd = NULL;
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
+void CChatRoomDlg::OnSplitterX(CSplitter *pSplitter)
+{
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
+
+ m_si->iSplitterX = rc.right - pSplitter->GetPos() + 1;
+ if (m_si->iSplitterX < 35)
+ m_si->iSplitterX = 35;
+ if (m_si->iSplitterX > rc.right - rc.left - 35)
+ m_si->iSplitterX = rc.right - rc.left - 35;
+ g_Settings.iSplitterX = m_si->iSplitterX;
+}
- SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
- if (m_si->m_hwndIeview != NULL) {
- IEVIEWWINDOW ieWindow;
- ieWindow.cbSize = sizeof(IEVIEWWINDOW);
- ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = m_si->m_hwndIeview;
- CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- }
+void CChatRoomDlg::OnSplitterY(CSplitter *pSplitter)
+{
+ RECT rc;
+ GetClientRect(m_hwnd, &rc);
- NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
- }
+ m_si->iSplitterY = rc.bottom - pSplitter->GetPos();
+ g_Settings.iSplitterY = m_si->iSplitterY;
+}
- virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override
- {
- static HMENU hToolbarMenu;
- RECT rc;
- POINT pt;
- HICON hIcon;
- TabControlData tcd;
- TitleBarData tbd;
- wchar_t szTemp[512];
+INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ static HMENU hToolbarMenu;
+ RECT rc;
+ POINT pt;
+ HICON hIcon;
+ TabControlData tcd;
+ TitleBarData tbd;
+ wchar_t szTemp[512];
- switch (uMsg) {
- case GC_SETWNDPROPS:
- // LoadGlobalSettings();
- InitButtons(m_hwnd, m_si);
+ switch (uMsg) {
+ case GC_SETWNDPROPS:
+ // LoadGlobalSettings();
+ InitButtons(m_hwnd, m_si);
- SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
+
+ m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground);
+
+ // messagebox
+ COLORREF crFore;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore);
+
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR;
+ cf.dwEffects = 0;
+ cf.crTextColor = crFore;
+ cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ m_message.SendMsg(EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
+ m_message.SendMsg(WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ {
+ // nicklist
+ int ih = GetTextPixelSize(L"AQG_glo'", g_Settings.UserListFont, FALSE);
+ int ih2 = GetTextPixelSize(L"AQG_glo'", g_Settings.UserListHeadingsFont, FALSE);
+ int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
+ int font = ih > ih2 ? ih : ih2;
+ // make sure we have space for icon!
+ if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+
+ m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font);
+ InvalidateRect(m_nickList.GetHwnd(), NULL, TRUE);
+ }
+ m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0);
+ break;
- m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground);
- {
- // messagebox
- COLORREF crFore;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore);
+ case DM_UPDATETITLEBAR:
+ if (g_dat.flags & SMF_STATUSICON) {
+ MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
+ tbd.hIconBig = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
+ }
+ else {
+ tbd.hIcon = GetCachedIcon("chat_window");
+ tbd.hIconBig = g_dat.hIconChatBig;
+ }
+ tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR;
- cf.dwEffects = 0;
- cf.crTextColor = crFore;
- cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- m_message.SendMsg(EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
- m_message.SendMsg(WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
-
- // nicklist
- int ih = GetTextPixelSize(L"AQG_glo'", g_Settings.UserListFont, FALSE);
- int ih2 = GetTextPixelSize(L"AQG_glo'", g_Settings.UserListHeadingsFont, FALSE);
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
- int font = ih > ih2 ? ih : ih2;
- // make sure we have space for icon!
- if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
-
- m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font);
- InvalidateRect(m_nickList.GetHwnd(), NULL, TRUE);
- }
- m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
- SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0);
+ switch (m_si->iType) {
+ case GCW_CHATROOM:
+ mir_snwprintf(szTemp,
+ (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
+ m_si->ptszName, m_si->nUsersInNicklist);
break;
-
- case DM_UPDATETITLEBAR:
- if (g_dat.flags & SMF_STATUSICON) {
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
- tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
- tbd.hIconBig = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
- }
- else {
- tbd.hIcon = GetCachedIcon("chat_window");
- tbd.hIconBig = g_dat.hIconChatBig;
- }
- tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
-
- switch (m_si->iType) {
- case GCW_CHATROOM:
- mir_snwprintf(szTemp,
- (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
- m_si->ptszName, m_si->nUsersInNicklist);
- break;
- case GCW_PRIVMESS:
- mir_snwprintf(szTemp,
- (m_si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
- m_si->ptszName, m_si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_snwprintf(szTemp, L"%s: Server", m_si->ptszName);
- break;
- }
- tbd.iFlags = TBDF_TEXT | TBDF_ICON;
- tbd.pszText = szTemp;
- SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
- SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
+ case GCW_PRIVMESS:
+ mir_snwprintf(szTemp,
+ (m_si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
+ m_si->ptszName, m_si->nUsersInNicklist);
break;
-
- case GC_UPDATESTATUSBAR:
- {
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
- hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
- mir_snwprintf(szTemp, L"%s : %s", mi->ptszModDispName, m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"");
-
- StatusBarData sbd;
- sbd.iItem = 0;
- sbd.iFlags = SBDF_TEXT | SBDF_ICON;
- sbd.hIcon = hIcon;
- sbd.pszText = szTemp;
- SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
-
- sbd.iItem = 1;
- sbd.hIcon = NULL;
- sbd.pszText = L"";
- SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
-
- StatusIconData sid = { sizeof(sid) };
- sid.szModule = SRMMMOD;
- Srmm_ModifyIcon(m_hContact, &sid);
- }
+ case GCW_SERVER:
+ mir_snwprintf(szTemp, L"%s: Server", m_si->ptszName);
break;
+ }
+ tbd.iFlags = TBDF_TEXT | TBDF_ICON;
+ tbd.pszText = szTemp;
+ SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
+ SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
+ break;
- case DM_SWITCHINFOBAR:
- case DM_SWITCHTOOLBAR:
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
- break;
+ case GC_UPDATESTATUSBAR:
+ {
+ MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
+ mir_snwprintf(szTemp, L"%s : %s", mi->ptszModDispName, m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"");
+
+ StatusBarData sbd;
+ sbd.iItem = 0;
+ sbd.iFlags = SBDF_TEXT | SBDF_ICON;
+ sbd.hIcon = hIcon;
+ sbd.pszText = szTemp;
+ SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
+
+ sbd.iItem = 1;
+ sbd.hIcon = NULL;
+ sbd.pszText = L"";
+ SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
+
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = SRMMMOD;
+ Srmm_ModifyIcon(m_hContact, &sid);
+ }
+ break;
- case WM_SIZE:
- if (wParam == SIZE_MAXIMIZED)
- PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
+ case DM_SWITCHINFOBAR:
+ case DM_SWITCHTOOLBAR:
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ break;
- if (IsIconic(m_hwnd)) break;
+ case WM_SIZE:
+ if (wParam == SIZE_MAXIMIZED)
+ PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
- if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
- GetClientRect(m_hwnd, &rc);
- MessageDialogResize(rc.right - rc.left, rc.bottom - rc.top);
- }
- break;
+ if (IsIconic(m_hwnd)) break;
- case GC_REDRAWWINDOW:
- InvalidateRect(m_hwnd, NULL, TRUE);
- break;
+ if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
+ GetClientRect(m_hwnd, &rc);
+ MessageDialogResize(rc.right - rc.left, rc.bottom - rc.top);
+ }
+ break;
- case GC_REDRAWLOG:
- m_si->LastTime = 0;
- if (m_si->pLog) {
- LOGINFO *pLog = m_si->pLog;
- if (m_si->iEventCount > 60) {
- int index = 0;
- while (index < 59) {
- if (pLog->next == NULL)
- break;
-
- pLog = pLog->next;
- if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_si->bFilterEnabled || (m_si->iLogFilterFlags&pLog->iType) != 0)
- index++;
- }
- Log_StreamInEvent(m_hwnd, pLog, m_si, TRUE);
- mir_forkthread(phase2, m_si);
+ case GC_REDRAWWINDOW:
+ InvalidateRect(m_hwnd, NULL, TRUE);
+ break;
+
+ case GC_REDRAWLOG:
+ m_si->LastTime = 0;
+ if (m_si->pLog) {
+ LOGINFO *pLog = m_si->pLog;
+ if (m_si->iEventCount > 60) {
+ int index = 0;
+ while (index < 59) {
+ if (pLog->next == NULL)
+ break;
+
+ pLog = pLog->next;
+ if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_si->bFilterEnabled || (m_si->iLogFilterFlags&pLog->iType) != 0)
+ index++;
}
- else Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ Log_StreamInEvent(m_hwnd, pLog, m_si, TRUE);
+ mir_forkthread(phase2, m_si);
}
- else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
- break;
+ else Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ }
+ else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
+ break;
- case GC_REDRAWLOG2:
- m_si->LastTime = 0;
- if (m_si->pLog)
- Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
- break;
+ case GC_REDRAWLOG2:
+ m_si->LastTime = 0;
+ if (m_si->pLog)
+ Log_StreamInEvent(m_hwnd, m_si->pLogEnd, m_si, TRUE);
+ break;
- case GC_ADDLOG:
- if (m_si->pLogEnd)
- Log_StreamInEvent(m_hwnd, m_si->pLog, m_si, FALSE);
+ case GC_ADDLOG:
+ if (m_si->pLogEnd)
+ Log_StreamInEvent(m_hwnd, m_si->pLog, m_si, FALSE);
+ else
+ SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
+ break;
+
+ case DM_UPDATETABCONTROL:
+ tcd.iFlags = TCDF_TEXT;
+ tcd.pszText = m_si->ptszName;
+ SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
+ // fall through
+
+ case GC_FIXTABICONS:
+ if (!(m_si->wState & GC_EVENT_HIGHLIGHT)) {
+ if (m_si->wState & STATE_TALK)
+ hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineTalkIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineTalkIcon;
else
- SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
- break;
+ hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineIcon;
+ }
+ else hIcon = g_dat.hMsgIcon;
- case DM_UPDATETABCONTROL:
- tcd.iFlags = TCDF_TEXT;
- tcd.pszText = m_si->ptszName;
- SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
- // fall through
+ tcd.iFlags = TCDF_ICON;
+ tcd.hIcon = hIcon;
+ SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
+ break;
- case GC_FIXTABICONS:
- if (!(m_si->wState & GC_EVENT_HIGHLIGHT)) {
- if (m_si->wState & STATE_TALK)
- hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineTalkIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineTalkIcon;
- else
- hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(m_si->pszModule)->hOnlineIcon : pci->MM_FindModule(m_si->pszModule)->hOfflineIcon;
- }
- else hIcon = g_dat.hMsgIcon;
+ case GC_SETMESSAGEHIGHLIGHT:
+ m_si->wState |= GC_EVENT_HIGHLIGHT;
+ SendMessage(m_si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwndParent)
+ SendMessage(GetParent(m_si->hWnd), CM_STARTFLASHING, 0, 0);
+ break;
- tcd.iFlags = TCDF_ICON;
- tcd.hIcon = hIcon;
- SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
- break;
+ case GC_SETTABHIGHLIGHT:
+ SendMessage(m_si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwndParent && GetForegroundWindow() != m_hwndParent)
+ SendMessage(GetParent(m_si->hWnd), CM_STARTFLASHING, 0, 0);
+ break;
- case GC_SETMESSAGEHIGHLIGHT:
- m_si->wState |= GC_EVENT_HIGHLIGHT;
- SendMessage(m_si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwndParent)
- SendMessage(GetParent(m_si->hWnd), CM_STARTFLASHING, 0, 0);
- break;
+ case DM_ACTIVATE:
+ if (m_si->wState & STATE_TALK) {
+ m_si->wState &= ~STATE_TALK;
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
+ }
- case GC_SETTABHIGHLIGHT:
- SendMessage(m_si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwndParent && GetForegroundWindow() != m_hwndParent)
- SendMessage(GetParent(m_si->hWnd), CM_STARTFLASHING, 0, 0);
- break;
+ if (m_si->wState & GC_EVENT_HIGHLIGHT) {
+ m_si->wState &= ~GC_EVENT_HIGHLIGHT;
- case DM_ACTIVATE:
- if (m_si->wState & STATE_TALK) {
- m_si->wState &= ~STATE_TALK;
- db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
- }
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
+ }
- if (m_si->wState & GC_EVENT_HIGHLIGHT) {
- m_si->wState &= ~GC_EVENT_HIGHLIGHT;
+ SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
+ if (!m_si->hWnd) {
+ ShowRoom(m_si);
+ SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ }
+ break;
- if (pcli->pfnGetEvent(m_hContact, 0))
- pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
- }
+ case WM_CTLCOLORLISTBOX:
+ SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
+ return (INT_PTR)pci->hListBkgBrush;
- SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
- if (!m_si->hWnd) {
- ShowRoom(m_si);
- SendMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- }
- break;
+ case WM_MEASUREITEM:
+ if (!MeasureMenuItem(wParam, lParam)) {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
+ if (mis->CtlType == ODT_MENU)
+ return Menu_MeasureItem(lParam);
- case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
- return (INT_PTR)pci->hListBkgBrush;
-
- case WM_MEASUREITEM:
- if (!MeasureMenuItem(wParam, lParam)) {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
- if (mis->CtlType == ODT_MENU)
- return Menu_MeasureItem(lParam);
-
- int ih = GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, FALSE);
- int ih2 = GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, FALSE);
- int font = ih > ih2 ? ih : ih2;
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
- // make sure we have space for icon!
- if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
- mis->itemHeight = height > font ? height : font;
- }
- return TRUE;
+ int ih = GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, FALSE);
+ int ih2 = GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, FALSE);
+ int font = ih > ih2 ? ih : ih2;
+ int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
+ // make sure we have space for icon!
+ if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
+ mis->itemHeight = height > font ? height : font;
+ }
+ return TRUE;
- case WM_DRAWITEM:
- if (!DrawMenuItem(wParam, lParam)) {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->CtlType == ODT_MENU)
- return Menu_DrawItem(lParam);
-
- if (dis->CtlID == IDC_CHAT_LIST) {
- int index = dis->itemID;
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
- if (ui) {
- int x_offset = 2;
-
- int height = dis->rcItem.bottom - dis->rcItem.top;
- if (height & 1)
- height++;
-
- int offset = (height == 10) ? 0 : height / 2 - 5;
- HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
- SetBkMode(dis->hDC, TRANSPARENT);
-
- if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush);
- else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
-
- if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
- x_offset += 18;
- }
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, NULL, DI_NORMAL);
- x_offset += 12;
- if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
- x_offset += 18;
- }
-
- SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
- SelectObject(dis->hDC, hOldFont);
- }
- return TRUE;
- }
- }
- break;
+ case WM_DRAWITEM:
+ if (!DrawMenuItem(wParam, lParam)) {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ if (dis->CtlType == ODT_MENU)
+ return Menu_DrawItem(lParam);
- case GC_UPDATENICKLIST:
- m_nickList.SendMsg(WM_SETREDRAW, FALSE, 0);
- m_nickList.SendMsg(LB_RESETCONTENT, 0, 0);
- for (int index = 0; index < m_si->nUsersInNicklist; index++) {
+ if (dis->CtlID == IDC_CHAT_LIST) {
+ int index = dis->itemID;
USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
if (ui) {
- char szIndicator = SM_GetStatusIndicator(m_si, ui);
- if (szIndicator > '\0') {
- static wchar_t ptszBuf[128];
- mir_snwprintf(ptszBuf, L"%c%s", szIndicator, ui->pszNick);
- m_nickList.SendMsg(LB_ADDSTRING, 0, (LPARAM)ptszBuf);
+ int x_offset = 2;
+
+ int height = dis->rcItem.bottom - dis->rcItem.top;
+ if (height & 1)
+ height++;
+
+ int offset = (height == 10) ? 0 : height / 2 - 5;
+ HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
+ HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
+ SetBkMode(dis->hDC, TRANSPARENT);
+
+ if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
+ FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush);
+ else //if (dis->itemState & ODS_INACTIVE)
+ FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
+
+ if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ IcoLib_ReleaseIcon(hIcon);
+ x_offset += 18;
}
- else m_nickList.SendMsg(LB_ADDSTRING, 0, (LPARAM)ui->pszNick);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, NULL, DI_NORMAL);
+ x_offset += 12;
+ if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
+ hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ IcoLib_ReleaseIcon(hIcon);
+ x_offset += 18;
+ }
+
+ SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick));
+ SelectObject(dis->hDC, hOldFont);
}
+ return TRUE;
}
- m_nickList.SendMsg(WM_SETREDRAW, TRUE, 0);
- InvalidateRect(m_nickList.GetHwnd(), NULL, FALSE);
- UpdateWindow(m_nickList.GetHwnd());
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- break;
+ }
+ break;
- case GC_CONTROL_MSG:
- switch (wParam) {
- case SESSION_OFFLINE:
- SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(m_si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
+ case GC_UPDATENICKLIST:
+ m_nickList.SendMsg(WM_SETREDRAW, FALSE, 0);
+ m_nickList.SendMsg(LB_RESETCONTENT, 0, 0);
+ for (int index = 0; index < m_si->nUsersInNicklist; index++) {
+ USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index);
+ if (ui) {
+ char szIndicator = SM_GetStatusIndicator(m_si, ui);
+ if (szIndicator > '\0') {
+ static wchar_t ptszBuf[128];
+ mir_snwprintf(ptszBuf, L"%c%s", szIndicator, ui->pszNick);
+ m_nickList.SendMsg(LB_ADDSTRING, 0, (LPARAM)ptszBuf);
+ }
+ else m_nickList.SendMsg(LB_ADDSTRING, 0, (LPARAM)ui->pszNick);
+ }
+ }
+ m_nickList.SendMsg(WM_SETREDRAW, TRUE, 0);
+ InvalidateRect(m_nickList.GetHwnd(), NULL, FALSE);
+ UpdateWindow(m_nickList.GetHwnd());
+ SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ break;
- case SESSION_ONLINE:
- SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- return TRUE;
+ case GC_CONTROL_MSG:
+ switch (wParam) {
+ case SESSION_OFFLINE:
+ SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ SendMessage(m_si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ return TRUE;
- case WINDOW_HIDDEN:
- SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case SESSION_ONLINE:
+ SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ return TRUE;
- case WINDOW_CLEARLOG:
- m_log.SetText(L"");
- return TRUE;
+ case WINDOW_HIDDEN:
+ SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case SESSION_TERMINATE:
- if (pcli->pfnGetEvent(m_hContact, 0))
- pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
- m_si->wState &= ~STATE_TALK;
- db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
- SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case WINDOW_CLEARLOG:
+ m_log.SetText(L"");
+ return TRUE;
- case WINDOW_MINIMIZE:
- ShowWindow(m_hwnd, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
+ case SESSION_TERMINATE:
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
+ m_si->wState &= ~STATE_TALK;
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
+ SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_MAXIMIZE:
- ShowWindow(m_hwnd, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MINIMIZE:
+ ShowWindow(m_hwnd, SW_MINIMIZE);
+ goto LABEL_SHOWWINDOW;
- case SESSION_INITDONE:
- if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(m_hwnd))
- ShowWindow(m_hwnd, SW_NORMAL);
- LABEL_SHOWWINDOW:
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
- SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
- SendMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
- SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- ShowWindow(m_hwnd, SW_SHOW);
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
- SetForegroundWindow(m_hwnd);
+ case WINDOW_MAXIMIZE:
+ ShowWindow(m_hwnd, SW_MAXIMIZE);
+ goto LABEL_SHOWWINDOW;
+
+ case SESSION_INITDONE:
+ if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0)
return TRUE;
- }
- break;
+ // fall through
+ case WINDOW_VISIBLE:
+ if (IsIconic(m_hwnd))
+ ShowWindow(m_hwnd, SW_NORMAL);
+ LABEL_SHOWWINDOW:
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
+ SendMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
+ SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
+ ShowWindow(m_hwnd, SW_SHOW);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ SetForegroundWindow(m_hwnd);
+ return TRUE;
+ }
+ break;
- case GC_SPLITTERMOVED:
- if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTERX)) {
- GetClientRect(m_hwnd, &rc);
- pt.x = wParam; pt.y = 0;
- ScreenToClient(m_hwnd, &pt);
-
- m_si->iSplitterX = rc.right - pt.x + 1;
- if (m_si->iSplitterX < 35)
- m_si->iSplitterX = 35;
- if (m_si->iSplitterX > rc.right - rc.left - 35)
- m_si->iSplitterX = rc.right - rc.left - 35;
- g_Settings.iSplitterX = m_si->iSplitterX;
- }
- else if ((HWND)lParam == GetDlgItem(m_hwnd, IDC_SPLITTERY)) {
- GetClientRect(m_hwnd, &rc);
- pt.x = 0; pt.y = wParam;
- ScreenToClient(m_hwnd, &pt);
- m_si->iSplitterY = rc.bottom - pt.y;
- g_Settings.iSplitterY = m_si->iSplitterY;
+ case GC_FIREHOOK:
+ if (lParam) {
+ NotifyEventHooks(pci->hSendEvent, 0, lParam);
+ GCHOOK *gch = (GCHOOK*)lParam;
+ if (gch->pDest) {
+ mir_free((void*)gch->pDest->ptszID);
+ mir_free((void*)gch->pDest->pszModule);
+ mir_free(gch->pDest);
}
- PostMessage(m_hwnd, WM_SIZE, 0, 0);
- break;
+ mir_free(gch->ptszText);
+ mir_free(gch->ptszUID);
+ mir_free(gch->ptszNick);
+ mir_free(gch);
+ }
+ break;
- case GC_FIREHOOK:
- if (lParam) {
- NotifyEventHooks(pci->hSendEvent, 0, lParam);
- GCHOOK *gch = (GCHOOK*)lParam;
- if (gch->pDest) {
- mir_free((void*)gch->pDest->ptszID);
- mir_free((void*)gch->pDest->pszModule);
- mir_free(gch->pDest);
- }
- mir_free(gch->ptszText);
- mir_free(gch->ptszUID);
- mir_free(gch->ptszNick);
- mir_free(gch);
- }
- break;
+ case GC_CHANGEFILTERFLAG:
+ m_si->iLogFilterFlags = lParam;
+ break;
- case GC_CHANGEFILTERFLAG:
- m_si->iLogFilterFlags = lParam;
- break;
+ case GC_SHOWFILTERMENU:
+ {
+ HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)m_si);
+ TranslateDialogDefault(hwnd);
+ GetWindowRect(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), &rc);
+ SetWindowPos(hwnd, HWND_TOP, rc.left - 85, (IsWindowVisible(GetDlgItem(m_hwnd, IDC_CHAT_FILTER)) || IsWindowVisible(GetDlgItem(m_hwnd, IDC_CHAT_BOLD))) ? rc.top - 206 : rc.top - 186, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+ }
+ break;
- case GC_SHOWFILTERMENU:
- {
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)m_si);
- TranslateDialogDefault(hwnd);
- GetWindowRect(GetDlgItem(m_hwnd, IDC_CHAT_FILTER), &rc);
- SetWindowPos(hwnd, HWND_TOP, rc.left - 85, (IsWindowVisible(GetDlgItem(m_hwnd, IDC_CHAT_FILTER)) || IsWindowVisible(GetDlgItem(m_hwnd, IDC_CHAT_BOLD))) ? rc.top - 206 : rc.top - 186, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
- }
- break;
+ case GC_SHOWCOLORCHOOSER:
+ pci->ColorChooser(m_si, lParam == IDC_CHAT_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, lParam));
+ break;
- case GC_SHOWCOLORCHOOSER:
- pci->ColorChooser(m_si, lParam == IDC_CHAT_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, lParam));
- break;
+ case GC_SCROLLTOBOTTOM:
+ if ((GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) != 0) {
+ SCROLLINFO sci = { 0 };
+ sci.cbSize = sizeof(sci);
+ sci.fMask = SIF_PAGE | SIF_RANGE;
+ GetScrollInfo(m_log.GetHwnd(), SB_VERT, &sci);
+
+ sci.fMask = SIF_POS;
+ sci.nPos = sci.nMax - sci.nPage + 1;
+ SetScrollInfo(m_log.GetHwnd(), SB_VERT, &sci, TRUE);
+
+ CHARRANGE sel;
+ sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd(), CP_ACP, FALSE);
+ m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
+ PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
+ }
+ break;
- case GC_SCROLLTOBOTTOM:
- if ((GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) != 0) {
- SCROLLINFO sci = { 0 };
- sci.cbSize = sizeof(sci);
- sci.fMask = SIF_PAGE | SIF_RANGE;
- GetScrollInfo(m_log.GetHwnd(), SB_VERT, &sci);
-
- sci.fMask = SIF_POS;
- sci.nPos = sci.nMax - sci.nPage + 1;
- SetScrollInfo(m_log.GetHwnd(), SB_VERT, &sci, TRUE);
-
- CHARRANGE sel;
- sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd(), CP_ACP, FALSE);
- m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
- PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
- }
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) != WA_ACTIVE)
break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
-
- //fall through
- case WM_MOUSEACTIVATE:
- if (uMsg != WM_ACTIVATE)
- SetFocus(m_message.GetHwnd());
+ //fall through
+ case WM_MOUSEACTIVATE:
+ if (uMsg != WM_ACTIVATE)
+ SetFocus(m_message.GetHwnd());
- pci->SetActiveSession(m_si->ptszID, m_si->pszModule);
+ pci->SetActiveSession(m_si->ptszID, m_si->pszModule);
- if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
- db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
- if (pcli->pfnGetEvent(m_hContact, 0))
- pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
- break;
-
- case WM_NOTIFY:
- {
- LPNMHDR pNmhdr = (LPNMHDR)lParam;
- switch (pNmhdr->code) {
- case EN_REQUESTRESIZE:
- if (pNmhdr->idFrom == IDC_MESSAGE) {
- REQRESIZE *rr = (REQRESIZE *)lParam;
- int height = rr->rc.bottom - rr->rc.top + 1;
- if (height < g_dat.minInputAreaHeight)
- height = g_dat.minInputAreaHeight;
-
- if (m_si->desiredInputAreaHeight != height) {
- m_si->desiredInputAreaHeight = height;
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
- PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
- }
- }
- break;
+ if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
+ break;
- case EN_MSGFILTER:
- if (pNmhdr->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
+ case WM_NOTIFY:
+ {
+ LPNMHDR pNmhdr = (LPNMHDR)lParam;
+ switch (pNmhdr->code) {
+ case EN_MSGFILTER:
+ if (pNmhdr->idFrom == IDC_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ break;
- case TTN_NEEDTEXT:
- if (pNmhdr->idFrom == (UINT_PTR)m_nickList.GetHwnd()) {
- LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lParam;
- SESSION_INFO* parentdat = (SESSION_INFO*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
-
- POINT p;
- GetCursorPos(&p);
- ScreenToClient(m_nickList.GetHwnd(), &p);
- int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
- if (ui != NULL) {
- static wchar_t ptszBuf[1024];
- mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
- TranslateT("Nickname"), ui->pszNick,
- TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
- lpttd->lpszText = ptszBuf;
- }
+ case TTN_NEEDTEXT:
+ if (pNmhdr->idFrom == (UINT_PTR)m_nickList.GetHwnd()) {
+ LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lParam;
+ SESSION_INFO* parentdat = (SESSION_INFO*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
+
+ POINT p;
+ GetCursorPos(&p);
+ ScreenToClient(m_nickList.GetHwnd(), &p);
+ int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y)));
+ USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
+ if (ui != NULL) {
+ static wchar_t ptszBuf[1024];
+ mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
+ TranslateT("Nickname"), ui->pszNick,
+ TranslateT("Unique ID"), ui->pszUID,
+ TranslateT("Status"), pci->TM_WordToString(parentdat->pStatuses, ui->Status));
+ lpttd->lpszText = ptszBuf;
}
- break;
}
+ break;
}
+ }
+ break;
+
+ case WM_COMMAND:
+ if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_hContact))
break;
- case WM_COMMAND:
- if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_hContact))
+ if (HIWORD(wParam) == BN_CLICKED)
+ if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
+ Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0);
break;
+ }
- if (HIWORD(wParam) == BN_CLICKED)
- if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0);
- break;
- }
+ switch (LOWORD(wParam)) {
+ case IDC_CHAT_LIST:
+ if (HIWORD(wParam) == LBN_DBLCLK) {
+ TVHITTESTINFO hti;
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(m_nickList.GetHwnd(), &hti.pt);
- switch (LOWORD(wParam)) {
- case IDC_CHAT_LIST:
- if (HIWORD(wParam) == LBN_DBLCLK) {
- TVHITTESTINFO hti;
- hti.pt.x = (short)LOWORD(GetMessagePos());
- hti.pt.y = (short)HIWORD(GetMessagePos());
- ScreenToClient(m_nickList.GetHwnd(), &hti.pt);
-
- int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui) {
- if (GetKeyState(VK_SHIFT) & 0x8000) {
- LRESULT lResult = (LRESULT)m_message.SendMsg(EM_GETSEL, 0, 0);
- int start = LOWORD(lResult);
- size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 4);
- wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
- if (start == 0)
- mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
- else
- mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
-
- m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)pszName);
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- }
- else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
- }
+ int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
+ USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
+ if (ui) {
+ if (GetKeyState(VK_SHIFT) & 0x8000) {
+ LRESULT lResult = (LRESULT)m_message.SendMsg(EM_GETSEL, 0, 0);
+ int start = LOWORD(lResult);
+ size_t dwNameLenMax = (mir_wstrlen(ui->pszUID) + 4);
+ wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax);
+ if (start == 0)
+ mir_snwprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID);
+ else
+ mir_snwprintf(pszName, dwNameLenMax, L"%s ", ui->pszUID);
- return TRUE;
+ m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)pszName);
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ }
+ else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
}
- if (HIWORD(wParam) == LBN_KILLFOCUS)
- RedrawWindow(m_nickList.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
- break;
-
- case IDOK:
- if (IsWindowEnabled(GetDlgItem(m_hwnd, IDOK))) {
- char *pszRtf = GetRichTextRTF(m_message.GetHwnd());
- if (pszRtf == NULL)
- break;
+ return TRUE;
+ }
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
- if (mi == NULL)
- break;
+ if (HIWORD(wParam) == LBN_KILLFOCUS)
+ RedrawWindow(m_nickList.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+ break;
- TCmdList *cmdListNew = tcmdlist_last(m_si->cmdList);
- while (cmdListNew != NULL && cmdListNew->temporary) {
- m_si->cmdList = tcmdlist_remove(m_si->cmdList, cmdListNew);
- cmdListNew = tcmdlist_last(m_si->cmdList);
- }
+ case IDOK:
+ if (IsWindowEnabled(GetDlgItem(m_hwnd, IDOK))) {
+ char *pszRtf = GetRichTextRTF(m_message.GetHwnd());
+ if (pszRtf == NULL)
+ break;
- // takes pszRtf to a queue, no leak here
- m_si->cmdList = tcmdlist_append(m_si->cmdList, pszRtf, 20, FALSE);
+ MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ if (mi == NULL)
+ break;
- CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
- pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
- ptszText.Trim();
- ptszText.Replace(L"%", L"%%");
+ TCmdList *cmdListNew = tcmdlist_last(cmdList);
+ while (cmdListNew != NULL && cmdListNew->temporary) {
+ cmdList = tcmdlist_remove(cmdList, cmdListNew);
+ cmdListNew = tcmdlist_last(cmdList);
+ }
- if (mi->bAckMsg) {
- EnableWindow(m_message.GetHwnd(), FALSE);
- m_message.SendMsg(EM_SETREADONLY, TRUE, 0);
- }
- else SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
+ // takes pszRtf to a queue, no leak here
+ cmdList = tcmdlist_append(cmdList, pszRtf, 20, FALSE);
- EnableWindow(GetDlgItem(m_hwnd, IDOK), FALSE);
+ CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
+ pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors);
+ ptszText.Trim();
+ ptszText.Replace(L"%", L"%%");
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
- SetFocus(m_message.GetHwnd());
+ if (mi->bAckMsg) {
+ EnableWindow(m_message.GetHwnd(), FALSE);
+ m_message.SendMsg(EM_SETREADONLY, TRUE, 0);
}
- break;
+ else SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
- case IDC_CHAT_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_SHOWNICKLIST)))
- break;
- if (m_si->iType == GCW_SERVER)
- break;
+ EnableWindow(GetDlgItem(m_hwnd, IDOK), FALSE);
- m_si->bNicklistEnabled = !m_si->bNicklistEnabled;
+ pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
+ SetFocus(m_message.GetHwnd());
+ }
+ break;
- SendDlgItemMessage(m_hwnd, IDC_CHAT_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
- SendMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ case IDC_CHAT_SHOWNICKLIST:
+ if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_SHOWNICKLIST)))
break;
-
- case IDC_MESSAGE:
- if (HIWORD(wParam) == EN_CHANGE) {
- m_si->cmdListCurrent = NULL;
- EnableWindow(GetDlgItem(m_hwnd, IDOK), GetRichTextLength(m_message.GetHwnd(), 1200, FALSE) != 0);
- }
+ if (m_si->iType == GCW_SERVER)
break;
- case IDC_HISTORY:
- if (IsWindowEnabled(GetDlgItem(m_hwnd, IDC_HISTORY))) {
- MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
- if (pInfo)
- ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(m_si, 0), NULL, NULL, SW_SHOW);
- }
- break;
+ m_si->bNicklistEnabled = !m_si->bNicklistEnabled;
- case IDC_CHAT_CHANMGR:
- if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_CHANMGR)))
- break;
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
+ SendMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
+ SendMessage(m_hwnd, WM_SIZE, 0, 0);
+ break;
+
+ case IDC_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ cmdListCurrent = NULL;
+ EnableWindow(GetDlgItem(m_hwnd, IDOK), GetRichTextLength(m_message.GetHwnd(), 1200, FALSE) != 0);
+ }
+ break;
+
+ case IDC_HISTORY:
+ if (IsWindowEnabled(GetDlgItem(m_hwnd, IDC_HISTORY))) {
+ MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
+ if (pInfo)
+ ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(m_si, 0), NULL, NULL, SW_SHOW);
+ }
+ break;
+
+ case IDC_CHAT_CHANMGR:
+ if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_CHANMGR)))
break;
+ pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
+ break;
- case IDC_CHAT_FILTER:
- if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_FILTER)))
- break;
+ case IDC_CHAT_FILTER:
+ if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_FILTER)))
+ break;
- m_si->bFilterEnabled = !m_si->bFilterEnabled;
- SendDlgItemMessage(m_hwnd, IDC_CHAT_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
- if (m_si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) {
- SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
- break;
- }
- SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
+ m_si->bFilterEnabled = !m_si->bFilterEnabled;
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
+ if (m_si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) {
+ SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
break;
+ }
+ SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
+ break;
- case IDC_CHAT_BKGCOLOR:
- if (IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_BKGCOLOR))) {
- MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
-
- if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_BKGCOLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
- SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_BKGCOLOR);
- else if (m_si->bBGSet) {
- cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = pInfo->crColors[m_si->iBG];
- if (pInfo->bSingleFormat)
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- else
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
+ case IDC_CHAT_BKGCOLOR:
+ if (IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_BKGCOLOR))) {
+ MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
+
+ if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_BKGCOLOR)) {
+ if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_BKGCOLOR);
+ else if (m_si->bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ cf.crBackColor = pInfo->crColors[m_si->iBG];
if (pInfo->bSingleFormat)
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
else
m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
- break;
+ else {
+ cf.dwMask = CFM_BACKCOLOR;
+ cf.crBackColor = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ if (pInfo->bSingleFormat)
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ else
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ }
+ }
+ break;
- case IDC_CHAT_COLOR:
- {
- MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwEffects = 0;
+ case IDC_CHAT_COLOR:
+ {
+ MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_COLOR)))
- break;
+ if (!IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_COLOR)))
+ break;
- if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_COLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
- SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_COLOR);
- else if (m_si->bFGSet) {
- cf.dwMask = CFM_COLOR;
- cf.crTextColor = pInfo->crColors[m_si->iFG];
- if (pInfo->bSingleFormat)
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- else
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- }
- else {
- COLORREF cr;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr);
+ if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_COLOR)) {
+ if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_COLOR);
+ else if (m_si->bFGSet) {
cf.dwMask = CFM_COLOR;
- cf.crTextColor = cr;
+ cf.crTextColor = pInfo->crColors[m_si->iFG];
if (pInfo->bSingleFormat)
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
else
m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
- break;
-
- case IDC_CHAT_BOLD:
- case IDC_CHAT_ITALICS:
- case IDC_CHAT_UNDERLINE:
- {
- MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
- CHARFORMAT2 cf;
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
- cf.dwEffects = 0;
-
- if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_BOLD)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_ITALICS)))
- break;
- if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_UNDERLINE)))
- break;
- if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_BOLD))
- cf.dwEffects |= CFE_BOLD;
- if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_ITALICS))
- cf.dwEffects |= CFE_ITALIC;
- if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_UNDERLINE))
- cf.dwEffects |= CFE_UNDERLINE;
+ else {
+ COLORREF cr;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr);
+ cf.dwMask = CFM_COLOR;
+ cf.crTextColor = cr;
if (pInfo->bSingleFormat)
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
else
m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
- break;
-
- case IDCANCEL:
- PostMessage(m_hwnd, WM_CLOSE, 0, 0);
}
break;
- case WM_KEYDOWN:
- SetFocus(m_message.GetHwnd());
- break;
-
- case WM_GETMINMAXINFO:
+ case IDC_CHAT_BOLD:
+ case IDC_CHAT_ITALICS:
+ case IDC_CHAT_UNDERLINE:
{
- MINMAXINFO* mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = m_si->iSplitterX + 43;
- if (mmi->ptMinTrackSize.x < 350)
- mmi->ptMinTrackSize.x = 350;
+ MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
+ cf.dwEffects = 0;
- mmi->ptMinTrackSize.y = m_si->m_minLogBoxHeight + TOOLBAR_HEIGHT + m_si->m_minEditBoxHeight + 5;
+ if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_BOLD)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_ITALICS)))
+ break;
+ if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHAT_UNDERLINE)))
+ break;
+ if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_BOLD))
+ cf.dwEffects |= CFE_BOLD;
+ if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_ITALICS))
+ cf.dwEffects |= CFE_ITALIC;
+ if (IsDlgButtonChecked(m_hwnd, IDC_CHAT_UNDERLINE))
+ cf.dwEffects |= CFE_UNDERLINE;
+ if (pInfo->bSingleFormat)
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ else
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
break;
- case WM_LBUTTONDBLCLK:
- if (LOWORD(lParam) < 30)
- PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
- else
- SendMessage(m_hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- break;
+ case IDCANCEL:
+ PostMessage(m_hwnd, WM_CLOSE, 0, 0);
+ }
+ break;
- case WM_LBUTTONDOWN:
- SendMessage(m_hwndParent, WM_LBUTTONDOWN, wParam, lParam);
- return TRUE;
+ case WM_KEYDOWN:
+ SetFocus(m_message.GetHwnd());
+ break;
- case DM_GETCONTEXTMENU:
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, (LPARAM)Menu_BuildContactMenu(m_hContact));
- return TRUE;
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO *mmi = (MINMAXINFO*)lParam;
+ mmi->ptMinTrackSize.x = m_si->iSplitterX + 43;
+ if (mmi->ptMinTrackSize.x < 350)
+ mmi->ptMinTrackSize.x = 350;
- case WM_CONTEXTMENU:
- if (m_hwndParent == (HWND)wParam) {
- HMENU hMenu = Menu_BuildContactMenu(m_hContact);
- GetCursorPos(&pt);
- TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, NULL);
- DestroyMenu(hMenu);
- }
- break;
+ mmi->ptMinTrackSize.y = m_minLogBoxHeight + TOOLBAR_HEIGHT + m_minEditBoxHeight + 5;
+ }
+ break;
- case GC_CLOSEWINDOW:
- Close();
- break;
+ case WM_LBUTTONDBLCLK:
+ if (LOWORD(lParam) < 30)
+ PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
+ else
+ SendMessage(m_hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ break;
+
+ case WM_LBUTTONDOWN:
+ SendMessage(m_hwndParent, WM_LBUTTONDOWN, wParam, lParam);
+ return TRUE;
+
+ case DM_GETCONTEXTMENU:
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, (LPARAM)Menu_BuildContactMenu(m_hContact));
+ return TRUE;
+
+ case WM_CONTEXTMENU:
+ if (m_hwndParent == (HWND)wParam) {
+ HMENU hMenu = Menu_BuildContactMenu(m_hContact);
+ GetCursorPos(&pt);
+ TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, NULL);
+ DestroyMenu(hMenu);
}
- return CSrmmBaseDialog::DlgProc(uMsg, wParam, lParam);
+ break;
+
+ case GC_CLOSEWINDOW:
+ Close();
+ break;
}
-};
+ return CSrmmBaseDialog::DlgProc(uMsg, wParam, lParam);
+}
void ShowRoom(SESSION_INFO *si)
{
@@ -1805,7 +1751,7 @@ void ShowRoom(SESSION_INFO *si)
pDlg->SetParent(hParent);
pDlg->Show();
- si->m_pParent = (ParentWindowData*)GetWindowLongPtr(hParent, GWLP_USERDATA);
+ pDlg->m_pParent = (ParentWindowData*)GetWindowLongPtr(hParent, GWLP_USERDATA);
si->hWnd = pDlg->GetHwnd();
}
SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si);