mirror of
https://github.com/znc/znc.git
synced 2026-08-08 01:43:03 +02:00
Remove GLOBALMODCONSTRUCTOR
MODCONSTRUCTOR does that job just fine (now). Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
+2
-13
@@ -100,7 +100,6 @@ const CString& CTimer::GetDescription() const { return m_sDescription; }
|
||||
|
||||
|
||||
CModule::CModule(ModHandle pDLL, CUser* pUser, const CString& sModName, const CString& sDataDir) {
|
||||
m_eType = CModInfo::UserModule;
|
||||
m_pDLL = pDLL;
|
||||
m_pManager = &(CZNC::Get().GetManager());;
|
||||
m_pUser = pUser;
|
||||
@@ -110,19 +109,9 @@ CModule::CModule(ModHandle pDLL, CUser* pUser, const CString& sModName, const CS
|
||||
|
||||
if (m_pUser) {
|
||||
m_sSavePath = m_pUser->GetUserPath() + "/moddata/" + m_sModName;
|
||||
LoadRegistry();
|
||||
} else {
|
||||
m_sSavePath = CZNC::Get().GetZNCPath() + "/moddata/" + m_sModName;
|
||||
}
|
||||
}
|
||||
|
||||
CModule::CModule(ModHandle pDLL, const CString& sModName, const CString& sDataDir) {
|
||||
m_pDLL = pDLL;
|
||||
m_pManager = &(CZNC::Get().GetManager());
|
||||
m_pUser = NULL;
|
||||
m_pClient = NULL;
|
||||
m_sModName = sModName;
|
||||
m_sDataDir = sDataDir;
|
||||
|
||||
m_sSavePath = CZNC::Get().GetZNCPath() + "/moddata/" + m_sModName;
|
||||
LoadRegistry();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ template<class M> CModule* TModLoad(ModHandle p, CUser* pUser,
|
||||
}
|
||||
template<class M> CModule* TModLoadGlobal(ModHandle p,
|
||||
const CString& sModName, const CString& sModPath) {
|
||||
return new M(p, sModName, sModPath);
|
||||
return new M(p, NULL, sModName, sModPath);
|
||||
}
|
||||
|
||||
#if HAVE_VISIBILITY
|
||||
@@ -86,7 +86,6 @@ template<class M> CModule* TModLoadGlobal(ModHandle p,
|
||||
* \endcode
|
||||
*
|
||||
* @param CLASS The name of your module's class.
|
||||
* @see For global modules you need GLOBALMODCONSTRUCTOR.
|
||||
*/
|
||||
#define MODCONSTRUCTOR(CLASS) \
|
||||
CLASS(ModHandle pDLL, CUser* pUser, const CString& sModName, \
|
||||
@@ -104,11 +103,6 @@ template<class M> CModule* TModLoadGlobal(ModHandle p,
|
||||
// !User Module Macros
|
||||
|
||||
// Global Module Macros
|
||||
/** This works exactly like MODCONSTRUCTOR, but for global modules. */
|
||||
#define GLOBALMODCONSTRUCTOR(CLASS) \
|
||||
CLASS(ModHandle pDLL, const CString& sModName, const CString& sModPath) \
|
||||
: CModule(pDLL, sModName, sModPath)
|
||||
|
||||
/** This works exactly like MODULEDEFS, but for global modules. */
|
||||
#define GLOBALMODULEDEFS(CLASS, DESCRIPTION) \
|
||||
MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::GlobalModule, Info.SetGlobalLoader(TModLoadGlobal<CLASS>))
|
||||
@@ -312,7 +306,6 @@ class CModule {
|
||||
public:
|
||||
CModule(ModHandle pDLL, CUser* pUser, const CString& sModName,
|
||||
const CString& sDataDir);
|
||||
CModule(ModHandle pDLL, const CString& sModName, const CString& sDataDir);
|
||||
virtual ~CModule();
|
||||
|
||||
/** This enum is just used for return from module hooks. Based on this
|
||||
|
||||
@@ -79,8 +79,7 @@
|
||||
* call #MODULEDEFS at the end of your source file.
|
||||
* Congratulations, you just wrote your first module. <br>
|
||||
* For global modules, the procedure is similar. Instead of CModule you inherit
|
||||
* from CModule. The two macros are replaced by #GLOBALMODCONSTRUCTOR and
|
||||
* #GLOBALMODULEDEFS.
|
||||
* from CModule.
|
||||
*
|
||||
* If you want your module to actually do something, you should override some
|
||||
* of the hooks from CModule. These are the functions whose names start with
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
class CAdminLogMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CAdminLogMod) {
|
||||
MODCONSTRUCTOR(CAdminLogMod) {
|
||||
openlog("znc", LOG_PID, LOG_DAEMON);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
class CBlockUser : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CBlockUser) {}
|
||||
MODCONSTRUCTOR(CBlockUser) {}
|
||||
|
||||
virtual ~CBlockUser() {}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
class CSSLClientCertMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CSSLClientCertMod) {
|
||||
MODCONSTRUCTOR(CSSLClientCertMod) {
|
||||
AddHelpCommand();
|
||||
AddCommand("Add", static_cast<CModCommand::ModCmdFunc>(&CSSLClientCertMod::HandleAddCommand),
|
||||
"[pubkey]", "If pubkey is not provided will use the current key");
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
class CDroproot : public CModule {
|
||||
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CDroproot) {
|
||||
MODCONSTRUCTOR(CDroproot) {
|
||||
}
|
||||
|
||||
virtual ~CDroproot() {
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
|
||||
class CIMAPAuthMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CIMAPAuthMod) {
|
||||
MODCONSTRUCTOR(CIMAPAuthMod) {
|
||||
m_Cache.SetTTL(60000);
|
||||
m_sServer = "localhost";
|
||||
m_uPort = 143;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
class CMotdFileMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CMotdFileMod) {}
|
||||
MODCONSTRUCTOR(CMotdFileMod) {}
|
||||
virtual ~CMotdFileMod() {}
|
||||
|
||||
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class CNotifyConnectMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CNotifyConnectMod) {}
|
||||
MODCONSTRUCTOR(CNotifyConnectMod) {}
|
||||
|
||||
virtual void OnClientLogin() {
|
||||
SendAdmins(m_pUser->GetUserName() + " attached (from " + m_pClient->GetRemoteIP() + ")");
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
class CSASLAuthMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CSASLAuthMod) {
|
||||
MODCONSTRUCTOR(CSASLAuthMod) {
|
||||
m_Cache.SetTTL(60000/*ms*/);
|
||||
}
|
||||
virtual ~CSASLAuthMod() {}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class CFailToBanMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CFailToBanMod) {}
|
||||
MODCONSTRUCTOR(CFailToBanMod) {}
|
||||
virtual ~CFailToBanMod() {}
|
||||
|
||||
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
|
||||
|
||||
@@ -17,7 +17,7 @@ class CIdentFileModule : public CModule {
|
||||
CIRCSock *m_pIRCSock;
|
||||
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CIdentFileModule) {
|
||||
MODCONSTRUCTOR(CIdentFileModule) {
|
||||
AddHelpCommand();
|
||||
AddCommand("GetFile", static_cast<CModCommand::ModCmdFunc>(&CIdentFileModule::GetFile));
|
||||
AddCommand("SetFile", static_cast<CModCommand::ModCmdFunc>(&CIdentFileModule::SetFile),
|
||||
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CLastSeenMod) {
|
||||
MODCONSTRUCTOR(CLastSeenMod) {
|
||||
AddHelpCommand();
|
||||
AddCommand("Show", static_cast<CModCommand::ModCmdFunc>(&CLastSeenMod::ShowCommand));
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ extern "C" {
|
||||
class CModPerl: public CModule {
|
||||
PerlInterpreter *m_pPerl;
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CModPerl) {
|
||||
MODCONSTRUCTOR(CModPerl) {
|
||||
m_pPerl = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
GLOBALMODCONSTRUCTOR(CModPython) {
|
||||
MODCONSTRUCTOR(CModPython) {
|
||||
Py_Initialize();
|
||||
m_PyFormatException = NULL;
|
||||
m_PyZNCModule = NULL;
|
||||
|
||||
@@ -25,7 +25,7 @@ class CPyModule : public CModule {
|
||||
public:
|
||||
CPyModule(const CString& sModName, const CString& sDataPath,
|
||||
PyObject* pyObj, CModule* pModPython)
|
||||
: CModule(NULL, sModName, sDataPath) {
|
||||
: CModule(NULL, NULL, sModName, sDataPath) {
|
||||
m_pyObj = pyObj;
|
||||
Py_INCREF(pyObj);
|
||||
m_pModPython = reinterpret_cast<CModPython*>(pModPython);
|
||||
|
||||
@@ -43,7 +43,7 @@ protected:
|
||||
|
||||
class CPartylineMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CPartylineMod) {}
|
||||
MODCONSTRUCTOR(CPartylineMod) {}
|
||||
|
||||
virtual ~CPartylineMod() {
|
||||
while (m_ssChannels.size()) {
|
||||
|
||||
@@ -53,7 +53,7 @@ inline bool FOR_EACH_MODULE_CanContinue(FOR_EACH_MODULE_Type& state, CModules::i
|
||||
|
||||
class CWebAdminMod : public CModule {
|
||||
public:
|
||||
GLOBALMODCONSTRUCTOR(CWebAdminMod) {
|
||||
MODCONSTRUCTOR(CWebAdminMod) {
|
||||
VPair vParams;
|
||||
vParams.push_back(make_pair("user", ""));
|
||||
AddSubPage(new CWebSubPage("settings", "Global Settings", CWebSubPage::F_ADMIN));
|
||||
|
||||
Reference in New Issue
Block a user