From 978b44865b77eb0029e6033dcbfc0876954cef2e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 7 Apr 2017 15:32:08 +0300 Subject: SRMM events are now created inside the core to avoid problems with dynamic plugin unload --- plugins/TabSRMM/src/chat_window.cpp | 4 ++-- plugins/TabSRMM/src/globals.cpp | 5 ----- plugins/TabSRMM/src/globals.h | 1 - plugins/TabSRMM/src/msgdialog.cpp | 4 ++-- plugins/TabSRMM/src/msgs.cpp | 4 ---- plugins/TabSRMM/src/sendqueue.cpp | 2 +- 6 files changed, 5 insertions(+), 15 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index e31874b986..0635fce62b 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -1123,13 +1123,13 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) mwpd.hwnd = m_message.GetHwnd(); mwpd.hMenu = hSubMenu; mwpd.pt = pt; - NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); mwpd.selection = iSelection; mwpd.uType = MSG_WINDOWPOPUP_SELECTED; - NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); switch (iSelection) { case IDM_COPY: diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 11c85ec380..99eceeed14 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -464,11 +464,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM) db_set_dw(hContact, SRMSGMOD_T, "messagecount", 0); ::SI_DeinitStatusIcons(); - - // the event API - DestroyHookableEvent(PluginConfig.m_event_MsgPopup); - DestroyHookableEvent(PluginConfig.m_event_WriteEvent); - ::NEN_WriteOptions(&nen_options); ::DestroyWindow(PluginConfig.g_hwndHotkeyHandler); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index e73fb1f62a..7eb87efa7c 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -136,7 +136,6 @@ public: COLORREF m_ipBackgroundGradient; COLORREF m_ipBackgroundGradientHigh; COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor; - 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 37c09e2782..86dd2ea20d 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -110,14 +110,14 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) mwpd.hMenu = hSubMenu; mwpd.selection = 0; mwpd.pt = pt; - NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); // Second notification mwpd.selection = iSelection; mwpd.uType = MSG_WINDOWPOPUP_SELECTED; - NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); + NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd); switch (iSelection) { case IDM_COPY: diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index ea324dd809..5773c2240a 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -1015,10 +1015,6 @@ static void TSAPI InitAPI() SI_InitStatusIcons(); CB_InitCustomButtons(); - - // the event API - PluginConfig.m_event_MsgPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP); - PluginConfig.m_event_WriteEvent = CreateHookableEvent(ME_MSG_PRECREATEEVENT); } int LoadSendRecvMessageModule(void) diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 8c7557a11f..787e815da8 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -500,7 +500,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) dbei.pBlob = (PBYTE)job.szSendBuffer; MessageWindowEvent evt = { job.iSendId, job.hContact, &dbei }; - NotifyEventHooks(PluginConfig.m_event_WriteEvent, 0, (LPARAM)&evt); + NotifyEventHooks(pci->hevPreCreate, 0, (LPARAM)&evt); job.szSendBuffer = (char*)dbei.pBlob; MEVENT hNewEvent = db_event_add(job.hContact, &dbei); -- cgit v1.2.3