Fix implicit context of OnSendTo* hooks

Thanks for markus-j for reporting it
This commit is contained in:
Alexey Sokolov
2015-01-11 17:07:23 +00:00
parent 5608e4f201
commit 600f91f128
3 changed files with 16 additions and 16 deletions
+14 -14
View File
@@ -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) { \