diff options
author | George Hazan <ghazan@miranda.im> | 2017-04-07 15:32:08 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-04-07 15:32:08 +0300 |
commit | 978b44865b77eb0029e6033dcbfc0876954cef2e (patch) | |
tree | ccdf74bb1e55640a5dadcd7693928adcf72a17e8 /plugins | |
parent | c46f4344f007d814131d25fa5aec6fdb4c7a049d (diff) |
SRMM events are now created inside the core to avoid problems with dynamic plugin unload
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/input.cpp | 6 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 7 | ||||
-rw-r--r-- | plugins/Scriver/src/stdafx.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.cpp | 2 |
10 files changed, 8 insertions, 28 deletions
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 36cd2601c6..670aabd547 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -152,7 +152,7 @@ static int ackevent(WPARAM, LPARAM lParam) dbei.pBlob = (PBYTE)item->sendBuffer;
MessageWindowEvent evt = { item->hSendId, hContact, &dbei };
- NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
+ NotifyEventHooks(pci->hevPreCreate, 0, (LPARAM)&evt);
item->sendBuffer = (char *)dbei.pBlob;
db_event_add(hContact, &dbei);
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index b2ec93eb56..7b2c7d5379 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-extern HANDLE hHookWinPopup;
-
enum KB_ACTIONS {KB_PREV_TAB = 1, KB_NEXT_TAB, KB_SWITCHTOOLBAR,
KB_SWITCHSTATUSBAR, KB_SWITCHTITLEBAR, KB_SWITCHINFOBAR, KB_MINIMIZE, KB_CLOSE, KB_CLEAR_LOG,
KB_TAB1, KB_TAB2, KB_TAB3, KB_TAB4, KB_TAB5, KB_TAB6, KB_TAB7, KB_TAB8, KB_TAB9, KB_SEND_ALL, KB_PASTESEND, KB_QUOTE};
@@ -72,14 +70,14 @@ void InputAreaContextMenu(HWND hwnd, WPARAM, LPARAM lParam, MCONTACT hContact) mwpd.hMenu = hSubMenu;
mwpd.selection = 0;
mwpd.pt = pt;
- NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd);
+ NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd);
int selection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), nullptr);
// Second notification
mwpd.selection = selection;
mwpd.uType = MSG_WINDOWPOPUP_SELECTED;
- NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd);
+ NotifyEventHooks(pci->hevWinPopup, 0, (LPARAM)&mwpd);
switch (selection) {
case IDM_UNDO:
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 3c56bc9a2f..3a977d8c62 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
HCURSOR hDragCursor;
-HANDLE hHookWinPopup, hHookWinWrite;
HGENMENU hMsgMenuItem;
HMODULE hMsftEdit;
@@ -618,9 +617,6 @@ int OnUnloadModule(void) {
DestroyCursor(hDragCursor);
- DestroyHookableEvent(hHookWinPopup);
- DestroyHookableEvent(hHookWinWrite);
-
ReleaseIcons();
FreeMsgLogIcons();
FreeGlobals();
@@ -663,9 +659,6 @@ int OnLoadModule(void) CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
- hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
- hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
-
SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)"));
SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)"));
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h index d6ff0fed26..221cb7b0ca 100644 --- a/plugins/Scriver/src/stdafx.h +++ b/plugins/Scriver/src/stdafx.h @@ -90,7 +90,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HINSTANCE g_hInst;
extern HCURSOR hDragCursor;
extern ITaskbarList3 *pTaskbarInterface;
-extern HANDLE hHookWinPopup, hHookWinWrite;
void ChangeStatusIcons();
void LoadInfobarFonts();
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); |