X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_helpop.cpp;h=1a7968b7f1a3451c7df5caa88a974cf11ec99e87;hb=41ad846ec7b60d467e9f125cbfe9ab9af791f3a2;hp=f447a054e8fbfec2a2331a0978a00fda69cc7242;hpb=e909e1a3ca2995bab67d7a64d38ec937265c94fa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index f447a054e..1a7968b7f 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -16,9 +16,18 @@ void sendtohelpop(userrec*, int, char**); void handle_helpop(char **parameters, int pcnt, userrec *user) { char a[MAXBUF]; - std::string output; + std::string output = " "; - if (parameters[0] == "") { do_helpop(NULL,pcnt,user); } + if (pcnt < 1) { + do_helpop(NULL,pcnt,user); + return; + } + + // FIX by brain: make the string lowercase, ConfigReader is + // case sensitive + char* lower = parameters[0]; + for (int t = 0; t < strlen(lower); t++) + lower[t] = tolower(lower[t]); if (parameters[0][0] == '!') { @@ -32,8 +41,9 @@ void handle_helpop(char **parameters, int pcnt, userrec *user) { snprintf(a,MAXBUF,"line%d",i); output = helpop->ReadValue("nohelp", std::string(a), 0); - // Send line to client.. - Srv->SendTo(NULL,user,"290 "+std::string(user->nick)+" :"+output); + if(output != "") { + Srv->SendTo(NULL,user,"290 "+std::string(user->nick)+" :"+output); + } } } } else if (strchr(user->modes,'o')) { @@ -47,8 +57,9 @@ void handle_helpop(char **parameters, int pcnt, userrec *user) { snprintf(a,MAXBUF,"line%d",i); output = helpop->ReadValue("nohelpo", std::string(a), 0); - // Send line to client.. - Srv->SendTo(NULL,user,"290 "+std::string(user->nick)+" :"+output); + if (output != "") { + Srv->SendTo(NULL,user,"290 "+std::string(user->nick)+" :"+output); + } } // Forward. sendtohelpop(user, pcnt, parameters); @@ -59,7 +70,7 @@ void handle_helpop(char **parameters, int pcnt, userrec *user) bool do_helpop(char **parameters, int pcnt, userrec *src) { char *search; - std::string output; + std::string output = " "; // a fix bought to you by brain :p char a[MAXBUF]; if (!parameters) { strcpy(search, "start"); } @@ -80,8 +91,9 @@ bool do_helpop(char **parameters, int pcnt, userrec *src) { snprintf(a,MAXBUF,"line%d",i); output = helpop->ReadValue(std::string(search), std::string(a), 0); - // Send line to client.. - Srv->SendTo(NULL,src,"290 "+std::string(src->nick)+" :"+output); + if (output != "") { + Srv->SendTo(NULL,src,"290 "+std::string(src->nick)+" :"+output); + } } return true; } @@ -115,36 +127,37 @@ class ModuleHelpop : public Module h_file = conf->ReadValue("helpop", "file", 0); if (h_file == "") { - printf("WE ARE AAAAALL GONNA DIEEEEEEEEEEEE!!"); + printf("m_helpop: Helpop file not Specified."); exit(0); } helpop = new ConfigReader(h_file); if (!helpop->Verify()) { - printf("Thats it.. were all dead."); + printf("m_helpop: Invalid Helpop File. Please Ensure it exists and is error free."); exit(0); } - if ((helpop->ReadValue("nohelp", "line1", 0) == "") || + /*if ((helpop->ReadValue("nohelp", "line1", 0) == "") || (helpop->ReadValue("nohelpo", "line1", 0) == "") || (helpop->ReadValue("start", "line1", 0) == "")) { - printf("m_helpop: Important Shit Missing. Please check your file."); + printf("m_helpop: Helpop file is missing important entries. Please check the example conf."); exit(0); - } + }*/ if (!Srv->AddExtendedMode('h',MT_CLIENT,true,0,0)) { - Srv->Log(DEFAULT,"pr0n Found. Send it to Craig@chatspike.net for investigation."); - printf("Could not claim usermode +h for this module!"); + Srv->Log(DEFAULT,"Unable to clame the +h usermode."); + printf("m_helpop: Unable to claim the +h usermode!"); exit(0); } - /*if (!*/Srv->AddCommand("HELPOP",handle_helpop,0,1);/*) + // Loads of comments, untill supported properly. + /*if (!*/Srv->AddCommand("HELPOP",handle_helpop,0,0);/*) { - Srv->Log(DEFAULT,"Someone br0ked it.. not me"); - printf("B0RKED! JUMP SHIP.. AAAAAAAAAAAAAAAAAHHHHHH!"); + Srv->Log(DEFAULT,"Unable to claim the HELPOP command."); + printf("m_helpop: Unable to claim the HELPOP command."); exit(0); }*/ @@ -209,4 +222,3 @@ extern "C" void * init_module( void ) { return new ModuleHelpopFactory; } -