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 --- plugins/TabSRMM/src/chat_window.cpp | 15 +++++++-------- plugins/TabSRMM/src/globals.cpp | 5 +---- plugins/TabSRMM/src/globals.h | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 14 ++++---------- plugins/TabSRMM/src/msgs.cpp | 30 ------------------------------ plugins/TabSRMM/src/msgs.h | 12 ------------ 6 files changed, 13 insertions(+), 65 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 77574de5a7..d73ca8f181 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -527,7 +527,7 @@ void CChatRoomDlg::OnInitDialog() m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); m_log.SendMsg(EM_AUTOURLDETECT, 1, 0); SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc); - FireEvent(MSG_WINDOW_EVT_OPENING, 0); + NotifyEvent(MSG_WINDOW_EVT_OPENING); m_log.SendMsg(EM_SETEVENTMASK, 0, m_log.SendMsg(EM_GETEVENTMASK, 0, 0) | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS); m_log.SendMsg(EM_LIMITTEXT, 0x7FFFFFFF, 0); @@ -572,7 +572,7 @@ void CChatRoomDlg::OnInitDialog() ShowWindow(m_hwnd, SW_SHOW); UpdateNickList(); m_pContainer->m_hwndActive = m_hwnd; - FireEvent(MSG_WINDOW_EVT_OPEN, 0); + NotifyEvent(MSG_WINDOW_EVT_OPEN); } void CChatRoomDlg::OnDestroy() @@ -588,7 +588,7 @@ void CChatRoomDlg::OnDestroy() m_si->pDlg = nullptr; m_si = nullptr; - FireEvent(MSG_WINDOW_EVT_CLOSING, 0); + NotifyEvent(MSG_WINDOW_EVT_CLOSING); DM_FreeTheme(); @@ -617,7 +617,7 @@ void CChatRoomDlg::OnDestroy() M.RemoveWindow(m_hwnd); - FireEvent(MSG_WINDOW_EVT_CLOSE, 0); + NotifyEvent(MSG_WINDOW_EVT_CLOSE); m_pContainer->ClearMargins(); PostMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1); @@ -1312,11 +1312,10 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) } return 0; } + if (wParam != VK_RIGHT && wParam != VK_LEFT) { - mir_free(m_wszSearchQuery); - m_wszSearchQuery = nullptr; - mir_free(m_wszSearchResult); - m_wszSearchResult = nullptr; + replaceStrW(m_wszSearchQuery, nullptr); + replaceStrW(m_wszSearchResult, nullptr); } if (wParam == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab) diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 64b280b13e..9fd2aa5151 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -297,15 +297,13 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) if (M.GetByte("avatarmode", -1) == -1) db_set_b(0, SRMSGMOD_T, "avatarmode", 2); - PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, - 0, 0, 40, 40, 0, 0, g_hInst, nullptr); + PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, 0, 0, 40, 40, 0, 0, g_hInst, nullptr); ::CreateTrayMenus(TRUE); if (nen_options.bTraySupport) ::CreateSystrayIcon(TRUE); CMenuItem mi; - SET_UID(mi, 0x9f68b822, 0xff97, 0x477d, 0xb7, 0x6d, 0xa5, 0x59, 0x33, 0x1c, 0x54, 0x40); mi.position = -500050005; mi.hIcolibItem = PluginConfig.g_iconContainer; @@ -468,7 +466,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM) ::SI_DeinitStatusIcons(); // the event API - DestroyHookableEvent(PluginConfig.m_event_MsgWin); DestroyHookableEvent(PluginConfig.m_event_MsgPopup); DestroyHookableEvent(PluginConfig.m_event_WriteEvent); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 244a7f68f8..e73fb1f62a 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -136,7 +136,7 @@ public: COLORREF m_ipBackgroundGradient; COLORREF m_ipBackgroundGradientHigh; COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor; - HANDLE m_event_MsgWin, m_event_MsgPopup, m_event_WriteEvent; + HANDLE m_event_MsgPopup, m_event_WriteEvent; HGENMENU m_hMenuItem; BYTE m_useAeroPeek; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 8f73008fb2..8c856fbdc8 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -725,7 +725,7 @@ void CSrmmWindow::OnInitDialog() SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0); SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0); - FireEvent(MSG_WINDOW_EVT_OPENING); + NotifyEvent(MSG_WINDOW_EVT_OPENING); for (int i = 0; i < _countof(tooltips); i++) SendDlgItemMessage(m_hwnd, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE); @@ -858,7 +858,7 @@ void CSrmmWindow::OnInitDialog() mir_subclassWindow(m_hwndHPP, HPPKFSubclassProc); m_dwFlags &= ~MWF_INITMODE; - FireEvent(MSG_WINDOW_EVT_OPEN); + NotifyEvent(MSG_WINDOW_EVT_OPEN); if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) { m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED; @@ -887,7 +887,7 @@ void CSrmmWindow::OnDestroy() DestroyWindow(m_hwndPanelPicParent); if (m_cache->isValid()) { // not valid means the contact was deleted - FireEvent(MSG_WINDOW_EVT_CLOSING); + NotifyEvent(MSG_WINDOW_EVT_CLOSING); 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) { @@ -946,7 +946,7 @@ void CSrmmWindow::OnDestroy() m_iTabID = -1; } - FireEvent(MSG_WINDOW_EVT_CLOSE); + NotifyEvent(MSG_WINDOW_EVT_CLOSE); // clean up IEView and H++ log windows if (m_hwndIEView != 0) { @@ -1168,12 +1168,6 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*) DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); DeletePopupsForContact(m_hContact, PU_REMOVE_ON_SEND); - if (M.GetByte("allow_sendhook", 0)) { - int result = FireEvent(MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND)); - if (result) - return; - } - sendQueue->addTo(this, memRequired, flags); } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index a348800445..f9f02f9703 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -854,35 +854,6 @@ void TSAPI CreateImageList(BOOL bInitial) PluginConfig.g_IconTypingEvent = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; } -int CTabBaseDlg::FireEvent(unsigned int type, unsigned int subType) -{ - if (m_hContact == 0 || m_hwnd == nullptr) - return 0; - - CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA); - if (dat == nullptr) - return 0; - - MessageWindowEventData mwe = { sizeof(mwe) }; - mwe.hContact = m_hContact; - mwe.hwndWindow = m_hwnd; - mwe.szModule = "tabSRMsgW"; - mwe.uType = type; - mwe.hwndInput = m_message.GetHwnd(); - mwe.hwndLog = m_log.GetHwnd(); - - if (type == MSG_WINDOW_EVT_CUSTOM) { - TABSRMM_SessionInfo se = { sizeof(se) }; - se.evtCode = HIWORD(subType); - se.hwnd = m_hwnd; - se.extraFlags = (unsigned int)(LOWORD(subType)); - se.local = dat->m_sendBuffer; - mwe.local = &se; - } - - return NotifyEventHooks(PluginConfig.m_event_MsgWin, 0, (LPARAM)&mwe); -} - ///////////////////////////////////////////////////////////////////////////////////////// // standard icon definitions @@ -1142,7 +1113,6 @@ static void TSAPI InitAPI() CB_InitCustomButtons(); // the event API - PluginConfig.m_event_MsgWin = CreateHookableEvent(ME_MSG_WINDOWEVENT); PluginConfig.m_event_MsgPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP); PluginConfig.m_event_WriteEvent = CreateHookableEvent(ME_MSG_PRECREATEEVENT); } diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 1b3c4987d3..5ab3b1e144 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -252,7 +252,6 @@ protected: void DetermineMinHeight(); void FindFirstEvent(); - int FireEvent(unsigned int type, unsigned int subType = 0); void GetSendFormat(); bool IsAutoSplitEnabled() const; void ResizeIeView(); @@ -1002,17 +1001,6 @@ struct SIDEBARITEM { #include "templates.h" -struct TABSRMM_SessionInfo { - unsigned int cbSize; - unsigned short evtCode; - HWND hwnd; // handle of the message dialog (tab) - HWND hwndContainer; // handle of the parent container - HWND hwndInput; // handle of the input area (rich edit) - UINT extraFlags; - UINT extraFlagsEX; - void *local; -}; - // callback for the user menu entry #define MS_TABMSG_SETUSERPREFS "SRMsg_MOD/SetUserPrefs" -- cgit v1.2.3