Add new macro GLOBALMODULECALL()

MODULECALL() calls global and user modules, GLOBALMODULECALL() only calls global
modules. The macro arguments are the same, but GLOBALMODULECALL() can live with
a user being NULL while MODULECALL() detests being called like that.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2074 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-07-08 16:05:40 +00:00
parent 4410096e0b
commit 430898be46
+16 -8
View File
@@ -28,25 +28,33 @@
#define _DATADIR_ "/usr/share/znc"
#endif
#define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
if (macUSER) { \
#define GLOBALMODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
do { \
CGlobalModules& GMods = CZNC::Get().GetModules(); \
CModules& UMods = macUSER->GetModules(); \
CUser* pOldGUser = GMods.GetUser(); \
CClient* pOldGClient = GMods.GetClient(); \
CClient* pOldUClient = UMods.GetClient(); \
GMods.SetUser(macUSER); \
GMods.SetClient(macCLIENT); \
UMods.SetClient(macCLIENT); \
if (GMods.macFUNC || UMods.macFUNC) { \
if (GMods.macFUNC) { \
GMods.SetUser(pOldGUser); \
GMods.SetClient(pOldGClient); \
UMods.SetClient(pOldUClient); \
macEXITER; \
} \
GMods.SetUser(pOldGUser); \
GMods.SetClient(pOldGClient); \
UMods.SetClient(pOldUClient); \
} while (false)
#define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
if (macUSER) { \
GLOBALMODULECALL(macFUNC, macUSER, macCLIENT, macEXITER); \
CModules& UMods = macUSER->GetModules(); \
CClient* pOldUClient = UMods.GetClient(); \
UMods.SetClient(macCLIENT); \
if (UMods.macFUNC) { \
UMods.SetClient(pOldUClient); \
macEXITER; \
} \
UMods.SetClient(pOldUClient); \
}
/** @mainpage