]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Move initialization that throws configuration exceptions to init()
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 17 Jan 2010 17:10:45 +0000 (17:10 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 17 Jan 2010 17:10:45 +0000 (17:10 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12279 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_banredirect.cpp
src/modules/m_callerid.cpp
src/modules/m_cloaking.cpp
src/modules/m_filter.cpp
src/modules/m_helpop.cpp
src/modules/m_ojoin.cpp
src/modules/m_rline.cpp

index 1ab3c3243d05bbf6f258b1c166c5fa66e6ed7abe..afa7e42257c00ad958c79cc6385cb20664024ba7 100644 (file)
@@ -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");
 
index 86d488cd8d7d8920d0cd8c5349157c3f248df511..bb847d8bc27228048c07e2271f0520724539e30a 100644 (file)
@@ -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);
index 22114c54e7930a5069fe184e29bcc77f45d66d6a..1b30f410a427af041bddfd8208cd0106d5981530 100644 (file)
@@ -120,6 +120,10 @@ class ModuleCloaking : public Module
 
  public:
        ModuleCloaking() : cu(this), Hash(this, "hash/md5")
+       {
+       }
+
+       void init()
        {
                OnRehash(NULL);
 
index 713643043b84de75737f598479d6fa29dd3a601a..35aca62620ecfd7f41b65536518c2fdde3fa8380 100644 (file)
@@ -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);
@@ -254,6 +254,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 };
index cbb56c3f9c5b01e3f68ed647bf8d5af5bec8ea56..5cd8d8ea0701f1845a3ccdc4a4b100f2f75603dd 100644 (file)
@@ -118,16 +118,19 @@ class ModuleHelpop : public Module
        public:
                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;
 
index cacc206d69e84e1b3de15a1e239346e968aa9c76..176a0e613e648259b9ea960080e7bf562a4d12b6 100644 (file)
@@ -211,6 +211,10 @@ class ModuleOjoin : public Module
 
        ModuleOjoin()
                : np(NULL), mycommand(this)
+       {
+       }
+
+       void init()
        {
                /* Load config stuff */
                OnRehash(NULL);
@@ -218,13 +222,8 @@ class ModuleOjoin : public Module
                /* 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);
index d528702844701fc6e1d31064d5d60bf6cf60284c..0df36eb37e8f4e45609b1f0320cb24083a712c79 100644 (file)
@@ -204,6 +204,10 @@ class ModuleRLine : public Module
 
  public:
        ModuleRLine() : rxfactory(this, "regex"), f(rxfactory), r(this, f)
+       {
+       }
+
+       void init()
        {
                OnRehash(NULL);