From 1e49d6b2cb3812d8e80051cbb3d44891e6532825 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Mar 2017 14:55:06 +0300 Subject: funny, but without cbSize we have no need in MessageWindowInputData at all --- plugins/TabSRMM/src/msgs.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index f0e8c76e7f..136c85e07d 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -64,17 +64,16 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM) // lparam = (MessageWindowData*) // returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact -static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) +static INT_PTR GetWindowData(WPARAM hContact, LPARAM lParam) { - MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; - if (mwid == nullptr || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH) + if (hContact == 0) return 1; MessageWindowData *mwd = (MessageWindowData*)lParam; if (mwd == nullptr) return 1; - HWND hwnd = M.FindWindow(mwid->hContact); + HWND hwnd = M.FindWindow(hContact); if (hwnd) { mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; mwd->hwndWindow = hwnd; @@ -83,24 +82,18 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) mwd->uState = GetWindowLongPtr(hwnd, DWLP_MSGRESULT); return 0; } - else - { - SESSION_INFO *si = SM_FindSessionByHCONTACT(mwid->hContact); - if (si != nullptr && si->pDlg != nullptr) { - mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - mwd->hwndWindow = si->pDlg->GetHwnd(); - mwd->local = GetParent(GetParent(si->pDlg->GetHwnd())); - SendMessage(si->pDlg->GetHwnd(), DM_GETWINDOWSTATE, 0, 0); - mwd->uState = GetWindowLongPtr(si->pDlg->GetHwnd(), DWLP_MSGRESULT); - return 0; - } - else { - mwd->uState = 0; - mwd->hContact = 0; - mwd->hwndWindow = 0; - mwd->uFlags = 0; - } + + SESSION_INFO *si = SM_FindSessionByHCONTACT(hContact); + if (si != nullptr && si->pDlg != nullptr) { + mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; + mwd->hwndWindow = si->pDlg->GetHwnd(); + mwd->local = GetParent(GetParent(si->pDlg->GetHwnd())); + SendMessage(si->pDlg->GetHwnd(), DM_GETWINDOWSTATE, 0, 0); + mwd->uState = GetWindowLongPtr(si->pDlg->GetHwnd(), DWLP_MSGRESULT); + return 0; } + + memset(mwd, 0, sizeof(*mwd)); return 1; } -- cgit v1.2.3