Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove GLOBALMODCONSTRUCTOR

MODCONSTRUCTOR does that job just fine (now).

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information...
commit 80c76c97a6fa759b2d499715ad45eac6803f7827 1 parent c2cc57c
@psychon psychon authored
View
15 Modules.cpp
@@ -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();
}
View
9 Modules.h
@@ -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
View
3  main.h
@@ -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
View
2  modules/adminlog.cpp
@@ -15,7 +15,7 @@
class CAdminLogMod : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CAdminLogMod) {
+ MODCONSTRUCTOR(CAdminLogMod) {
openlog("znc", LOG_PID, LOG_DAEMON);
}
View
2  modules/blockuser.cpp
@@ -14,7 +14,7 @@
class CBlockUser : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CBlockUser) {}
+ MODCONSTRUCTOR(CBlockUser) {}
virtual ~CBlockUser() {}
View
2  modules/certauth.cpp
@@ -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");
View
2  modules/extra/droproot.cpp
@@ -21,7 +21,7 @@
class CDroproot : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CDroproot) {
+ MODCONSTRUCTOR(CDroproot) {
}
virtual ~CDroproot() {
View
2  modules/extra/imapauth.cpp
@@ -41,7 +41,7 @@ class CIMAPSock : public CSocket {
class CIMAPAuthMod : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CIMAPAuthMod) {
+ MODCONSTRUCTOR(CIMAPAuthMod) {
m_Cache.SetTTL(60000);
m_sServer = "localhost";
m_uPort = 143;
View
2  modules/extra/motdfile.cpp
@@ -12,7 +12,7 @@
class CMotdFileMod : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CMotdFileMod) {}
+ MODCONSTRUCTOR(CMotdFileMod) {}
virtual ~CMotdFileMod() {}
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
View
2  modules/extra/notify_connect.cpp
@@ -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() + ")");
View
2  modules/extra/saslauth.cpp
@@ -17,7 +17,7 @@
class CSASLAuthMod : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CSASLAuthMod) {
+ MODCONSTRUCTOR(CSASLAuthMod) {
m_Cache.SetTTL(60000/*ms*/);
}
virtual ~CSASLAuthMod() {}
View
2  modules/fail2ban.cpp
@@ -10,7 +10,7 @@
class CFailToBanMod : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CFailToBanMod) {}
+ MODCONSTRUCTOR(CFailToBanMod) {}
virtual ~CFailToBanMod() {}
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
View
2  modules/identfile.cpp
@@ -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),
View
2  modules/lastseen.cpp
@@ -61,7 +61,7 @@ class CLastSeenMod : public CModule {
}
public:
- GLOBALMODCONSTRUCTOR(CLastSeenMod) {
+ MODCONSTRUCTOR(CLastSeenMod) {
AddHelpCommand();
AddCommand("Show", static_cast<CModCommand::ModCmdFunc>(&CLastSeenMod::ShowCommand));
}
View
2  modules/modperl.cpp
@@ -34,7 +34,7 @@ extern "C" {
class CModPerl: public CModule {
PerlInterpreter *m_pPerl;
public:
- GLOBALMODCONSTRUCTOR(CModPerl) {
+ MODCONSTRUCTOR(CModPerl) {
m_pPerl = NULL;
}
View
2  modules/modpython.cpp
@@ -69,7 +69,7 @@ class CModPython: public CModule {
return result;
}
- GLOBALMODCONSTRUCTOR(CModPython) {
+ MODCONSTRUCTOR(CModPython) {
Py_Initialize();
m_PyFormatException = NULL;
m_PyZNCModule = NULL;
View
2  modules/modpython/module.h
@@ -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);
View
2  modules/partyline.cpp
@@ -43,7 +43,7 @@ class CPartylineChannel {
class CPartylineMod : public CModule {
public:
- GLOBALMODCONSTRUCTOR(CPartylineMod) {}
+ MODCONSTRUCTOR(CPartylineMod) {}
virtual ~CPartylineMod() {
while (m_ssChannels.size()) {
View
2  modules/webadmin.cpp
@@ -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));

0 comments on commit 80c76c9

Please sign in to comment.
Something went wrong with that request. Please try again.