diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-17 17:10:45 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-17 17:10:45 +0000 |
commit | 5d474dc9fbd9bd36d0a0a8df93e1ec1e180864d7 (patch) | |
tree | ca8c0647f00e166256755aeeea2e82ef597998da /src/modules | |
parent | 4b6bdeccb537b6f8030172c37afa7dc324e26765 (diff) |
Move initialization that throws configuration exceptions to init()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12279 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_banredirect.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_callerid.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_cloaking.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_ojoin.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_rline.cpp | 4 |
7 files changed, 37 insertions, 17 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 1ab3c3243..afa7e4225 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -210,7 +210,11 @@ class ModuleBanRedirect : public Module : re(this) { nofollow = false; + } + + void init() + { if(!ServerInstance->Modes->AddModeWatcher(&re)) throw ModuleException("Could not add mode watcher"); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 86d488cd8..bb847d8bc 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -344,13 +344,15 @@ private: public: ModuleCallerID() : cmd(this), myumode(this) { - OnRehash(NULL); + } - if (!ServerInstance->Modes->AddMode(&myumode)) - throw ModuleException("Could not add usermode +g"); + void init() + { + OnRehash(NULL); - ServerInstance->AddCommand(&cmd); - ServerInstance->Extensions.Register(&cmd.extInfo); + ServerInstance->Modules->AddService(myumode); + ServerInstance->Modules->AddService(cmd); + ServerInstance->Modules->AddService(cmd.extInfo); Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage }; ServerInstance->Modules->Attach(eventlist, this, 6); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 22114c54e..1b30f410a 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -121,6 +121,10 @@ class ModuleCloaking : public Module public: ModuleCloaking() : cu(this), Hash(this, "hash/md5") { + } + + void init() + { OnRehash(NULL); /* Register it with the core */ diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 713643043..35aca6262 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -139,7 +139,7 @@ class ModuleFilter : public Module std::vector<std::string> exemptfromfilter; // List of channel names excluded from filtering. ModuleFilter(); - + void init(); ~ModuleFilter(); ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); FilterResult* FilterMatch(User* user, const std::string &text, int flags); @@ -255,6 +255,10 @@ bool ModuleFilter::AppliesToMe(User* user, FilterResult* filter, int iflags) ModuleFilter::ModuleFilter() : filtcommand(this), RegexEngine(this, "regex") { +} + +void ModuleFilter::init() +{ ServerInstance->AddCommand(&filtcommand); Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncNetwork, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 7); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index cbb56c3f9..5cd8d8ea0 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -119,15 +119,18 @@ class ModuleHelpop : public Module ModuleHelpop() : cmd(this), ho(this) { + } + + void init() + { ReadConfig(); - if (!ServerInstance->Modes->AddMode(&ho)) - throw ModuleException("Could not add new modes!"); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(ho); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnRehash, I_OnWhois }; ServerInstance->Modules->Attach(eventlist, this, 2); } - virtual void ReadConfig() + void ReadConfig() { ConfigReader MyConf; diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index cacc206d6..176a0e613 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -212,19 +212,18 @@ class ModuleOjoin : public Module ModuleOjoin() : np(NULL), mycommand(this) { + } + + void init() + { /* Load config stuff */ OnRehash(NULL); /* Initialise module variables */ np = new NetworkPrefix(this); - if (!ServerInstance->Modes->AddMode(np)) - { - delete np; - throw ModuleException("Could not add new mode!"); - } - - ServerInstance->AddCommand(&mycommand); + ServerInstance->Modules->AddService(*np); + ServerInstance->Modules->AddService(mycommand); Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserPreKick, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index d52870284..0df36eb37 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -205,6 +205,10 @@ class ModuleRLine : public Module public: ModuleRLine() : rxfactory(this, "regex"), f(rxfactory), r(this, f) { + } + + void init() + { OnRehash(NULL); ServerInstance->AddCommand(&r); |