diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_botmode.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_censor.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_cloaking.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_globops.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_randquote.cpp | 37 |
7 files changed, 33 insertions, 34 deletions
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index f53f8beda..69a9495a5 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -34,7 +34,7 @@ class ModuleBotMode : public Module { Srv->Log(DEFAULT,"*** m_botmode: ERROR, failed to allocate user mode +B!"); printf("Could not claim usermode +B for this module!"); - exit(0); + return; } } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 47eea3460..c3e52899a 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -42,7 +42,8 @@ class ModuleCensor : public Module if ((Censorfile == "") || (!MyConf->Verify())) { printf("Error, could not find <censor file=\"\"> definition in your config file!"); - exit(0); + log(DEFAULT,"Error, could not find <censor file=\"\"> definition in your config file!"); + return; } Srv->Log(DEFAULT,std::string("m_censor: read configuration from ")+Censorfile); Srv->AddExtendedMode('G',MT_CHANNEL,false,0,0); @@ -182,7 +183,7 @@ class ModuleCensor : public Module { // bail if the user forgot to create a config file printf("Error, could not find <censor file=\"\"> definition in your config file!"); - exit(0); + log(DEFAULT,"Error, could not find <censor file=\"\"> definition in your config file!"); } Srv->Log(DEFAULT,std::string("m_censor: read configuration from ")+Censorfile); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 5fa77067b..764937d34 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -58,7 +58,7 @@ class ModuleCloaking : public Module // from a config file) Srv->Log(DEFAULT,"*** m_cloaking: ERROR, failed to allocate user mode +x!"); printf("Could not claim usermode +x for this module!"); - exit(0); + return; } } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 271ce9318..569ed0637 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -48,7 +48,8 @@ class ModuleFilter : public Module if ((filterfile == "") || (!MyConf->Verify())) { printf("Error, could not find <filter file=\"\"> definition in your config file!"); - exit(0); + log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!"); + return; } Srv->Log(DEFAULT,std::string("m_filter: read configuration from ")+filterfile); } @@ -172,7 +173,8 @@ class ModuleFilter : public Module { // bail if the user forgot to create a config file printf("Error, could not find <filter file=\"\"> definition in your config file!"); - exit(0); + log(DEFAULT,"Error, could not find <filter file=\"\"> definition in your config file!"); + return; } Srv->Log(DEFAULT,std::string("m_filter: read configuration from ")+filterfile); } diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 378f6e5ce..1e37e1fb9 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -48,9 +48,9 @@ class ModuleGlobops : public Module { Srv->Log(DEFAULT,"*** m_globops: ERROR, failed to allocate user mode +g!"); printf("Could not claim usermode +g for this module!"); - exit(0); + return; } - Srv->AddCommand("GLOBOPS",handle_globops,'o',1,"m_globops.so"); + else Srv->AddCommand("GLOBOPS",handle_globops,'o',1,"m_globops.so"); } virtual ~ModuleGlobops() diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index efe4f513d..7287204bb 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -141,8 +141,8 @@ class ModuleHelpop : public Module h_file = conf->ReadValue("helpop", "file", 0); if (h_file == "") { - printf("m_helpop: Helpop file not Specified."); - exit(0); + log(DEFAULT,"m_helpop: Helpop file not Specified."); + return; } helpop = new ConfigReader(h_file); @@ -151,15 +151,14 @@ class ModuleHelpop : public Module (helpop->ReadValue("nohelpo", "line1", 0) == "") || (helpop->ReadValue("start", "line1", 0) == "")) { - printf("m_helpop: Helpop file is missing important entries. Please check the example conf."); - exit(0); + log(DEFAULT,"m_helpop: Helpop file is missing important entries. Please check the example conf."); + return; } if (!Srv->AddExtendedMode('h',MT_CLIENT,true,0,0)) { Srv->Log(DEFAULT,"Unable to claim the +h usermode."); - printf("m_helpop: Unable to claim the +h usermode!"); - exit(0); + return; } // Loads of comments, untill supported properly. diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index eda4de2bc..98160bda0 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -21,14 +21,12 @@ #include "channels.h" #include "modules.h" -Server *Srv; -FileReader *quotes; - -std::string q_file; -std::string prefix; -std::string suffix; - +Server *Srv = NULL; +FileReader *quotes = NULL; +std::string q_file = ""; +std::string prefix = ""; +std::string suffix = ""; /* $ModDesc: Provides random Quotes on Connect. */ @@ -37,12 +35,13 @@ void handle_randquote(char** parameters, int pcntl, userrec *user) std::string str; int fsize; char buf[MAXBUF]; - - fsize = quotes->FileSize(); - str = quotes->GetLine(rand() % fsize); - - sprintf(buf,"NOTICE %s :%s%s%s",user->nick,prefix.c_str(),str.c_str(),suffix.c_str()); - Srv->SendServ(user->fd, buf); + if (quotes) + { + fsize = quotes->FileSize(); + str = quotes->GetLine(rand() % fsize); + sprintf(buf,"NOTICE %s :%s%s%s",user->nick,prefix.c_str(),str.c_str(),suffix.c_str()); + Srv->SendServ(user->fd, buf); + } return; } @@ -62,25 +61,23 @@ class ModuleRandQuote : public Module // Sort the Randomizer thingie.. srand(time(NULL)); - q_file = conf->ReadValue("randquote","file",0); prefix = conf->ReadValue("randquote","prefix",0); suffix = conf->ReadValue("randquote","suffix",0); if (q_file == "") { - printf("m_randquote: Quotefile not specified.. Please check your config.\n\n"); - exit(0); + log(DEFAULT,"m_randquote: Quotefile not specified - Please check your config."); + return; } - quotes = new FileReader(q_file); if(!quotes->Exists()) { - printf("m_randquote: QuoteFile not Found!! Please check your config.\n\n"); - exit(0); + log(DEFAULT,"m_randquote: QuoteFile not Found!! Please check your config - module will not function."); + return; } /* Hidden Command -- Mode clients assume /quote sends raw data to an IRCd >:D */ - Srv->AddCommand("QUOTE",handle_randquote,0,0,"m_randquote.so"); + else Srv->AddCommand("QUOTE",handle_randquote,0,0,"m_randquote.so"); } virtual ~ModuleRandQuote() |