mirror of
https://github.com/znc/znc.git
synced 2026-07-03 00:11:59 +02:00
f991274789
This was found via partyline and notify_connect. notify_connect calls CZNC::Broadcast() in OnClientLogin() which calls the OnBroadcast() module call. When returning from this module calls, m_pUser and m_pClient was reset to NULL and all the following modules got their OnClientLogin() called with m_pUser and m_pClient set to NULL. This patch fixes this by resetting those vars to their old values instead to NULL when returning from a module call. This patch also fixes the bug that m_pUser and m_pClient in modules were reset to NULL after they caused a module call which called back into the current module. The fix looks similar to the other one (this one is the Modules.h part). git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1438 726aef4b-f618-498e-8847-2d620e286838
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2004-2009 See the AUTHORS file for details.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
* by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef _MAIN_H
|
|
#define _MAIN_H
|
|
|
|
// The following defines are for #if comparison (preprocessor only likes ints)
|
|
#define VERSION_MAJOR 0
|
|
#define VERSION_MINOR 67
|
|
// This one is for display purpose
|
|
#define VERSION (VERSION_MAJOR + VERSION_MINOR / 1000.0)
|
|
|
|
// You can add -DVERSION_EXTRA="stuff" to your CXXFLAGS!
|
|
#ifndef VERSION_EXTRA
|
|
#define VERSION_EXTRA ""
|
|
#endif
|
|
|
|
#ifndef _MODDIR_
|
|
#define _MODDIR_ "/usr/lib/znc"
|
|
#endif
|
|
|
|
#ifndef _DATADIR_
|
|
#define _DATADIR_ "/usr/share/znc"
|
|
#endif
|
|
|
|
#ifdef _MODULES
|
|
#define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
|
|
if (macUSER) { \
|
|
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) { \
|
|
GMods.SetUser(pOldGUser); \
|
|
GMods.SetClient(pOldGClient); \
|
|
UMods.SetClient(pOldUClient); \
|
|
macEXITER; \
|
|
} \
|
|
GMods.SetUser(pOldGUser); \
|
|
GMods.SetClient(pOldGClient); \
|
|
UMods.SetClient(pOldUClient); \
|
|
}
|
|
#else
|
|
#define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER)
|
|
#endif
|
|
|
|
|
|
#ifndef CS_STRING
|
|
#define CS_STRING CString
|
|
#endif
|
|
|
|
#ifndef _NO_CSOCKET_NS
|
|
#define _NO_CSOCKET_NS
|
|
#endif
|
|
|
|
#ifdef _DEBUG
|
|
#define __DEBUG__
|
|
#endif
|
|
|
|
#include <iostream>
|
|
using std::cout;
|
|
using std::cerr;
|
|
using std::endl;
|
|
|
|
#include "ZNCString.h"
|
|
|
|
#endif // !_MAIN_H
|