diff options
28 files changed, 332 insertions, 367 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 886c83d22f..1342e2b591 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -421,10 +421,13 @@ protected: protected:
CCtrlEdit *m_pLog, *m_pEntry;
+ SESSION_INFO *m_si;
public:
MCONTACT m_hContact;
+ __forceinline bool isChat() const { return m_si != nullptr; }
+
__inline void* operator new(size_t size){ return calloc(1, size); }
__inline void operator delete(void* p) { free(p); }
};
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 01af618b2c..635b465d5f 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 53dc7ef50d..20a5dae756 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 251bb7acf1..c48e0c8ea5 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -118,7 +118,7 @@ LBL_SkipEnd: }
}
-static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL isShift = GetKeyState(VK_SHIFT) & 0x8000;
BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
@@ -459,7 +459,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
-static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CChatRoomDlg::LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static BOOL inMenu = FALSE;
CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
@@ -582,7 +582,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return mir_callNextSubclass(hwnd, LogSubclassProc, msg, wParam, lParam);
}
-static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CChatRoomDlg *pDlg = (CChatRoomDlg*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
@@ -863,7 +863,6 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
: CScriverWindow(IDD_CHANNEL),
- m_si(si),
m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
@@ -883,6 +882,7 @@ 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;
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 8e04ec88d5..e7b9e57086 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -175,8 +175,11 @@ class CChatRoomDlg : public CScriverWindow void MessageDialogResize(int w, int h);
+ 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);
+
public:
- SESSION_INFO *m_si;
wchar_t m_wszSearch[255];
public:
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index eb52e2f727..2ea44eae73 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -145,7 +145,7 @@ void CTabBaseDlg::BB_InitDlgButtons() BYTE gap = DPISCALEX_S(db_get_b(0, SRMSGMOD, "ButtonsBarGap", 1)); RECT rcSplitter; - GetWindowRect(GetDlgItem(m_hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTERY : IDC_SPLITTERY), &rcSplitter); + GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTERY), &rcSplitter); POINT ptSplitter = { 0, rcSplitter.top }; ScreenToClient(m_hwnd, &ptSplitter); @@ -154,7 +154,7 @@ void CTabBaseDlg::BB_InitDlgButtons() m_bbLSideWidth = m_bbRSideWidth = 0; - Srmm_CreateToolbarIcons(m_hwnd, (m_bType == SESSIONTYPE_IM) ? BBBF_ISIMBUTTON : BBBF_ISCHATBUTTON); + Srmm_CreateToolbarIcons(m_hwnd, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON); CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { @@ -226,7 +226,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() int splitterY = (!bBottomToolbar) ? ptSplitter.y - DPISCALEY_S(1) : rect.bottom; int tempL = m_bbLSideWidth, tempR = m_bbRSideWidth; int lwidth = 0, rwidth = 0; - int iOff = DPISCALEY_S((PluginConfig.m_DPIscaleY > 1.0) ? (m_bType == SESSIONTYPE_IM ? 22 : 23) : 22); + int iOff = DPISCALEY_S((PluginConfig.m_DPIscaleY > 1.0) ? (!isChat() ? 22 : 23) : 22); int foravatar = 0; if ((rect.bottom - ptSplitter.y - (rcSplitter.bottom - rcSplitter.top) /*- DPISCALEY(2)*/ - (bBottomToolbar ? DPISCALEY_S(24) : 0) < m_pic.cy - DPISCALEY_S(2)) && m_bShowAvatar && !PluginConfig.m_bAlwaysFullToolbarWidth) @@ -244,7 +244,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (cbd->m_bRSided) // filter only left buttons continue; - if (((m_bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((m_bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { + if ((!isChat() && cbd->m_bIMButton) || (isChat() && cbd->m_bChatButton)) { HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (!showToolbar) { @@ -294,7 +294,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (!cbd->m_bRSided) // filter only right buttons continue; - if (((m_bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((m_bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { + if ((!isChat() && cbd->m_bIMButton) || (isChat() && cbd->m_bChatButton)) { HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (!showToolbar) { diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 25cd8b3d65..cb7780da7f 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -149,7 +149,7 @@ bool IsStringValidLink(wchar_t *pszText) void CChatRoomDlg::UpdateWindowState(UINT msg) { - if (si == nullptr) + if (m_si == nullptr) return; if (msg == WM_ACTIVATE) { @@ -188,14 +188,14 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) m_pContainer->hwndSaved = m_hwnd; - pci->SetActiveSession(si->ptszID, si->pszModule); + pci->SetActiveSession(m_si->ptszID, m_si->pszModule); m_hTabIcon = m_hTabStatusIcon; if (m_iTabID >= 0) { - if (db_get_w(si->hContact, si->pszModule, "ApparentMode", 0) != 0) - db_set_w(si->hContact, si->pszModule, "ApparentMode", 0); - if (pcli->pfnGetEvent(si->hContact, 0)) - pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); + if (db_get_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0) != 0) + db_set_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0); + if (pcli->pfnGetEvent(m_si->hContact, 0)) + pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT); SendMessage(m_hwnd, GC_UPDATETITLE, 0, 1); m_dwTickLastEvent = 0; @@ -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 = si->iType != GCW_SERVER && si->bNicklistEnabled; + bool bNick = m_si->iType != GCW_SERVER && m_si->bNicklistEnabled; bool bInfoPanel = m_pPanel.isActive(); int panelHeight = m_pPanel.getHeight() + 1; int iSplitterX = m_pContainer->settings->iSplitterX; @@ -264,14 +264,14 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) if (m_bIsAutosizingInput) Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, SW_HIDE); - if (si->iType != GCW_SERVER) { - Utils::showDlgControl(m_hwnd, IDC_LIST, si->bNicklistEnabled ? SW_SHOW : SW_HIDE); - Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, si->bNicklistEnabled ? SW_SHOW : 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); m_btnNickList.Enable(true); m_btnFilter.Enable(true); - if (si->iType == GCW_CHATROOM) { - MODULEINFO *tmp = pci->MM_FindModule(si->pszModule); + if (m_si->iType == GCW_CHATROOM) { + MODULEINFO *tmp = pci->MM_FindModule(m_si->pszModule); if (tmp) m_btnChannelMgr.Enable(tmp->bChanMgr); } @@ -281,7 +281,7 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc) Utils::showDlgControl(m_hwnd, IDC_SPLITTERX, SW_HIDE); } - if (si->iType == GCW_SERVER) { + if (m_si->iType == GCW_SERVER) { m_btnNickList.Enable(false); m_btnFilter.Enable(false); m_btnChannelMgr.Enable(false); @@ -468,17 +468,17 @@ LBL_SkipEnd: return false; } -static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndParent = GetParent(hwnd); CChatRoomDlg *mwdat = (CChatRoomDlg*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (mwdat != nullptr) - if (mwdat->m_fkeyProcessed && (msg == WM_KEYUP)) { + if (mwdat->m_bkeyProcessed && (msg == WM_KEYUP)) { GetKeyboardState(mwdat->kstate); if (!(mwdat->kstate[VK_CONTROL] & 0x80) && !(mwdat->kstate[VK_SHIFT] & 0x80)) - mwdat->m_fkeyProcessed = false; + mwdat->m_bkeyProcessed = false; return 0; } @@ -504,7 +504,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, RemoveMenu(hSubMenu, 8, MF_BYPOSITION); RemoveMenu(hSubMenu, 4, MF_BYPOSITION); - MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(mwdat->m_si->pszModule); EnableMenuItem(hSubMenu, IDM_PASTEFORMATTED, MF_BYCOMMAND | ((mi && mi->bBold) ? MF_ENABLED : MF_GRAYED)); TranslateMenu(hSubMenu); @@ -569,16 +569,16 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; case WM_SYSKEYDOWN: - mwdat->m_fkeyProcessed = false; + mwdat->m_bkeyProcessed = false; if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE)) { - mwdat->m_fkeyProcessed = true; + mwdat->m_bkeyProcessed = true; return 0; } break; case WM_SYSCHAR: - if (mwdat->m_fkeyProcessed) { - mwdat->m_fkeyProcessed = false; // preceeding key event has been processed by miranda hotkey service + if (mwdat->m_bkeyProcessed) { + mwdat->m_bkeyProcessed = false; // preceeding key event has been processed by miranda hotkey service return 0; } @@ -598,7 +598,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SkinPlaySound("SoundOnTyping"); if (isCtrl && !isAlt && !isShift) { - MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(mwdat->m_si->pszModule); if (mi == nullptr) return 0; @@ -662,7 +662,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SkinPlaySound("SoundOnTyping"); if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) { - mwdat->m_fInsertMode = !mwdat->m_fInsertMode; + mwdat->m_bInsertMode = !mwdat->m_bInsertMode; SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd); } if (wParam == VK_CAPITAL || wParam == VK_NUMLOCK) @@ -740,9 +740,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(mwdat->m_pContainer->hwnd, DM_SELECTTAB, DM_SELECT_PREV, 0); return TRUE; } - if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete + if (wParam == VK_TAB && !isCtrl && !isShift) { // tab-autocomplete SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); - bool fCompleted = TabAutoComplete(hwnd, dat, mwdat->si); + bool fCompleted = TabAutoComplete(hwnd, dat, mwdat->m_si); SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE); if (!fCompleted && !PluginConfig.m_bAllowTab) { @@ -773,9 +773,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (wParam == VK_UP && isCtrl && !isAlt) { - char *lpPrevCmd = pci->SM_GetPrevCommand(mwdat->si->ptszID, mwdat->si->pszModule); + char *lpPrevCmd = pci->SM_GetPrevCommand(mwdat->m_si->ptszID, mwdat->m_si->pszModule); - if (!mwdat->si->lpCurrentCommand || !mwdat->si->lpCurrentCommand->last) { + if (!mwdat->m_si->lpCurrentCommand || !mwdat->m_si->lpCurrentCommand->last) { // Next command is not defined. It means currently entered text is not saved in the history and it // need to be saved in the window context. char *enteredText = Message_GetFromStream(hwndParent); @@ -817,7 +817,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, ste.flags = ST_DEFAULT; ste.codepage = CP_ACP; - char *lpPrevCmd = pci->SM_GetNextCommand(mwdat->si->ptszID, mwdat->si->pszModule); + char *lpPrevCmd = pci->SM_GetNextCommand(mwdat->m_si->ptszID, mwdat->m_si->pszModule); if (lpPrevCmd) SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd); else if (mwdat->m_enteredText) { @@ -859,17 +859,17 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, cf.dwEffects = 0; SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); { - MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(mwdat->m_si->pszModule); if (mi == nullptr) break; if (mi->bColor) { - int index = Chat_GetColorIndex(mwdat->si->pszModule, cf.crTextColor); + int index = Chat_GetColorIndex(mwdat->m_si->pszModule, cf.crTextColor); UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR); if (index >= 0) { - mwdat->si->bFGSet = true; - mwdat->si->iFG = index; + mwdat->m_si->bFGSet = true; + mwdat->m_si->iFG = index; } if (u == BST_UNCHECKED && cf.crTextColor != cr) @@ -879,13 +879,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (mi->bBkgColor) { - int index = Chat_GetColorIndex(mwdat->si->pszModule, cf.crBackColor); + int index = Chat_GetColorIndex(mwdat->m_si->pszModule, cf.crBackColor); COLORREF crB = (COLORREF)M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR); UINT u = IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR); if (index >= 0) { - mwdat->si->bBGSet = true; - mwdat->si->iBG = index; + mwdat->m_si->bBGSet = true; + mwdat->m_si->iBG = index; } if (u == BST_UNCHECKED && cf.crBackColor != crB) @@ -1177,16 +1177,16 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case WM_SYSKEYDOWN: - mwdat->m_fkeyProcessed = false; + mwdat->m_bkeyProcessed = false; if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG)) { - mwdat->m_fkeyProcessed = true; + mwdat->m_bkeyProcessed = true; return 0; } break; case WM_SYSCHAR: - if (mwdat->m_fkeyProcessed) { - mwdat->m_fkeyProcessed = false; + if (mwdat->m_bkeyProcessed) { + mwdat->m_bkeyProcessed = false; return 0; } break; @@ -1219,7 +1219,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR ///////////////////////////////////////////////////////////////////////////////////////// // subclassing for the nickname list control.It is an ownerdrawn listbox -static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK CChatRoomDlg::NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hwndParent = GetParent(hwnd); CChatRoomDlg *dat = (CChatRoomDlg*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); @@ -1242,10 +1242,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 || dat->si->nUsersInNicklist <= 0) + if (index == LB_ERR || dat->m_si->nUsersInNicklist <= 0) return 0; - int items = dat->si->nUsersInNicklist - index; + int items = dat->m_si->nUsersInNicklist - index; int height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0); if (height != LB_ERR) { @@ -1347,7 +1347,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, // string we have int i, iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0); for (i = 0; i < iItems; i++) { - USERINFO *ui = pci->UM_FindUserFromIndex(dat->si->pUsers, i); + USERINFO *ui = pci->UM_FindUserFromIndex(dat->m_si->pUsers, i); if (ui) { if (!wcsnicmp(ui->pszNick, dat->m_wszSearch, mir_wstrlen(dat->m_wszSearch))) { SendMessage(hwnd, LB_SETSEL, FALSE, -1); @@ -1398,7 +1398,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_CONTEXTMENU: { - SESSION_INFO *si = dat->si; + SESSION_INFO *si = dat->m_si; if (si == nullptr) break; @@ -1479,7 +1479,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; case WM_MOUSEMOVE: - Chat_HoverMouse(dat->si, hwnd, lParam, M.GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")); + Chat_HoverMouse(dat->m_si, hwnd, lParam, M.GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")); break; } return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam); @@ -1519,7 +1519,7 @@ static void __cdecl phase2(void * lParam) // the actual group chat session window procedure.Handles the entire chat session window // which is usually a (tabbed) child of a container class window. -CChatRoomDlg::CChatRoomDlg(SESSION_INFO *_si) +CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : CTabBaseDlg(IDD_CHANNEL), m_btnOk(this, IDOK), m_list(this, IDC_LIST), @@ -1533,9 +1533,7 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *_si) m_btnUnderline(this, IDC_UNDERLINE), m_btnNickList(this, IDC_SHOWNICKLIST) { - m_bType = SESSIONTYPE_CHAT; - - si = _si; + m_si = si; m_hContact = si->hContact; m_szProto = GetContactProto(si->hContact); @@ -1556,21 +1554,21 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *_si) CThumbBase* CChatRoomDlg::CreateThumb(CProxyWindow *pProxy) const { - return new CThumbMUC(pProxy, si); + return new CThumbMUC(pProxy, m_si); } void CChatRoomDlg::ClearLog() { - SESSION_INFO *s = pci->SM_FindSession(si->ptszID, si->pszModule); + SESSION_INFO *s = pci->SM_FindSession(m_si->ptszID, m_si->pszModule); if (s) { m_log.SetText(L""); pci->LM_RemoveAll(&s->pLog, &s->pLogEnd); s->iEventCount = 0; s->LastTime = 0; - si->iEventCount = 0; - si->LastTime = 0; - si->pLog = s->pLog; - si->pLogEnd = s->pLogEnd; + m_si->iEventCount = 0; + m_si->LastTime = 0; + m_si->pLog = s->pLog; + m_si->pLogEnd = s->pLogEnd; PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); } } @@ -1583,8 +1581,8 @@ void CChatRoomDlg::OnInitDialog() m_cache->updateNick(); m_cache->updateUIN(); - si->hWnd = m_hwnd; - si->dat = this; + m_si->hWnd = m_hwnd; + m_si->dat = this; m_bIsAutosizingInput = IsAutoSplitEnabled(); m_fLimitedUpdate = false; m_iInputAreaHeight = -1; @@ -1596,7 +1594,7 @@ void CChatRoomDlg::OnInitDialog() CProxyWindow::add(this); // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) { + if (m_si->iType == GCW_PRIVMESS) { m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr); } @@ -1668,16 +1666,16 @@ void CChatRoomDlg::OnInitDialog() void CChatRoomDlg::OnDestroy() { // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) + if (m_si->iType == GCW_PRIVMESS) if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); - if (pcli->pfnGetEvent(si->hContact, 0)) - pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); - si->wState &= ~STATE_TALK; - si->hWnd = nullptr; - si->dat = nullptr; - si = nullptr; + if (pcli->pfnGetEvent(m_si->hContact, 0)) + pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT); + m_si->wState &= ~STATE_TALK; + m_si->hWnd = nullptr; + m_si->dat = nullptr; + m_si = nullptr; TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING, 0); @@ -1687,9 +1685,6 @@ void CChatRoomDlg::OnDestroy() if (PluginConfig.g_hMenuTrayUnread) DeleteMenu(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)m_hContact, MF_BYCOMMAND); - if (m_hSmileyIcon) - DestroyIcon(m_hSmileyIcon); - if (m_hwndTip) DestroyWindow(m_hwndTip); @@ -1727,12 +1722,12 @@ void CChatRoomDlg::OnClick_OK(CCtrlButton*) if (GetSendButtonState(m_hwnd) == PBS_DISABLED) return; - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); if (mi == nullptr) return; ptrA pszRtf(Message_GetFromStream(m_message.GetHwnd())); - pci->SM_AddCommand(si->ptszID, si->pszModule, pszRtf); + pci->SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf); CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf))); if (ptszText.IsEmpty()) @@ -1751,17 +1746,17 @@ void CChatRoomDlg::OnClick_OK(CCtrlButton*) Utils::enableDlgControl(m_hwnd, IDOK, false); // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) + if (m_si->iType == GCW_PRIVMESS) if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); bool fSound = true; - if (ptszText[0] == '/' || si->iType == GCW_SERVER) + if (ptszText[0] == '/' || m_si->iType == GCW_SERVER) fSound = false; - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0); mi->idleTimeStamp = time(0); mi->lastIdleCheck = 0; - pci->SM_BroadcastMessage(si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE); + pci->SM_BroadcastMessage(m_si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE); if (m_pContainer) if (fSound && !nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND)) SkinPlaySound("ChatSent"); @@ -1774,22 +1769,22 @@ void CChatRoomDlg::OnClick_Filter(CCtrlButton *pButton) if (!pButton->Enabled()) return; - if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) { + if (m_si->iLogFilterFlags == 0 && !m_si->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); - si->bFilterEnabled = false; + m_si->bFilterEnabled = false; } - else si->bFilterEnabled = !si->bFilterEnabled; + else m_si->bFilterEnabled = !m_si->bFilterEnabled; m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, - (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); + (LPARAM)(m_si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); - if (si->bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) { + if (m_si->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(si->hContact, CHAT_MODULE, "FilterEnabled", (BYTE)si->bFilterEnabled); + db_set_b(m_si->hContact, CHAT_MODULE, "FilterEnabled", (BYTE)m_si->bFilterEnabled); } void CChatRoomDlg::OnClick_History(CCtrlButton *pButton) @@ -1797,25 +1792,25 @@ void CChatRoomDlg::OnClick_History(CCtrlButton *pButton) if (!pButton->Enabled()) return; - MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule); - if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(si->pszModule, "IRC")) { + MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule); + if (ServiceExists("MSP/HTMLlog/ViewLog") && strstr(m_si->pszModule, "IRC")) { char szName[MAX_PATH]; - WideCharToMultiByte(CP_ACP, 0, si->ptszName, -1, szName, MAX_PATH, 0, 0); + WideCharToMultiByte(CP_ACP, 0, m_si->ptszName, -1, szName, MAX_PATH, 0, 0); szName[MAX_PATH - 1] = 0; - CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName); + CallService("MSP/HTMLlog/ViewLog", (WPARAM)m_si->pszModule, (LPARAM)szName); } else if (pInfo) - ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(si, 0), nullptr, nullptr, SW_SHOW); + ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW); } void CChatRoomDlg::OnClick_ShowNickList(CCtrlButton *pButton) { if (!pButton->Enabled()) return; - if (si->iType == GCW_SERVER) + if (m_si->iType == GCW_SERVER) return; - si->bNicklistEnabled = !si->bNicklistEnabled; + m_si->bNicklistEnabled = !m_si->bNicklistEnabled; SendMessage(m_hwnd, WM_SIZE, 0, 0); if (CSkin::m_skinEnabled) @@ -1826,7 +1821,7 @@ void CChatRoomDlg::OnClick_ShowNickList(CCtrlButton *pButton) void CChatRoomDlg::OnClick_ChanMgr(CCtrlButton *pButton) { if (pButton->Enabled()) - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0); } void CChatRoomDlg::OnClick_BIU(CCtrlButton *pButton) @@ -1861,9 +1856,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 (si->bFGSet) { + else if (m_si->bFGSet) { cf.dwMask = CFM_COLOR; - cf.crTextColor = pci->MM_FindModule(si->pszModule)->crColors[si->iFG]; + cf.crTextColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_si->iFG]; m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } } @@ -1888,9 +1883,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 (si->bBGSet) { + else if (m_si->bBGSet) { cf.dwMask = CFM_BACKCOLOR; - cf.crBackColor = pci->MM_FindModule(si->pszModule)->crColors[si->iBG]; + cf.crBackColor = pci->MM_FindModule(m_si->pszModule)->crColors[m_si->iBG]; m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } } @@ -1911,7 +1906,7 @@ void CChatRoomDlg::OnChange_Message(CCtrlEdit*) m_btnOk.Enable(GetRichTextLength(m_message.GetHwnd()) != 0); // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) { + if (m_si->iType == GCW_PRIVMESS) { if (!(GetKeyState(VK_CONTROL) & 0x8000)) { m_nLastTyping = GetTickCount(); if (GetWindowTextLength(m_message.GetHwnd())) { @@ -1934,7 +1929,7 @@ void CChatRoomDlg::OnDblClick_List(CCtrlListBox*) ScreenToClient(m_list.GetHwnd(), &hti.pt); int item = LOWORD(m_list.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); - USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, item); + USERINFO *ui = pci->UM_FindUserFromIndex(m_si->pUsers, item); if (ui == nullptr) return; @@ -1950,12 +1945,12 @@ void CChatRoomDlg::OnDblClick_List(CCtrlListBox*) PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); SetFocus(m_message.GetHwnd()); } - else pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); + else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); } INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (si == nullptr && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) + if (m_si == nullptr && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) return 0; POINT pt, tmp, cur; @@ -1980,14 +1975,14 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case GC_SETWNDPROPS: - pInfo = si ? pci->MM_FindModule(si->pszModule) : nullptr; + pInfo = m_si ? pci->MM_FindModule(m_si->pszModule) : nullptr; if (pInfo) { m_btnBold.Enable(pInfo->bBold); m_btnItalic.Enable(pInfo->bItalics); m_btnUnderline.Enable(pInfo->bUnderline); m_btnColor.Enable(pInfo->bColor); m_btnBkColor.Enable(pInfo->bBkgColor); - if (si->iType == GCW_CHATROOM) + if (m_si->iType == GCW_CHATROOM) m_btnChannelMgr.Enable(pInfo->bChanMgr); } m_log.SendMsg(EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); @@ -1998,7 +1993,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)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); + m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0); break; @@ -2006,7 +2001,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case DM_UPDATETITLE: case GC_UPDATETITLE: if (!m_bWasDeleted) { - m_wStatus = si->wStatus; + m_wStatus = m_si->wStatus; const wchar_t *szNick = m_cache->getNick(); if (mir_wstrlen(szNick) > 0) { @@ -2019,19 +2014,19 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) wchar_t szTemp[100]; HICON hIcon = 0; - switch (si->iType) { + switch (m_si->iType) { case GCW_CHATROOM: - hIcon = Skin_LoadProtoIcon(si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); + hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); mir_snwprintf(szTemp, - (si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user%s)") : TranslateT("%s: chat room (%u users%s)"), - szNick, si->nUsersInNicklist, si->bFilterEnabled ? TranslateT(", event filter active") : L""); + (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""); break; case GCW_PRIVMESS: - hIcon = Skin_LoadProtoIcon(si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); - if (si->nUsersInNicklist == 1) + hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); + if (m_si->nUsersInNicklist == 1) mir_snwprintf(szTemp, TranslateT("%s: message session"), szNick); else - mir_snwprintf(szTemp, TranslateT("%s: message session (%u users)"), szNick, si->nUsersInNicklist); + mir_snwprintf(szTemp, TranslateT("%s: message session (%u users)"), szNick, m_si->nUsersInNicklist); break; case GCW_SERVER: mir_snwprintf(szTemp, L"%s: Server", szNick); @@ -2071,11 +2066,11 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_pContainer->hwndActive != m_hwnd || m_pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || m_wszStatusBar[0]) break; - if (si->pszModule != nullptr) { + if (m_si->pszModule != nullptr) { wchar_t szFinalStatusBarText[512]; //Mad: strange rare crash here... - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); if (!mi) break; @@ -2106,8 +2101,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) mir_snwprintf(szFinalStatusBarText, TranslateT("%s on %s%s"), m_wszMyNickname, mi->ptszModDispName, mi->tszIdleMsg); } else { - if (si->ptszStatusbarText) - mir_snwprintf(szFinalStatusBarText, L"%s %s", mi->ptszModDispName, si->ptszStatusbarText); + if (m_si->ptszStatusbarText) + mir_snwprintf(szFinalStatusBarText, L"%s %s", mi->ptszModDispName, m_si->ptszStatusbarText); else wcsncpy_s(szFinalStatusBarText, mi->ptszModDispName, _TRUNCATE); } @@ -2160,30 +2155,30 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case GC_REDRAWLOG: - si->LastTime = 0; - if (si->pLog) { - LOGINFO * pLog = si->pLog; - if (si->iEventCount > 60) { + 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 == nullptr) break; pLog = pLog->next; - if ((si->iType != GCW_CHATROOM && si->iType != GCW_PRIVMESS) || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0) + if ((m_si->iType != GCW_CHATROOM && m_si->iType != GCW_PRIVMESS) || !m_si->bFilterEnabled || (m_si->iLogFilterFlags&pLog->iType) != 0) index++; } - StreamInEvents(pLog, si, TRUE); - mir_forkthread(phase2, si); + StreamInEvents(pLog, m_si, TRUE); + mir_forkthread(phase2, m_si); } - else StreamInEvents(si->pLogEnd, si, TRUE); + else StreamInEvents(m_si->pLogEnd, m_si, TRUE); } else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); break; case GC_REDRAWLOG2: - si->LastTime = 0; - if (si->pLog) - StreamInEvents(si->pLogEnd, si, TRUE); + m_si->LastTime = 0; + if (m_si->pLog) + StreamInEvents(m_si->pLogEnd, m_si, TRUE); break; case GC_ADDLOG: @@ -2201,15 +2196,15 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } } - if (si->pLogEnd) - StreamInEvents(si->pLog, si, FALSE); + if (m_si->pLogEnd) + StreamInEvents(m_si->pLog, m_si, FALSE); else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); break; case DM_TYPING: // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) { + if (m_si->iType == GCW_PRIVMESS) { int preTyping = m_nTypeSecs != 0; m_nTypeSecs = (int)lParam > 0 ? (int)lParam : 0; @@ -2254,7 +2249,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int x_offset = 0; int index = dis->itemID; - USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, index); + USERINFO *ui = pci->UM_FindUserFromIndex(m_si->pUsers, index); if (ui == nullptr) return TRUE; @@ -2263,7 +2258,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) height++; int offset = (height == 10) ? 0 : height / 2; - HICON hIcon = pci->SM_GetStatusIcon(si, ui); + HICON hIcon = pci->SM_GetStatusIcon(m_si, ui); HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx]; HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); SetBkMode(dis->hDC, TRANSPARENT); @@ -2290,7 +2285,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) x_offset = 2; if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON icon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus); + HICON icon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(icon); x_offset += 18; @@ -2314,7 +2309,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON icon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus); + HICON icon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(icon); x_offset += 18; @@ -2351,7 +2346,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case GC_UPDATENICKLIST: { int i = m_list.SendMsg(LB_GETTOPINDEX, 0, 0); - m_list.SendMsg(LB_SETCOUNT, si->nUsersInNicklist, 0); + m_list.SendMsg(LB_SETCOUNT, m_si->nUsersInNicklist, 0); m_list.SendMsg(LB_SETTOPINDEX, i, 0); SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); } @@ -2361,7 +2356,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) switch (wParam) { case SESSION_OFFLINE: SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0); + SendMessage(m_si->hWnd, GC_UPDATENICKLIST, 0, 0); return TRUE; case SESSION_ONLINE: @@ -2377,12 +2372,12 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; case SESSION_TERMINATE: - if (pcli->pfnGetEvent(si->hContact, 0)) - pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); + if (pcli->pfnGetEvent(m_si->hContact, 0)) + pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT); - si->wState &= ~STATE_TALK; + m_si->wState &= ~STATE_TALK; m_bWasDeleted = true; - db_set_w(si->hContact, si->pszModule, "ApparentMode", 0); + db_set_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0); SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, lParam == 2 ? lParam : 1); return TRUE; @@ -2477,12 +2472,12 @@ LABEL_SHOWWINDOW: break; case GC_CHANGEFILTERFLAG: - if (si->iLogFilterFlags == 0 && si->bFilterEnabled) + if (m_si->iLogFilterFlags == 0 && m_si->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)si); + m_hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_pContainer->hwnd, FilterWndProc, (LPARAM)m_si); TranslateDialogDefault(m_hwndFilter); RECT rcFilter; @@ -2496,7 +2491,7 @@ LABEL_SHOWWINDOW: break; case GC_SHOWCOLORCHOOSER: - pci->ColorChooser(si, lParam == IDC_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, lParam)); + pci->ColorChooser(m_si, lParam == IDC_COLOR, m_hwnd, m_message.GetHwnd(), GetDlgItem(m_hwnd, lParam)); break; case GC_SCROLLTOBOTTOM: @@ -2509,7 +2504,7 @@ LABEL_SHOWWINDOW: FlashTab(true); // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS && wParam == TIMERID_TYPE) + if (m_si->iType == GCW_PRIVMESS && wParam == TIMERID_TYPE) DM_Typing(false); break; @@ -2543,7 +2538,7 @@ LABEL_SHOWWINDOW: if (msg == WM_SYSKEYUP) { if (wp == VK_MENU) - if (!m_fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24))) + if (!m_bkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24))) m_pContainer->MenuBar->autoShow(); return _dlgReturn(m_hwnd, 0); @@ -2570,13 +2565,13 @@ LABEL_SHOWWINDOW: if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) { if (DM_GenericHotkeysCheck(&message)) { - m_fkeyProcessed = true; + m_bkeyProcessed = true; return _dlgReturn(m_hwnd, 1); } LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC)); if (mim_hotkey_check) - m_fkeyProcessed = true; + m_bkeyProcessed = true; switch (mim_hotkey_check) { case TABSRMM_HK_CHANNELMGR: @@ -2590,8 +2585,8 @@ LABEL_SHOWWINDOW: OnClick_ShowNickList(&m_btnNickList); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_MUC_SHOWSERVER: - if (si->iType != GCW_SERVER) - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, nullptr, L"/servershow", 0); + if (m_si->iType != GCW_SERVER) + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, L"/servershow", 0); return _dlgReturn(m_hwnd, 1); } } @@ -2650,7 +2645,7 @@ LABEL_SHOWWINDOW: } HMENU hMenu = 0; - UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, si, nullptr, pszWord); + UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, m_si, nullptr, pszWord); switch (uID) { case 0: PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); @@ -2684,7 +2679,7 @@ LABEL_SHOWWINDOW: default: PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, (LPARAM)uID); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, (LPARAM)uID); break; } @@ -2725,7 +2720,7 @@ LABEL_SHOWWINDOW: if (msg == WM_RBUTTONDOWN) { HMENU hMenu = 0; USERINFO uiNew; - for (USERINFO *ui = si->pUsers; ui; ui = ui->next) { + for (USERINFO *ui = m_si->pUsers; ui; ui = ui->next) { if (mir_wstrcmp(ui->pszNick, tr.lpstrText)) continue; @@ -2733,17 +2728,17 @@ LABEL_SHOWWINDOW: pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam); ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt); memcpy(&uiNew, ui, sizeof(USERINFO)); - UINT uID = CreateGCMenu(m_hwnd, &hMenu, 0, pt, si, uiNew.pszUID, uiNew.pszNick); + UINT uID = CreateGCMenu(m_hwnd, &hMenu, 0, pt, m_si, uiNew.pszUID, uiNew.pszNick); switch (uID) { case 0: break; case ID_MESS: - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); break; default: - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, (LPARAM)uID); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, (LPARAM)uID); break; } DestroyGCMenu(&hMenu, 1); @@ -2862,7 +2857,7 @@ LABEL_SHOWWINDOW: case IDC_SELFTYPING: // Typing support for GCW_PRIVMESS sessions - if (si->iType == GCW_PRIVMESS) { + if (m_si->iType == GCW_PRIVMESS) { if (m_hContact) { int iCurrentTypingMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 34ed805db0..e2806b01ee 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -527,7 +527,7 @@ HICON CContactCache::getIcon(int &iSize) const if (m_dat->m_bCanFlashTab) return m_dat->m_iFlashIcon; - if (m_dat->si && m_dat->m_iFlashIcon) { + if (m_dat->isChat() && m_dat->m_iFlashIcon) { int sizeX, sizeY; Utils::getIconSize(m_dat->m_iFlashIcon, sizeX, sizeY); iSize = sizeX; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 9c825c1ad4..3503354b83 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -60,7 +60,7 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) return;
RECT rcWnd;
- if (dat->m_bType == SESSIONTYPE_IM) {
+ if (!dat->isChat()) {
if (dat->m_pPanel.isActive())
GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
else
@@ -872,13 +872,10 @@ panel_found: db_unset(dat->m_hContact, SRMSGMOD_T, "tabindex");
break;
case ID_TABMENU_LEAVECHATROOM:
- if (dat && dat->m_bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = dat->si;
- if (si && dat->m_hContact) {
- char *szProto = GetContactProto(dat->m_hContact);
- if (szProto)
- CallProtoService(szProto, PS_LEAVECHAT, dat->m_hContact, 0);
- }
+ if (dat && dat->isChat() && dat->m_hContact) {
+ char *szProto = GetContactProto(dat->m_hContact);
+ if (szProto)
+ CallProtoService(szProto, PS_LEAVECHAT, dat->m_hContact, 0);
}
break;
case ID_TABMENU_ATTACHTOCONTAINER:
@@ -1239,7 +1236,7 @@ panel_found: }
dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- if (dat && dat->m_bType == SESSIONTYPE_IM) {
+ if (dat && !dat->isChat()) {
if (dat->m_idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
dat->m_pPanel.Invalidate(TRUE);
}
@@ -2362,7 +2359,7 @@ void TSAPI ReflashContainer(TContainerData *pContainer) // broadcasts a message to all child windows (tabs/sessions)
-void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType)
+void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam)
{
if (pContainer == nullptr)
return;
@@ -2374,15 +2371,8 @@ void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WP int nCount = TabCtrl_GetItemCount(hwndTab);
for (int i = 0; i < nCount; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
- if (IsWindow((HWND)item.lParam)) {
- if (bType == SESSIONTYPE_ANY)
- SendMessage((HWND)item.lParam, message, wParam, lParam);
- else {
- CTabBaseDlg *dat = (CTabBaseDlg*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
- if (dat && dat->m_bType == bType)
- SendMessage((HWND)item.lParam, message, wParam, lParam);
- }
- }
+ if (IsWindow((HWND)item.lParam))
+ SendMessage((HWND)item.lParam, message, wParam, lParam);
}
}
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 7b65b63047..b28bfd6f17 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -479,13 +479,13 @@ void CMenuBar::configureMenu() const {
CSrmmWindow *dat = (CSrmmWindow*)::GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
if (dat) {
- bool fChat = (dat->m_bType == SESSIONTYPE_CHAT);
+ bool fChat = (dat->isChat());
::SendMessage(m_hwndToolbar, TB_SETSTATE, 103, fChat ? TBSTATE_HIDDEN : TBSTATE_ENABLED);
::SendMessage(m_hwndToolbar, TB_SETSTATE, 104, fChat ? TBSTATE_ENABLED : TBSTATE_HIDDEN);
::SendMessage(m_hwndToolbar, TB_SETSTATE, 105, fChat ? TBSTATE_HIDDEN : TBSTATE_ENABLED);
- if (dat->m_bType == SESSIONTYPE_IM)
+ if (!dat->isChat())
::EnableWindow(GetDlgItem(dat->GetHwnd(), IDC_TIME), TRUE);
}
}
@@ -670,10 +670,10 @@ static int tooltip_active = FALSE; static POINT ptMouse = { 0 };
RECT rcLastStatusBarClick; // remembers click (down event) point for status bar clicks
-LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(GetParent(hWnd), GWLP_USERDATA);
- CSrmmWindow *dat = nullptr;
+ CTabBaseDlg *dat = nullptr;
POINT pt;
if (OldStatusBarproc == 0) {
@@ -732,7 +732,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR HANDLE hTheme = bAero ? OpenThemeData(hWnd, L"ButtonStyle") : 0;
if (pContainer)
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
RECT rcClient;
GetClientRect(hWnd, &rcClient);
@@ -786,7 +786,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR // draw visual message length indicator in the leftmost status bar field
if (PluginConfig.m_visualMessageSizeIndicator && i == 0) {
- if (dat && dat->m_bType == SESSIONTYPE_IM) {
+ if (dat && !dat->isChat()) {
HBRUSH br = CreateSolidBrush(RGB(0, 255, 0));
HBRUSH brOld = (HBRUSH)SelectObject(hdcMem, br);
@@ -885,7 +885,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR // needed when an icon is added to or removed from the icon area
{
int list_icons = 0;
- dat = (CSrmmWindow*)lParam;
+ dat = (CTabBaseDlg*)lParam;
if (dat)
while (Srmm_GetNthIcon(dat->m_hContact, list_icons))
list_icons++;
@@ -948,7 +948,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR GetCursorPos(&pt);
if (pt.x != ptMouse.x || pt.y != ptMouse.y)
break;
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat != nullptr) {
RECT rc;
SIZE size;
@@ -969,7 +969,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR mir_snwprintf(wBuf, TranslateT("Sounds are %s. Click to toggle status, hold SHIFT and click to set for all open containers"),
pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
- else if (sid->dwId == MSG_ICON_UTN && (dat->m_bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS)) {
+ else if (sid->dwId == MSG_ICON_UTN && (!dat->isChat() || dat->m_si->iType == GCW_PRIVMESS)) {
int mtnStatus = db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
mir_snwprintf(wBuf, TranslateT("Sending typing notifications is %s."),
mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
@@ -992,7 +992,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR int iQueued = db_get_dw(dat->m_hContact, "SendLater", "count", 0);
gtxl.codepage = CP_UTF8;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- iLength = SendDlgItemMessage(dat->GetHwnd(), dat->m_bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
+ iLength = SendDlgItemMessage(dat->GetHwnd(), IDC_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
tooltip_active = TRUE;
const wchar_t *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
@@ -1009,7 +1009,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR ReleaseDC(dat->m_pContainer->hwndStatus, hdc);
if (PtInRect(&rc, pt) && ((rc.right - rc.left) < size.cx)) {
- if (dat->m_bType == SESSIONTYPE_CHAT) {
+ if (dat->isChat()) {
ptrW tszTopic(db_get_wsa(dat->m_hContact, dat->m_szProto, "Topic"));
if (tszTopic != nullptr) {
tooltip_active = TRUE;
diff --git a/plugins/TabSRMM/src/controls.h b/plugins/TabSRMM/src/controls.h index b06c231207..b1f7e1afa0 100644 --- a/plugins/TabSRMM/src/controls.h +++ b/plugins/TabSRMM/src/controls.h @@ -29,8 +29,6 @@ #ifndef __CONTROLS_H
#define __CONTROLS_H
-extern LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
class CMenuBar
{
public:
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index 7d2c820c2f..2071898080 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -94,7 +94,7 @@ int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int i HMENU TSAPI BuildContainerMenu();
void TSAPI PreTranslateDates();
void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT mode, bool fForceResize);
-void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE iType = 0);
+void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam);
void TSAPI GetDefaultContainerTitleFormat();
void TSAPI SetAeroMargins(TContainerData *pContainer);
int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned int subType);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index b2cf323b92..1f81e18ac1 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -434,12 +434,12 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar case IDC_PIC: GetClientRect(m_hwnd, &rc); - m_fEditNotesActive = !m_fEditNotesActive; - if (m_fEditNotesActive) { + m_bEditNotesActive = !m_bEditNotesActive; + if (m_bEditNotesActive) { int iLen = GetWindowTextLength(m_message.GetHwnd()); if (iLen != 0) { SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("You cannot edit user notes when there are unsent messages")); - m_fEditNotesActive = false; + m_bEditNotesActive = false; break; } @@ -474,7 +474,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); RedrawWindow(m_hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); - if (m_fEditNotesActive) + if (m_bEditNotesActive) CWarning::show(CWarning::WARN_EDITUSERNOTES, MB_OK | MB_ICONINFORMATION); break; @@ -533,22 +533,19 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar void CTabBaseDlg::DM_InitRichEdit() { - bool fIsChat = ((m_bType == SESSIONTYPE_CHAT) ? true : false); - HWND hwndLog = GetDlgItem(m_hwnd, !fIsChat ? IDC_LOG : IDC_LOG); - HWND hwndEdit = GetDlgItem(m_hwnd, !fIsChat ? IDC_MESSAGE : IDC_MESSAGE); - HWND hwndDlg = m_hwnd; + bool fIsChat = isChat(); m_inputbg = fIsChat ? M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR) : m_pContainer->theme.inputbg; COLORREF colour = fIsChat ? g_Settings.crLogBackground : m_pContainer->theme.bg; COLORREF inputcharcolor; char *szStreamOut = nullptr; - if (!fIsChat && GetWindowTextLength(hwndEdit) > 0) - szStreamOut = Message_GetFromStream(hwndEdit); - SetWindowText(hwndEdit, L""); + if (!fIsChat && GetWindowTextLength(m_message.GetHwnd()) > 0) + szStreamOut = Message_GetFromStream(m_message.GetHwnd()); + SetWindowText(m_message.GetHwnd(), L""); - SendMessage(hwndLog, EM_SETBKGNDCOLOR, 0, colour); - SendMessage(hwndEdit, EM_SETBKGNDCOLOR, 0, m_inputbg); + m_log.SendMsg(EM_SETBKGNDCOLOR, 0, colour); + m_message.SendMsg(EM_SETBKGNDCOLOR, 0, m_inputbg); CHARFORMAT2A cf2; memset(&cf2, 0, sizeof(CHARFORMAT2A)); @@ -585,9 +582,9 @@ void CTabBaseDlg::DM_InitRichEdit() cf2.bPitchAndFamily = lf.lfPitchAndFamily; cf2.yHeight = abs(lf.lfHeight) * 15; } - SendMessage(hwndEdit, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf2); - SendMessage(hwndEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); /* WINE: fix send colour text. */ - SendMessage(hwndEdit, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2); /* WINE: fix send colour text. */ + m_message.SendMsg(EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf2); + m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); /* WINE: fix send colour text. */ + m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2); /* WINE: fix send colour text. */ // setup the rich edit control(s) // LOG is always set to RTL, because this is needed for proper bidirectional operation later. @@ -599,12 +596,12 @@ void CTabBaseDlg::DM_InitRichEdit() pf2.wEffects = PFE_RTLPARA; pf2.dwMask = PFM_RTLPARA; if (Utils::FindRTLLocale(this)) - SendMessage(hwndEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); if (!(m_dwFlags & MWF_LOG_RTL)) { pf2.wEffects = 0; - SendMessage(hwndEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); } - SendMessage(hwndEdit, EM_SETLANGOPTIONS, 0, (LPARAM)SendMessage(hwndEdit, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); + m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); pf2.wEffects = PFE_RTLPARA; pf2.dwMask |= PFM_OFFSET; if (m_dwFlags & MWF_INITMODE) { @@ -615,22 +612,22 @@ void CTabBaseDlg::DM_InitRichEdit() pf2.dxOffset = m_pContainer->theme.left_indent + 30; if (!fIsChat) { - SetWindowText(hwndLog, L""); - SendMessage(hwndLog, EM_SETPARAFORMAT, 0, (LPARAM)&pf2); - SendMessage(hwndLog, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); + m_log.SetText(L""); + m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); + m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); // set the scrollbars etc to RTL/LTR (only for manual RTL mode) if (m_dwFlags & MWF_LOG_RTL) { - SetWindowLongPtr(hwndEdit, GWL_EXSTYLE, GetWindowLongPtr(hwndEdit, GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR); - SetWindowLongPtr(hwndLog, GWL_EXSTYLE, GetWindowLongPtr(hwndLog, GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR); + SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR); + SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR); } else { - SetWindowLongPtr(hwndEdit, GWL_EXSTYLE, GetWindowLongPtr(hwndEdit, GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR)); - SetWindowLongPtr(hwndLog, GWL_EXSTYLE, GetWindowLongPtr(hwndLog, GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR)); + SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR)); + SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR)); } } if (szStreamOut != nullptr) { SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; - SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szStreamOut); + m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szStreamOut); mir_free(szStreamOut); } } @@ -708,22 +705,21 @@ void CTabBaseDlg::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) return; } - HWND hwnd = GetDlgItem(m_hwnd, m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG); if (lParam) - SendMessage(hwnd, WM_SIZE, 0, 0); + SendMessage(m_log.GetHwnd(), WM_SIZE, 0, 0); if (wParam == 1 && lParam == 1) { - int len = GetWindowTextLength(hwnd); - SendMessage(hwnd, EM_SETSEL, len - 1, len - 1); + int len = GetWindowTextLength(m_log.GetHwnd()); + SendMessage(m_log.GetHwnd(), EM_SETSEL, len - 1, len - 1); } if (wParam) - SendMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); + SendMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); else - PostMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); + PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); if (lParam) - InvalidateRect(hwnd, nullptr, FALSE); + InvalidateRect(m_log.GetHwnd(), nullptr, FALSE); } static void LoadKLThread(LPVOID _param) @@ -865,9 +861,6 @@ HWND CTabBaseDlg::DM_CreateClist() LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) { - UINT uID = m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG; - UINT uIDMsg = m_bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_MESSAGE; - POINT pt; GetCursorPos(&pt); @@ -882,11 +875,11 @@ LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) rc.bottom = rc1.bottom; if (PtInRect(&rc, pt)) { short amount = (short)(HIWORD(wParam)); - SendMessage(m_pContainer->hwnd, WM_COMMAND, MAKELONG(amount > 0 ? IDC_SIDEBARUP : IDC_SIDEBARDOWN, 0), (LPARAM)uIDMsg); + SendMessage(m_pContainer->hwnd, WM_COMMAND, MAKELONG(amount > 0 ? IDC_SIDEBARUP : IDC_SIDEBARDOWN, 0), IDC_MESSAGE); return 0; } } - if (m_bType == SESSIONTYPE_CHAT) { // scroll nick list by just hovering it + if (isChat()) { // scroll nick list by just hovering it RECT rcNicklist; GetWindowRect(GetDlgItem(m_hwnd, IDC_LIST), &rcNicklist); if (PtInRect(&rcNicklist, pt)) { @@ -899,9 +892,9 @@ LRESULT CTabBaseDlg::DM_MouseWheelHandler(WPARAM wParam, LPARAM lParam) else if (m_hwndHPP) GetWindowRect(m_hwndHPP, &rc); else - GetWindowRect(GetDlgItem(m_hwnd, uID), &rc); + GetWindowRect(m_log.GetHwnd(), &rc); if (PtInRect(&rc, pt)) { - HWND hwndLog = (m_hwndIEView || m_hwndHPP) ? m_hwndIWebBrowserControl : GetDlgItem(m_hwnd, uID); + HWND hwndLog = (m_hwndIEView || m_hwndHPP) ? m_hwndIWebBrowserControl : m_log.GetHwnd(); short wDirection = (short)HIWORD(wParam); if (hwndLog == 0) @@ -948,7 +941,7 @@ void CTabBaseDlg::DM_ThemeChanged() m_hTheme = OpenThemeData(m_hwnd, L"EDIT"); - if (m_bType == SESSIONTYPE_IM) { + if (!isChat()) { if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE); if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED)) @@ -981,7 +974,7 @@ void CTabBaseDlg::DM_NotifyTyping(int mode) MCONTACT hContact = m_cache->getActiveContact(); // editing user notes or preparing a message for queued delivery -> don't send MTN - if (m_fEditNotesActive || (m_sendMode & SMODE_SENDLATER)) + if (m_bEditNotesActive || (m_sendMode & SMODE_SENDLATER)) return; // allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle) @@ -1086,7 +1079,7 @@ void CTabBaseDlg::DM_Typing(bool fForceOff) SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0); HandleIconFeedback(this, (HICON)-1); CTabBaseDlg *dat_active = (CTabBaseDlg*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA); - if (dat_active && dat_active->m_bType == SESSIONTYPE_IM) + if (dat_active && !dat_active->isChat()) SendMessage(hwndContainer, DM_UPDATETITLE, 0, 0); else SendMessage(hwndContainer, DM_UPDATETITLE, (WPARAM)m_pContainer->hwndActive, 1); @@ -1158,11 +1151,11 @@ int CTabBaseDlg::DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam) if ((m_dwFlagsEx & MWF_SHOW_SPLITTEROVERRIDE) && this != srcDat) return 0; - if (srcDat->m_bType == m_bType) + if (srcDat->isChat() == isChat()) newPos = PluginConfig.lastSPlitterPos.pos; - else if (srcDat->m_bType == SESSIONTYPE_IM && m_bType == SESSIONTYPE_CHAT) + else if (!srcDat->isChat() && isChat()) newPos = PluginConfig.lastSPlitterPos.pos + PluginConfig.lastSPlitterPos.off_im; - else if (srcDat->m_bType == SESSIONTYPE_CHAT && m_bType == SESSIONTYPE_IM) + else if (srcDat->isChat() && !isChat()) newPos = PluginConfig.lastSPlitterPos.pos + PluginConfig.lastSPlitterPos.off_im; else newPos = 0; @@ -1508,7 +1501,7 @@ void CTabBaseDlg::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } else if (sid->dwId == MSG_ICON_UTN) { - if (m_bType == SESSIONTYPE_IM || si->iType == GCW_PRIVMESS) { + if (!isChat() || m_si->iType == GCW_PRIVMESS) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); DrawIconEx(hDC, x, y, db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? @@ -1565,7 +1558,7 @@ void CTabBaseDlg::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int co InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } } - else if (sid->dwId == MSG_ICON_UTN && code != NM_RCLICK && (m_bType == SESSIONTYPE_IM || si->iType == GCW_PRIVMESS)) { + else if (sid->dwId == MSG_ICON_UTN && code != NM_RCLICK && (!isChat() || m_si->iType == GCW_PRIVMESS)) { SendMessage(m_pContainer->hwndActive, WM_COMMAND, IDC_SELFTYPING, 0); InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index d5f75c4ce1..47c41f8142 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -46,7 +46,7 @@ CInfoPanel::CInfoPanel(CTabBaseDlg *dat) {
if (dat) {
m_dat = dat;
- m_isChat = dat->m_bType == SESSIONTYPE_CHAT ? true : false;
+ m_isChat = dat->isChat();
}
m_defaultHeight = PluginConfig.m_panelHeight;
m_defaultMUCHeight = PluginConfig.m_MUCpanelHeight;
@@ -595,7 +595,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
{
- SESSION_INFO *si = m_dat->si;
+ SESSION_INFO *si = m_dat->m_si;
if (si == nullptr)
return;
@@ -654,7 +654,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
{
- SESSION_INFO *si = reinterpret_cast<SESSION_INFO*>(m_dat->si);
+ SESSION_INFO *si = reinterpret_cast<SESSION_INFO*>(m_dat->m_si);
if (si == 0)
return;
@@ -718,7 +718,7 @@ HMENU CInfoPanel::constructContextualMenu() const Utils::addMenuItem(m, mii, PluginConfig.g_iconContainer, TranslateT("Messaging settings..."), ID_MESSAGELOGSETTINGS_FORTHISCONTACT, 1);
else {
::AppendMenu(m, MF_STRING, IDC_CHANMGR, TranslateT("Room settings..."));
- if (GCW_SERVER & m_dat->si->iType)
+ if (GCW_SERVER & m_dat->m_si->iType)
::EnableMenuItem(m, IDC_CHANMGR, MF_BYCOMMAND | MF_GRAYED);
}
::AppendMenu(m, MF_SEPARATOR, 1000, 0);
@@ -747,7 +747,7 @@ LRESULT CInfoPanel::cmdHandler(UINT cmd) return(S_OK);
}
if (m_hoverFlags & HOVER_UIN) {
- Utils::CopyToClipBoard(m_isChat ? m_dat->si->ptszTopic : m_dat->m_cache->getUIN(), m_dat->GetHwnd());
+ Utils::CopyToClipBoard(m_isChat ? m_dat->m_si->ptszTopic : m_dat->m_cache->getUIN(), m_dat->GetHwnd());
return(S_OK);
}
break;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index e1329cb6b8..28231fa2b8 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -463,16 +463,16 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break;
case WM_SYSKEYDOWN:
- mwdat->m_fkeyProcessed = false;
+ mwdat->m_bkeyProcessed = false;
if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_LOG)) {
- mwdat->m_fkeyProcessed = true;
+ mwdat->m_bkeyProcessed = true;
return 0;
}
break;
case WM_SYSCHAR:
- if (mwdat->m_fkeyProcessed) {
- mwdat->m_fkeyProcessed = false;
+ if (mwdat->m_bkeyProcessed) {
+ mwdat->m_bkeyProcessed = false;
return 0;
}
break;
@@ -523,12 +523,12 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar // prevent the rich edit from switching text direction or keyboard layout when
// using hotkeys with ctrl-shift or alt-shift modifiers
- if (mwdat->m_fkeyProcessed && (msg == WM_KEYUP)) {
+ if (mwdat->m_bkeyProcessed && (msg == WM_KEYUP)) {
GetKeyboardState(mwdat->kstate);
if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80)
return 0;
- mwdat->m_fkeyProcessed = false;
+ mwdat->m_bkeyProcessed = false;
return 0;
}
@@ -603,14 +603,14 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar SkinPlaySound("SoundOnTyping");
if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
- mwdat->m_fInsertMode = !mwdat->m_fInsertMode;
+ mwdat->m_bInsertMode = !mwdat->m_bInsertMode;
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
}
if (wParam == VK_CAPITAL || wParam == VK_NUMLOCK)
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
if (wParam == VK_RETURN) {
- if (mwdat->m_fEditNotesActive)
+ if (mwdat->m_bEditNotesActive)
break;
if (isShift) {
@@ -692,9 +692,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
case WM_SYSKEYDOWN:
- mwdat->m_fkeyProcessed = false;
+ mwdat->m_bkeyProcessed = false;
if (ProcessHotkeysByMsgFilter(hwnd, msg, wParam, lParam, IDC_MESSAGE)) {
- mwdat->m_fkeyProcessed = true;
+ mwdat->m_bkeyProcessed = true;
return 0;
}
break;
@@ -707,8 +707,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar break;
case WM_SYSCHAR:
- if (mwdat->m_fkeyProcessed) {
- mwdat->m_fkeyProcessed = false;
+ if (mwdat->m_bkeyProcessed) {
+ mwdat->m_bkeyProcessed = false;
return 0;
}
@@ -842,7 +842,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ReleaseCapture();
dat->DM_ScrollToBottom(0, 1);
- if (dat->m_bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
+ if (!dat->isChat() && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) {
SendMessage(hwndParent, WM_SIZE, 0, 0);
RedrawWindow(hwndParent, nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
}
@@ -866,7 +866,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY:
dat->m_dwFlagsEx |= MWF_SHOW_SPLITTEROVERRIDE;
db_set_b(dat->m_hContact, SRMSGMOD_T, "splitoverride", 1);
- if (dat->m_bType == SESSIONTYPE_IM)
+ if (!dat->isChat())
dat->SaveSplitter();
break;
@@ -919,7 +919,6 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM CSrmmWindow::CSrmmWindow()
: CTabBaseDlg(IDD_MSGSPLITNEW)
{
- m_bType = SESSIONTYPE_IM;
}
void CSrmmWindow::ClearLog()
@@ -1224,7 +1223,7 @@ void CSrmmWindow::OnDestroy() if (m_pContainer->dwFlags & CNT_SIDEBAR)
m_pContainer->SideBar->removeSession(this);
m_cache->setWindowData();
- if (m_cache->isValid() && !m_fIsReattach && m_hContact && M.GetByte("deletetemp", 0))
+ if (!m_bIsReattach && m_hContact && M.GetByte("deletetemp", 0))
if (db_get_b(m_hContact, "CList", "NotOnList", 0))
db_delete_contact(m_hContact);
@@ -1234,9 +1233,6 @@ void CSrmmWindow::OnDestroy() if (m_hwndPanelPic)
DestroyWindow(m_hwndPanelPic);
- if (m_hClientIcon)
- DestroyIcon(m_hClientIcon);
-
if (m_hwndPanelPicParent)
DestroyWindow(m_hwndPanelPicParent);
@@ -1245,7 +1241,7 @@ void CSrmmWindow::OnDestroy() AddContactToFavorites(m_hContact, m_cache->getNick(), m_cache->getActiveProto(), m_wszStatus, m_wStatus,
Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
if (m_hContact) {
- if (!m_fEditNotesActive) {
+ if (!m_bEditNotesActive) {
char *msg = Message_GetFromStream(m_message.GetHwnd(), SF_TEXT);
if (msg) {
db_set_utf(m_hContact, SRMSGMOD, "SavedMsg", msg);
@@ -1262,9 +1258,6 @@ void CSrmmWindow::OnDestroy() DM_FreeTheme();
- mir_free(m_sendBuffer);
- mir_free(m_hHistoryEvents);
-
// search the sendqueue for unfinished send jobs and mir_free them. Leave unsent
// messages in the queue as they can be acked later
{
@@ -1284,20 +1277,9 @@ void CSrmmWindow::OnDestroy() }
}
- mir_free(m_hQueuedEvents);
-
- if (m_hSmileyIcon)
- DestroyIcon(m_hSmileyIcon);
-
- if (m_hXStatusIcon)
- DestroyIcon(m_hXStatusIcon);
-
if (m_hwndTip)
DestroyWindow(m_hwndTip);
- if (m_hTaskbarIcon)
- DestroyIcon(m_hTaskbarIcon);
-
UpdateTrayMenuState(this, FALSE); // remove me from the tray menu (if still there)
if (PluginConfig.g_hMenuTrayUnread)
DeleteMenu(PluginConfig.g_hMenuTrayUnread, m_hContact, MF_BYCOMMAND);
@@ -1306,14 +1288,12 @@ void CSrmmWindow::OnDestroy() if (m_cache->isValid())
db_set_dw(0, SRMSGMOD, "multisplit", m_iMultiSplit);
- {
- int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd);
- if (i >= 0) {
- SendMessage(m_hwndParent, WM_USER + 100, 0, 0); // remove tooltip
- TabCtrl_DeleteItem(m_hwndParent, i);
- BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
- m_iTabID = -1;
- }
+ int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd);
+ if (i >= 0) {
+ SendMessage(m_hwndParent, WM_USER + 100, 0, 0); // remove tooltip
+ TabCtrl_DeleteItem(m_hwndParent, i);
+ BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0);
+ m_iTabID = -1;
}
TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE, 0);
@@ -1333,14 +1313,6 @@ void CSrmmWindow::OnDestroy() ieWindow.hwnd = m_hwndHPP;
CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow);
}
- if (m_pWnd) {
- delete m_pWnd;
- m_pWnd = 0;
- }
- if (m_sbCustom) {
- delete m_sbCustom;
- m_sbCustom = 0;
- }
}
void CSrmmWindow::ReplayQueue()
@@ -1569,7 +1541,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (CSkin::m_skinEnabled) {
UINT item_ids[2] = { ID_EXTBKHISTORY, ID_EXTBKINPUTAREA };
UINT ctl_ids[2] = { IDC_LOG, IDC_MESSAGE };
- BOOL isEditNotesReason = m_fEditNotesActive;
+ BOOL isEditNotesReason = m_bEditNotesActive;
BOOL isSendLaterReason = (m_sendMode & SMODE_SENDLATER);
BOOL isMultipleReason = (m_sendMode & SMODE_MULTIPLE || m_sendMode & SMODE_CONTAINER);
@@ -1768,7 +1740,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (msg == WM_SYSKEYUP) {
if (wp == VK_MENU)
- if (!m_fkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
+ if (!m_bkeyProcessed && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000) && !(lp & (1 << 24)))
m_pContainer->MenuBar->autoShow();
return _dlgReturn(m_hwnd, 0);
@@ -1777,7 +1749,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) {
LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)TABSRMM_HK_SECTION_IM);
if (mim_hotkey_check)
- m_fkeyProcessed = true;
+ m_bkeyProcessed = true;
switch (mim_hotkey_check) {
case TABSRMM_HK_SETUSERPREFS:
@@ -1867,7 +1839,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return _dlgReturn(m_hwnd, 1);
}
if (DM_GenericHotkeysCheck(&message)) {
- m_fkeyProcessed = true;
+ m_bkeyProcessed = true;
return _dlgReturn(m_hwnd, 1);
}
}
@@ -2551,7 +2523,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) {
case IDOK:
- if (m_fEditNotesActive) {
+ if (m_bEditNotesActive) {
SendMessage(m_hwnd, DM_ACTIVATETOOLTIP, IDC_PIC, (LPARAM)TranslateT("You are editing the user notes. Click the button again or use the hotkey (default: Alt-N) to save the notes and return to normal messaging mode"));
return 0;
}
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 57245bb915..cd1a49147b 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -252,7 +252,7 @@ int CTabBaseDlg::MsgWindowUpdateMenu(HMENU submenu, int menuID) bool bInfoPanel = m_pPanel.isActive();
if (menuID == MENU_TABCONTEXT) {
- EnableMenuItem(submenu, ID_TABMENU_LEAVECHATROOM, (m_bType == SESSIONTYPE_CHAT && ProtoServiceExists(m_szProto, PS_LEAVECHAT)) ? MF_ENABLED : MF_DISABLED);
+ EnableMenuItem(submenu, ID_TABMENU_LEAVECHATROOM, (isChat() && ProtoServiceExists(m_szProto, PS_LEAVECHAT)) ? MF_ENABLED : MF_DISABLED);
EnableMenuItem(submenu, ID_TABMENU_ATTACHTOCONTAINER, (M.GetByte("useclistgroups", 0) || M.GetByte("singlewinmode", 0)) ? MF_GRAYED : MF_ENABLED);
EnableMenuItem(submenu, ID_TABMENU_CLEARSAVEDTABPOSITION, (M.GetDword(m_hContact, "tabindex", -1) != -1) ? MF_ENABLED : MF_GRAYED);
}
@@ -325,7 +325,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) db_unset(m_hContact, SRMSGMOD_T, "tabindex");
break;
case ID_TABMENU_LEAVECHATROOM:
- if (m_bType == SESSIONTYPE_CHAT && m_hContact != 0) {
+ if (isChat() && m_hContact != 0) {
char *szProto = GetContactProto(m_hContact);
if (szProto)
CallProtoService(szProto, PS_LEAVECHAT, m_hContact, 0);
@@ -407,7 +407,7 @@ void CTabBaseDlg::UpdateReadChars() const return;
int len;
- if (m_bType == SESSIONTYPE_CHAT)
+ if (isChat())
len = GetWindowTextLength(m_message.GetHwnd());
else {
// retrieve text length in UTF8 bytes, because this is the relevant length for most protocols
@@ -422,13 +422,13 @@ void CTabBaseDlg::UpdateReadChars() const BOOL fNum = (GetKeyState(VK_NUMLOCK) & 1);
wchar_t szBuf[20]; szBuf[0] = 0;
- if (m_fInsertMode)
+ if (m_bInsertMode)
mir_wstrcat(szBuf, L"O");
if (fCaps)
mir_wstrcat(szBuf, L"C");
if (fNum)
mir_wstrcat(szBuf, L"N");
- if (m_fInsertMode || fCaps || fNum)
+ if (m_bInsertMode || fCaps || fNum)
mir_wstrcat(szBuf, L" | ");
wchar_t buf[128];
@@ -444,7 +444,7 @@ void CTabBaseDlg::UpdateReadChars() const void CTabBaseDlg::UpdateStatusBar() const
{
if (m_pContainer->hwndStatus && m_pContainer->hwndActive == m_hwnd) {
- if (m_bType == SESSIONTYPE_IM) {
+ if (!isChat()) {
if (m_wszStatusBar[0]) {
SendMessage(m_pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]);
SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)m_wszStatusBar);
@@ -897,7 +897,7 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pCol int iCol = _wtoi(p + 3);
int iInd = GetRtfIndex(iCol, iNumColors, pIndex);
- if (iCol && m_bType != SESSIONTYPE_CHAT)
+ if (iCol && !isChat())
res.AppendFormat((iInd > 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_ctable[iInd - 1].szName);
bInsideColor = iInd > 0;
@@ -996,7 +996,7 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pCol }
}
- if (bInsideColor && m_bType != SESSIONTYPE_CHAT)
+ if (bInsideColor && !isChat())
res.Append(L"[/color]");
if (bInsideUl)
res.Append(L"[/u]");
@@ -1641,7 +1641,7 @@ LRESULT TSAPI GetSendButtonState(HWND hwnd) void CTabBaseDlg::EnableSendButton(bool bMode) const
{
SendDlgItemMessage(m_hwnd, IDOK, BUTTONSETASNORMAL, bMode, 0);
- SendDlgItemMessage(m_hwnd, IDC_PIC, BUTTONSETASNORMAL, m_fEditNotesActive ? TRUE : (!bMode && m_iOpenJobs == 0) ? TRUE : FALSE, 0);
+ SendDlgItemMessage(m_hwnd, IDC_PIC, BUTTONSETASNORMAL, m_bEditNotesActive ? TRUE : (!bMode && m_iOpenJobs == 0) ? TRUE : FALSE, 0);
HWND hwndOK = GetDlgItem(GetParent(GetParent(m_hwnd)), IDOK);
if (IsWindow(hwndOK))
@@ -1728,12 +1728,7 @@ bool CTabBaseDlg::IsAutoSplitEnabled() const LONG CTabBaseDlg::GetDefaultMinimumInputHeight() const
{
- LONG height;
-
- if (m_bType == SESSIONTYPE_IM)
- height = ((m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46));
- else
- height = ((m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(22 + 46) : DPISCALEY_S(46)) - DPISCALEY_S(23);
+ LONG height = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46);
if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKINPUTAREA].IGNORED)
height += (SkinItems[ID_EXTBKINPUTAREA].MARGIN_BOTTOM + SkinItems[ID_EXTBKINPUTAREA].MARGIN_TOP - 2);
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index e0c563f554..2a73f8f2d9 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -1092,7 +1092,7 @@ static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppe FINDTEXTEX fi;
fi.chrg.cpMin = startAt;
- if (dat->m_clr_added) {
+ if (dat->m_bClrAdded) {
fi.lpstrText = L"##col##";
fi.chrg.cpMax = -1;
CHARFORMAT2 cf2;
@@ -1278,7 +1278,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D }
// separator strings used for grid lines, message separation and so on...
- m_clr_added = FALSE;
+ m_bClrAdded = false;
if (m_szMicroLf[0] == 0)
SetupLogFormatting(this);
@@ -1355,7 +1355,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D }
ReplaceIcons(m_hwnd, this, startAt, fAppend, isSent);
- m_clr_added = FALSE;
+ m_bClrAdded = false;
if (m_hwndIEView == nullptr && m_hwndHPP == nullptr) {
int len = GetWindowTextLength(hwndrtf);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 0e95268fc6..1ca98b630c 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -132,6 +132,21 @@ CTabBaseDlg::CTabBaseDlg(int iResource) m_forceResizable = true;
}
+CTabBaseDlg::~CTabBaseDlg()
+{
+ delete m_pWnd;
+ delete m_sbCustom;
+
+ mir_free(m_sendBuffer);
+ mir_free(m_hHistoryEvents);
+ mir_free(m_hQueuedEvents);
+
+ if (m_hClientIcon) DestroyIcon(m_hClientIcon);
+ if (m_hSmileyIcon) DestroyIcon(m_hSmileyIcon);
+ if (m_hXStatusIcon) DestroyIcon(m_hXStatusIcon);
+ if (m_hTaskbarIcon) DestroyIcon(m_hTaskbarIcon);
+}
+
INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -147,7 +162,7 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_pPanel.loadHeight();
else {
if (srcDat && lParam && this != srcDat && !m_pPanel.isPrivateHeight()) {
- if (srcDat->m_bType != m_bType && M.GetByte("syncAllPanels", 0) == 0)
+ if (srcDat->isChat() != isChat() && M.GetByte("syncAllPanels", 0) == 0)
return 0;
if (m_pContainer->settings->fPrivate && srcDat->m_pContainer != m_pContainer)
@@ -208,7 +223,7 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
db_set_ws(m_hContact, SRMSGMOD_T, "containerW", szNewName);
- m_fIsReattach = TRUE;
+ m_bIsReattach = true;
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, m_hContact);
if (iOldItems > 1) // there were more than 1 tab, container is still valid
SendMessage(m_pContainer->hwndActive, WM_SIZE, 0, 0);
@@ -586,7 +601,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) TabCtrl_SetCurSel(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetTabIndexFromHWND(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), hwndChild));
SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); // just select the tab and let WM_NOTIFY do the rest
}
- if (dat->m_bType == SESSIONTYPE_IM)
+ if (!dat->isChat())
SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->m_hContact, 0);
if (IsIconic(pContainer->hwnd)) {
SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
@@ -613,7 +628,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) else if (GetForegroundWindow() != pContainer->hwnd)
SetForegroundWindow(pContainer->hwnd);
- if (dat->m_bType == SESSIONTYPE_IM)
+ if (!dat->isChat())
SetFocus(GetDlgItem(hwndChild, IDC_MESSAGE));
return TRUE;
}
@@ -828,14 +843,13 @@ int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (dat == nullptr)
return 0;
- BYTE bType = dat->m_bType;
MessageWindowEventData mwe = { sizeof(mwe) };
mwe.hContact = hContact;
mwe.hwndWindow = hwnd;
mwe.szModule = "tabSRMsgW";
mwe.uType = type;
- if (bType == SESSIONTYPE_IM) {
+ if (!dat->isChat()) {
mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 9ba81facec..d1213b9395 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -132,7 +132,6 @@ struct TitleBtn { class CTaskbarInteract;
class CMenuBar;
-class CInfoPanel;
class CSideBar;
class CProxyWindow;
class CThumbBase;
@@ -231,6 +230,7 @@ struct SESSION_INFO; class CTabBaseDlg : public CSrmmBaseDialog
{
+ friend class CInfoPanel;
protected:
CCtrlEdit m_log, m_message;
@@ -252,7 +252,6 @@ protected: void ResizeIeView();
public:
- BYTE m_bType;
DWORD m_dwFlags;
DWORD m_dwFlagsEx;
char *m_szProto;
@@ -265,14 +264,12 @@ public: size_t m_iSendBufferSize;
int m_iSendLength; // message length in utf-8 octets
HICON m_hTabIcon, m_hTabStatusIcon, m_hXStatusIcon, m_hClientIcon, m_hTaskbarIcon;
- HICON m_iFlashIcon;
- bool m_bCanFlashTab, m_bTabFlash;
+ HICON m_iFlashIcon, m_hSmileyIcon;
HWND m_hwndIEView, m_hwndIWebBrowserControl, m_hwndHPP;
HWND m_hwndContactPic, m_hwndPanelPic, m_hwndPanelPicParent;
UINT m_bbLSideWidth, m_bbRSideWidth;
BYTE kstate[256];
- SESSION_INFO *si;
StatusTextData *m_sbCustom;
TContainerData *m_pContainer; // parent container description structure
@@ -282,7 +279,6 @@ public: int m_originalSplitterY;
int m_iSplitterY, m_dynaSplitter;
int m_savedSplitterY, m_savedDynaSplit;
- int m_iMultiSplit;
SIZE m_minEditBoxSize;
int m_nTypeSecs;
int m_nTypeMode;
@@ -293,11 +289,21 @@ public: DWORD m_dwTickLastEvent, m_dwUnread;
HBITMAP m_hOwnPic;
SIZE m_pic;
+
BYTE m_bShowTyping;
bool m_bShowAvatar, m_bShowInfoAvatar, m_bShowUIElements;
bool m_bUseOffset;
bool m_bIsHistory, m_bIsMeta, m_bNotOnList;
- HICON m_hSmileyIcon;
+ bool m_bkeyProcessed;
+ bool m_bEditNotesActive;
+ bool m_bActualHistory;
+ bool m_bIsReattach;
+ bool m_bIsAutosizingInput;
+ bool m_fLimitedUpdate;
+ bool m_bClrAdded;
+ bool m_bInsertMode;
+ bool m_bCanFlashTab, m_bTabFlash;
+
int m_iLastEventType;
time_t m_lastEventTime;
int m_iRealAvatarHeight;
@@ -329,15 +335,9 @@ public: int m_nMax; // max message size
int m_textLen; // current text len
LONG m_ipFieldHeight;
- BOOL m_clr_added;
- BOOL m_fIsReattach;
WPARAM m_wParam; // used for "delayed" actions like moved splitters in minimized windows
LPARAM m_lParam;
int m_iHaveRTLLang;
- BOOL m_fInsertMode;
- bool m_fkeyProcessed;
- bool m_fEditNotesActive;
- bool m_bActualHistory;
CInfoPanel m_pPanel;
CContactCache *m_cache;
@@ -345,8 +345,6 @@ public: CProxyWindow *m_pWnd; // proxy window object (win7+, for taskbar support).
// ALWAYS check this pointer before using it, it is not guaranteed to exist.
- bool m_bIsAutosizingInput;
- bool m_fLimitedUpdate;
DWORD m_iSplitterSaved;
LONG m_iInputAreaHeight;
POINT m_ptTipActivation;
@@ -356,12 +354,15 @@ public: public:
CTabBaseDlg(int iDialogId);
+ virtual ~CTabBaseDlg() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
virtual CThumbBase* CreateThumb(CProxyWindow*) const = 0;
virtual void ClearLog() = 0;
+ static LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
HWND DM_CreateClist();
void DM_EventAdded(WPARAM wParam, LPARAM lParam);
void DM_InitRichEdit();
@@ -439,6 +440,7 @@ class CSrmmWindow : public CTabBaseDlg void ReplayQueue();
public:
+ int m_iMultiSplit;
int msgTop, rcLogBottom;
wchar_t *wszInitialText;
bool m_bActivate, m_bWantPopup;
@@ -464,6 +466,9 @@ class CChatRoomDlg : public CTabBaseDlg CCtrlButton m_btnBold, m_btnItalic, m_btnUnderline, m_btnColor, m_btnBkColor;
CCtrlListBox m_list;
+ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
virtual CThumbBase* CreateThumb(CProxyWindow *pProxy) const override;
virtual void ClearLog() override;
@@ -954,10 +959,6 @@ struct SIDEBARITEM { #define ID_EXTBKSIDEBARBG 24
#define ID_EXTBK_LAST 24
-#define SESSIONTYPE_ANY 0
-#define SESSIONTYPE_IM 1
-#define SESSIONTYPE_CHAT 2
-
#define DEFAULT_SIDEBARWIDTH 30
#define THEME_READ_FONTS 1
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 0de6d200fe..253ff90468 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -184,7 +184,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in else if (dat->m_bCanFlashTab)
hIcon = dat->m_iFlashIcon;
else {
- if (dat->m_bType == SESSIONTYPE_CHAT && dat->m_iFlashIcon) {
+ if (dat->isChat() && dat->m_iFlashIcon) {
hIcon = dat->m_iFlashIcon;
int sizeY;
@@ -829,7 +829,7 @@ page_done: FillRect(hdc, &rcPage, CSkin::m_BrushBack);
rcPage.top = 0;
}
- GetWindowRect(GetDlgItem(tabdat->helperDat->GetHwnd(), tabdat->helperDat->m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG), &rcLog);
+ GetWindowRect(GetDlgItem(tabdat->helperDat->GetHwnd(), IDC_LOG), &rcLog);
pt.y = rcLog.top;
pt.x = rcLog.left;
@@ -1475,7 +1475,7 @@ int TSAPI RegisterTabCtrlClass(void) RegisterClassEx(&wc);
wc.lpszClassName = L"TSStatusBarClass";
- wc.lpfnWndProc = StatusBarSubclassProc;
+ wc.lpfnWndProc = &CTabBaseDlg::StatusBarSubclassProc;
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.cbWndExtra = sizeof(void*);
wc.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC;
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 1073cb0271..4d3f846610 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -326,8 +326,8 @@ void CProxyWindow::sendPreview() RECT rcContainer, rcTemp, rcRich, rcLog;
HDC hdc, dc;
int twips = (int)(15.0f / PluginConfig.m_DPIscaleY);
- bool fIsChat = m_dat->m_bType != SESSIONTYPE_IM;
- HWND hwndRich = ::GetDlgItem(m_dat->GetHwnd(), fIsChat ? IDC_LOG : IDC_LOG);
+ bool fIsChat = m_dat->isChat();
+ HWND hwndRich = ::GetDlgItem(m_dat->GetHwnd(), IDC_LOG);
LONG cx, cy;
POINT ptOrigin = { 0 }, ptBottom;
@@ -357,7 +357,7 @@ void CProxyWindow::sendPreview() pt = m_dat->m_pContainer->ptLogSaved;
}
- ::GetWindowRect(::GetDlgItem(m_dat->m_pContainer->hwndActive, dat_active->m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG), &rcTemp);
+ ::GetWindowRect(::GetDlgItem(m_dat->m_pContainer->hwndActive, IDC_LOG), &rcTemp);
ptBottom.x = rcTemp.left;
ptBottom.y = rcTemp.bottom;
::ScreenToClient(m_dat->m_pContainer->hwnd, &ptBottom);
@@ -679,7 +679,7 @@ void CThumbBase::renderBase() m_rcIcon.top += (lIconSize + 3);
CSkin::RenderText(m_hdc, m_dat->m_hTheme, m_dat->m_wszStatus, &m_rcIcon, m_dtFlags | DT_CENTER | DT_WORD_ELLIPSIS, 10, 0, true);
- if (m_dat->m_dwUnread && SESSIONTYPE_IM == m_dat->m_bType) {
+ if (m_dat->m_dwUnread && !m_dat->isChat()) {
wchar_t tszTemp[30];
m_rcIcon.top += m_sz.cy;
@@ -698,7 +698,7 @@ void CThumbBase::renderBase() */
void CThumbBase::setupRect()
{
- if (SESSIONTYPE_IM == m_pWnd->getDat()->m_bType) {
+ if (!m_pWnd->getDat()->isChat()) {
m_rcTop = m_rc;
m_rcBottom = m_rc;
m_rcBottom.top = m_rc.bottom - (2 * (m_rcBottom.bottom / 5)) - 2;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index b42d334f86..f57c7ab7ec 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1957,7 +1957,7 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const CTabBaseDlg *mwdat, UINT skinID return orig;
}
if ((mwdat->m_sendMode & SMODE_MULTIPLE || mwdat->m_sendMode & SMODE_CONTAINER ||
- mwdat->m_fEditNotesActive || mwdat->m_sendMode & SMODE_SENDLATER) && skinID == ID_EXTBKINPUTAREA) {
+ mwdat->m_bEditNotesActive || mwdat->m_sendMode & SMODE_SENDLATER) && skinID == ID_EXTBKINPUTAREA) {
InflateRect(&nccp->rgrc[0], -1, -1);
return WVR_REDRAW;
}
@@ -1975,7 +1975,7 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const CTabBaseDlg *mwdat, UINT skinID, if (0 == mwdat)
return result;
- BOOL isEditNotesReason = ((mwdat->m_fEditNotesActive) && (skinID == ID_EXTBKINPUTAREA));
+ BOOL isEditNotesReason = ((mwdat->m_bEditNotesActive) && (skinID == ID_EXTBKINPUTAREA));
BOOL isSendLaterReason = ((mwdat->m_sendMode & SMODE_SENDLATER) && (skinID == ID_EXTBKINPUTAREA));
BOOL isMultipleReason = ((skinID == ID_EXTBKINPUTAREA) && (mwdat->m_sendMode & SMODE_MULTIPLE || mwdat->m_sendMode & SMODE_CONTAINER));
@@ -2205,14 +2205,14 @@ void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const POINT pt;
if (!(m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR)) {
- ::GetWindowRect(::GetDlgItem(m_hwnd, m_bType == SESSIONTYPE_CHAT ? IDC_LOG : IDC_LOG), &rc);
+ ::GetWindowRect(m_log.GetHwnd(), &rc);
pt.y = rc.bottom + 0;
::ScreenToClient(m_hwnd, &pt);
rcToolbar.top = pt.y;
rcToolbar.left = 0;
rcToolbar.right = rcWindow.right;
- if (m_bType == SESSIONTYPE_IM) {
+ if (!isChat()) {
if (m_dwFlags & MWF_ERRORSTATE)
rcToolbar.top += ERRORPANEL_HEIGHT;
if (m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED || m_bNotOnList) {
@@ -2225,13 +2225,13 @@ void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const }
}
- ::GetWindowRect(::GetDlgItem(m_hwnd, m_bType == SESSIONTYPE_CHAT ? IDC_MESSAGE : IDC_MESSAGE), &rc);
+ ::GetWindowRect(m_message.GetHwnd(), &rc);
pt.y = rc.top - (m_bIsAutosizingInput ? 1 : 2);
::ScreenToClient(m_hwnd, &pt);
rcToolbar.bottom = pt.y;
}
else {
- GetWindowRect(::GetDlgItem(m_hwnd, m_bType == SESSIONTYPE_CHAT ? IDC_MESSAGE : IDC_MESSAGE), &rc);
+ GetWindowRect(m_message.GetHwnd(), &rc);
pt.y = rc.bottom - 2;
ScreenToClient(m_hwnd, &pt);
rcToolbar.top = pt.y + 1;
@@ -2454,7 +2454,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const void CTabBaseDlg::UpdateToolbarBG()
{
RECT rcUpdate, rcTmp;
- ::GetWindowRect(::GetDlgItem(m_hwnd, m_bType == SESSIONTYPE_IM ? IDC_LOG : IDC_LOG), &rcTmp);
+ ::GetWindowRect(m_log.GetHwnd(), &rcTmp);
POINT pt;
pt.x = rcTmp.left;
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index e160b81b3b..2e2a6f690d 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -159,7 +159,7 @@ invalid_code: }
if (!(dwFlags & MWF_LOG_TEXTFORMAT) || message.find(L"://") != message.npos) {
- dat->m_clr_added = clr_was_added ? TRUE : FALSE;
+ dat->m_bClrAdded = clr_was_added;
return(message.c_str());
}
@@ -226,7 +226,7 @@ ok: message.insert(beginmark, L"%%%");
message.replace(beginmark, 4, formatting_strings_begin[index]);
}
- dat->m_clr_added = clr_was_added ? TRUE : FALSE;
+ dat->m_bClrAdded = clr_was_added;
return(message.c_str());
}
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 8af9e7db0c..b66912c87d 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -827,7 +827,6 @@ static void __cdecl phase2(void * lParam) CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) : CSrmmBaseDialog(g_hInst, g_Settings.bTabsEnable ? IDD_CHANNEL_TAB : IDD_CHANNEL), - m_si(si), m_nickList(this, IDC_LIST), m_message(this, IDC_MESSAGE), m_log(this, IDC_LOG), @@ -849,6 +848,7 @@ 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; diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 9fe02becd0..076d743dad 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -177,8 +177,6 @@ class CChatRoomDlg : public CSrmmBaseDialog HWND m_hwndStatus;
- SESSION_INFO *m_si;
-
CCtrlEdit m_message, m_log;
CCtrlListBox m_nickList;
CCtrlButton m_btnOk;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 1c3331b386..58a81567f4 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -407,3 +407,4 @@ ProtoGetAvatarMimeType @401 ?DlgProc@CSrmmBaseDialog@@MAEHIIJ@Z @408 NONAME
??2CSrmmBaseDialog@@SAPAXI@Z @409 NONAME
??3CSrmmBaseDialog@@SAXPAX@Z @410 NONAME
+?isChat@CSrmmBaseDialog@@QBE_NXZ @411 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 7d21ef797f..4616073840 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -407,3 +407,4 @@ ProtoGetAvatarMimeType @401 ?DlgProc@CSrmmBaseDialog@@MEAA_JI_K_J@Z @408 NONAME
??2CSrmmBaseDialog@@SAPEAX_K@Z @409 NONAME
??3CSrmmBaseDialog@@SAXPEAX@Z @410 NONAME
+?isChat@CSrmmBaseDialog@@QEBA_NXZ @411 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 5968514838..65f6c65d3c 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -27,6 +27,7 @@ extern HCURSOR g_hCurHyperlinkHand; CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog) : CDlgBase(hInst, idDialog), + m_si(nullptr), m_pLog(nullptr), m_pEntry(nullptr), m_hContact(0) |