mirror of
https://github.com/znc/znc.git
synced 2026-08-12 11:52:57 +02:00
Fix implicit context of OnSendTo* hooks
Thanks for markus-j for reporting it
This commit is contained in:
+14
-14
@@ -77,30 +77,30 @@ extern bool ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER;
|
||||
|
||||
#define _USERMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
|
||||
do { \
|
||||
assert(macUSER != NULL); \
|
||||
bool bGlobalExited = false; \
|
||||
_GLOBALMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, &bGlobalExited); \
|
||||
if (bGlobalExited) { \
|
||||
*macEXITER = true; \
|
||||
break; \
|
||||
} \
|
||||
CModules& UMods = macUSER->GetModules(); \
|
||||
CIRCNetwork* pOldUNetwork = UMods.GetNetwork(); \
|
||||
CClient* pOldUClient = UMods.GetClient(); \
|
||||
UMods.SetNetwork(macNETWORK); \
|
||||
UMods.SetClient(macCLIENT); \
|
||||
if (UMods.macFUNC) { \
|
||||
UMods.SetNetwork(pOldUNetwork); \
|
||||
UMods.SetClient(pOldUClient); \
|
||||
*macEXITER = true; \
|
||||
} \
|
||||
UMods.SetNetwork(pOldUNetwork); \
|
||||
UMods.SetClient(pOldUClient); \
|
||||
if (macUSER != nullptr) { \
|
||||
CModules& UMods = macUSER->GetModules(); \
|
||||
CIRCNetwork* pOldUNetwork = UMods.GetNetwork(); \
|
||||
CClient* pOldUClient = UMods.GetClient(); \
|
||||
UMods.SetNetwork(macNETWORK); \
|
||||
UMods.SetClient(macCLIENT); \
|
||||
if (UMods.macFUNC) { \
|
||||
UMods.SetNetwork(pOldUNetwork); \
|
||||
UMods.SetClient(pOldUClient); \
|
||||
*macEXITER = true; \
|
||||
} \
|
||||
UMods.SetNetwork(pOldUNetwork); \
|
||||
UMods.SetClient(pOldUClient); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define NETWORKMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
|
||||
do { \
|
||||
assert(macUSER != NULL); \
|
||||
bool bUserExited = false; \
|
||||
_USERMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, &bUserExited); \
|
||||
if (bUserExited) { \
|
||||
|
||||
Reference in New Issue
Block a user