From 6a9e3738066370dac38f5f6768b8a6f61fe709e0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Mar 2017 14:18:31 +0300 Subject: SRMM notifications went to the core with ME_MSG_WINDOWEVENT --- src/core/stdmsg/src/chat_window.cpp | 10 +++++----- src/core/stdmsg/src/msgdialog.cpp | 25 ++++--------------------- src/core/stdmsg/src/stdafx.h | 3 +-- 3 files changed, 10 insertions(+), 28 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 51f5ab8a98..5ba99792bb 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -64,7 +64,7 @@ void CChatRoomDlg::OnInitDialog() WindowList_Add(pci->hWindowList, m_hwnd, m_hContact); - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING); + NotifyEvent(MSG_WINDOW_EVT_OPENING); m_log.SendMsg(EM_AUTOURLDETECT, 1, 0); @@ -89,12 +89,12 @@ void CChatRoomDlg::OnInitDialog() SendMessage(m_hwnd, WM_SIZE, 0, 0); - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN); + NotifyEvent(MSG_WINDOW_EVT_OPEN); } void CChatRoomDlg::OnDestroy() { - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING); + NotifyEvent(MSG_WINDOW_EVT_CLOSING); SaveWindowPosition(true); if (!g_Settings.bTabsEnable) { @@ -112,7 +112,7 @@ void CChatRoomDlg::OnDestroy() m_si->wState &= ~STATE_TALK; DestroyWindow(m_hwndStatus); m_hwndStatus = nullptr; - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE); + NotifyEvent(MSG_WINDOW_EVT_CLOSE); CSuper::OnDestroy(); } @@ -764,7 +764,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) if (ProcessHotkeys(wParam, isShift, isCtrl, isAlt)) return TRUE; - if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (paste clean text) + if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (toggle filter) onClick_Filter(&m_btnFilter); return TRUE; } diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 71ec207848..689916ccfb 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -35,22 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static const UINT sendControls[] = { IDC_SRMM_MESSAGE }; -void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) -{ - if (hContact != NULL && hwnd != NULL) { - MessageWindowEventData mwe = {}; - mwe.cbSize = sizeof(mwe); - mwe.hContact = hContact; - mwe.hwndWindow = hwnd; - mwe.szModule = SRMMMOD; - mwe.uType = type; - mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - mwe.hwndInput = GetDlgItem(hwnd, IDC_SRMM_MESSAGE); - mwe.hwndLog = GetDlgItem(hwnd, IDC_SRMM_LOG); - NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe); - } -} - static int RTL_Detect(const wchar_t *ptszText) { int iLen = (int)mir_wstrlen(ptszText); @@ -141,7 +125,7 @@ void CSrmmWindow::OnInitDialog() m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY); m_wMinute = 61; - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING); + NotifyEvent(MSG_WINDOW_EVT_OPENING); if (m_wszInitialText) { m_message.SetText(m_wszInitialText); @@ -298,13 +282,13 @@ void CSrmmWindow::OnInitDialog() } SendMessage(m_hwnd, DM_GETAVATAR, 0, 0); - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN); + NotifyEvent(MSG_WINDOW_EVT_OPEN); } void CSrmmWindow::OnDestroy() { SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING); + NotifyEvent(MSG_WINDOW_EVT_CLOSING); // save string from the editor if (m_hContact) { @@ -346,7 +330,7 @@ void CSrmmWindow::OnDestroy() db_set_dw(hContact, SRMMMOD, "width", wp.rcNormalPosition.right - wp.rcNormalPosition.left); db_set_dw(hContact, SRMMMOD, "height", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); - NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE); + NotifyEvent(MSG_WINDOW_EVT_CLOSE); if (m_hContact && g_dat.bDeleteTempCont) if (db_get_b(m_hContact, "CList", "NotOnList", 0)) db_delete_contact(m_hContact); @@ -741,7 +725,6 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) static const CHARRANGE all = { 0, -1 }; MessageWindowPopupData mwpd = {}; - mwpd.cbSize = sizeof(mwpd); mwpd.uType = MSG_WINDOWPOPUP_SHOWING; mwpd.uFlags = MSG_WINDOWPOPUP_INPUT; mwpd.hContact = m_hContact; diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 7d7e196839..b97132d10e 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -81,7 +81,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define GC_SWITCHTAB (WM_USER+0x106) extern HINSTANCE g_hInst; -extern HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite; +extern HANDLE hHookWinPopup, hHookWinWrite; extern CREOleCallback reOleCallback; ///////////////////////////////////////////////////////////////////////////////////////// @@ -150,7 +150,6 @@ int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, bool bHide); // message.cpp char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si); -void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type); // tabs.cpp -- cgit v1.2.3