diff options
Diffstat (limited to 'src/modules')
48 files changed, 98 insertions, 101 deletions
diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 84dd8fa43..7fd68ab75 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -227,7 +227,7 @@ class ModuleSQLLog : public Module return 0; } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { if ((command == "GLINE") || (command == "KLINE") || (command == "ELINE") || (command == "ZLINE")) { diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index f39be098c..acbdef60a 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -82,7 +82,7 @@ class ModuleSQLOper : public Module List[I_OnRehash] = List[I_OnPreCommand] = 1; } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { if ((command == "OPER") && (validated)) { diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index d218777af..869bc6a1f 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -87,7 +87,7 @@ class ModuleAlias : public Module return Version(1,0,0,1,VF_VENDOR); } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { userrec *u = NULL; irc::string c = command.c_str(); @@ -137,9 +137,9 @@ class ModuleAlias : public Module stuff >> cmd; stuff >> target; - char* para[2]; - para[0] = (char*)target.c_str(); - para[1] = (char*)n.c_str(); + const char* para[2]; + para[0] = target.c_str(); + para[1] = n.c_str(); Srv->CallCommandHandler(cmd,para,2,user); return 1; diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 24b3deb85..0ddaddd34 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -94,7 +94,7 @@ public: DELETE(Conf); } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { // Don't do anything with unregistered users, or remote ones. if(!user || (user->registered != 7) || !IS_LOCAL(user)) @@ -117,7 +117,7 @@ public: if(*parameters[0] != '#') targets--; - for(char* c = parameters[0]; *c; c++) + for(const char* c = parameters[0]; *c; c++) if((*c == ',') && *(c+1) && (*(c+1) == '#')) targets++; diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 10e71df7b..57bb9490a 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -68,7 +68,7 @@ class cmd_cban : public command_t this->Srv = Me; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { /* syntax: CBAN #channel time :reason goes here */ /* 'time' is a human-readable timestring, like 2d3h2s. */ diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 5e7b4847c..7f5dc793d 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -39,7 +39,7 @@ class cmd_check : public command_t this->source = "m_check.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec *targuser; chanrec *targchan; diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 1a547f548..8113cc19d 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -35,9 +35,9 @@ class cmd_chghost : public command_t this->source = "m_chghost.so"; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { - char * x = parameters[1]; + const char * x = parameters[1]; for (; *x; x++) { diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 1f7c28dda..f2c48cb52 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -16,7 +16,7 @@ class cmd_chgident : public command_t Srv = serv; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 99898259a..ab13708ea 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -432,7 +432,7 @@ class ModuleCloaking : public Module // SAMODE in unreal. Note that to the user it will appear as if they set // the mode on themselves. - char* modes[2]; // only two parameters + const char* modes[2]; // only two parameters modes[0] = user->nick; // first parameter is the nick modes[1] = "+x"; // second parameter is the mode Srv->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +x" diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 353bd763f..a97fe8d3f 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -76,7 +76,7 @@ class ModuleWaitPong : public Module user->Extend("waitpong_pingstr", pingrpl); } - virtual int OnPreCommand(const std::string &command, char** parameters, int pcnt, userrec* user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec* user, bool validated) { if(command == "PONG") { diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 12257d520..214de5783 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -38,7 +38,7 @@ class cmd_devoice : public command_t this->source = "m_devoice.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { /* * NOTE: DO NOT CODE LIKE THIS!!! This has no checks and can send @@ -46,7 +46,7 @@ class cmd_devoice : public command_t * * - I'm not aware what checking I need, so for now... be supreme evil. */ - char* modes[3]; + const char* modes[3]; modes[0] = parameters[0]; modes[1] = "-v"; modes[2] = user->nick; diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 1cb14ba83..229a77256 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -35,7 +35,7 @@ class cmd_gloadmodule : public command_t this->source = "m_globalload.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { if (ServerInstance->LoadModule(parameters[0])) { @@ -57,7 +57,7 @@ class cmd_gunloadmodule : public command_t this->source = "m_globalload.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { if (ServerInstance->UnloadModule(parameters[0])) { diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index add0306a7..6d00d5889 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -37,7 +37,7 @@ class cmd_globops : public command_t this->source = "m_globops.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { std::string line = "*** GLOBOPS - From " + std::string(user->nick) + ": "; for (int i = 0; i < pcnt; i++) diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 9c21201d8..c1457765d 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -25,8 +25,8 @@ using namespace std; static ConfigReader *helpop; static Server *Srv; -bool do_helpop(char**, int, userrec*); -void sendtohelpop(userrec*, int, char**); +bool do_helpop(const char**, int, userrec*); +void sendtohelpop(userrec*, int, const char**); /* $ModDesc: /helpop Command, Works like Unreal helpop */ @@ -66,7 +66,7 @@ class cmd_helpop : public command_t this->source = "m_helpop.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { char a[MAXBUF]; std::string output = " "; @@ -80,12 +80,12 @@ class cmd_helpop : public command_t return; } - if (parameters[0][0] == '!') + if (*parameters[0] == '!') { // Force send to all +h users sendtohelpop(user, pcnt, parameters); } - else if (parameters[0][0] == '?') + else if (*parameters[0] == '?') { // Force to the helpop system with no forward if not found. if (do_helpop(parameters, pcnt, user) == false) @@ -127,25 +127,22 @@ class cmd_helpop : public command_t }; -bool do_helpop(char **parameters, int pcnt, userrec *src) +bool do_helpop(const char** parameters, int pcnt, userrec *src) { - char *search; + char search[MAXBUF]; std::string output = " "; // a fix bought to you by brain :p char a[MAXBUF]; int nlines = 0; if (!pcnt) { - search = "start"; + strcpy(search,"start"); } else { - search = parameters[0]; - } - - if (search[0] == '?') - { - search++; + if (*parameters[0] == '?') + parameters[0]++; + strlcpy(search,parameters[0],MAXBUF); } strlower(search); @@ -165,9 +162,9 @@ bool do_helpop(char **parameters, int pcnt, userrec *src) -void sendtohelpop(userrec *src, int pcnt, char **params) +void sendtohelpop(userrec *src, int pcnt, const char **params) { - char* first = params[0]; + const char* first = params[0]; if (*first == '!') { first++; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 8b2b74dba..b4e535d9b 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -35,7 +35,7 @@ class cmd_knock : public command_t this->source = "m_knock.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { chanrec* c = Srv->FindChannel(parameters[0]); diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 8f310f4b2..52fed00f0 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -195,12 +195,12 @@ class ModuleMsgFlood : public Module f->clear(user); if (f->ban) { - char* parameters[3]; + const char* parameters[3]; parameters[0] = dest->name; parameters[1] = "+b"; parameters[2] = user->MakeWildHost(); Srv->SendMode(parameters,3,user); - std::deque<std::string> n; + std::deque<std::string> n; /* Propogate the ban to other servers. * We dont know what protocol we may be using, * so this event is picked up by our protocol diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 47c15e792..df8a551dd 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -37,7 +37,7 @@ class cmd_nicklock : public command_t this->source = "m_nicklock.so"; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { userrec* source = Srv->FindNick(std::string(parameters[0])); irc::string server; @@ -72,7 +72,7 @@ class cmd_nickunlock : public command_t this->source = "m_nickunlock.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* source = Srv->FindNick(std::string(parameters[0])); if (source) diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 559b01285..8188c49b1 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -49,7 +49,7 @@ class ModuleOperLog : public Module List[I_OnPreCommand] = List[I_On005Numeric] = 1; } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index 8a5e4b3c7..4116ccb37 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -276,7 +276,7 @@ class cmd_mkpasswd : public command_t this->source = "m_opermd5.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { char buffer[MAXBUF]; GenHash(parameters[0],buffer); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 4cf360e2a..1181a32c3 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -76,9 +76,9 @@ class ModuleModesOnOper : public Module ThisOpersModes = "+" + ThisOpersModes; if (ThisOpersModes != "") { - char* modes[2]; + const char* modes[2]; modes[0] = user->nick; - modes[1] = (char*)ThisOpersModes.c_str(); + modes[1] = ThisOpersModes.c_str(); Srv->SendMode(modes,2,user); } break; diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 5f9dafa65..b4a85e889 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -51,7 +51,7 @@ class cmd_opermotd : public command_t this->source = "m_opermotd.so"; } - void Handle (char** parameters, int pcnt, userrec* user) + void Handle (const char** parameters, int pcnt, userrec* user) { ShowOperMOTD(user); } diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp index 0a18c32af..ecade64ad 100644 --- a/src/modules/m_opersha256.cpp +++ b/src/modules/m_opersha256.cpp @@ -232,7 +232,7 @@ public: this->source = "m_opersha256.so"; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { char buffer[SHA256_BLOCK_SIZE + 1]; SHA256(parameters[0], buffer, strlen(parameters[0])); diff --git a/src/modules/m_operwho.cpp b/src/modules/m_operwho.cpp index 9370ad765..edb0aea4d 100644 --- a/src/modules/m_operwho.cpp +++ b/src/modules/m_operwho.cpp @@ -41,7 +41,7 @@ class ModuleOperWho : public Module List[I_OnPreCommand] = 1; } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { if ((!*user->oper) || (command != "WHO")) diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index c57102287..782cf2f3b 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -63,7 +63,7 @@ class cmd_park : public command_t this->source = "m_park.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { /** Parking. easy stuff. * @@ -108,7 +108,7 @@ class cmd_parkstats : public command_t this->source = "m_park.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { char status[MAXBUF]; snprintf(status,MAXBUF,"NOTICE %s :There are a total of %lu parked clients on this server, with a maximum of %lu parked sessions allowed per user.",user->nick,(unsigned long)pinfo.size(),(unsigned long)ConcurrentParks); @@ -124,7 +124,7 @@ class cmd_unpark : public command_t this->source = "m_park.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { /** Unparking. complicated stuff. * diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 64c967ae8..12049b376 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -41,7 +41,7 @@ class cmd_randquote : public command_t this->source = "m_randquote.so"; } - void Handle (char** parameters, int pcntl, userrec *user) + void Handle (const char** parameters, int pcntl, userrec *user) { std::string str; int fsize; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index d865066b3..59c1fcda2 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -55,7 +55,7 @@ class cmd_remove : public command_t this->source = "m_remove.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* target; chanrec* channel; diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index a95198a5e..148040c6c 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -166,7 +166,7 @@ class ModuleSafeList : public Module * OnPreCommand() * Intercept the LIST command. */ - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) @@ -183,7 +183,7 @@ class ModuleSafeList : public Module * HandleList() * Handle (override) the LIST command. */ - int HandleList(char** parameters, int pcnt, userrec* user) + int HandleList(const char** parameters, int pcnt, userrec* user) { /* First, let's check if the user is currently /list'ing */ ListData *ld; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 2c9273e70..39a95a27c 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -35,7 +35,7 @@ class cmd_sajoin : public command_t this->source = "m_sajoin.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 280a5ae19..905eed0c8 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -46,7 +46,7 @@ class cmd_samode : public command_t this->source = "m_samode.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { /* * Handles an SAMODE request. Notifies all +s users. diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 5d449d7e0..6c07d08ce 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -34,7 +34,7 @@ class cmd_sanick : public command_t this->source = "m_sanick.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* source = Srv->FindNick(std::string(parameters[0])); if (source) diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 9203b7d36..afbdbdc87 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -35,7 +35,7 @@ class cmd_sapart : public command_t this->source = "m_sapart.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 8174d5a64..d43b97102 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -44,7 +44,7 @@ class cmd_saquit : public command_t this->source = "m_saquit.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index fab32c2b4..97f84f5c7 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -55,7 +55,7 @@ class ModuleSecureList : public Module * OnPreCommand() * Intercept the LIST command. */ - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index a0223f971..f27e74a4d 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -210,7 +210,7 @@ class ModuleServices : public Module /* On nickchange, if they have +r, remove it */ if (user->IsModeSet('r')) { - char* modechange[2]; + const char* modechange[2]; modechange[0] = user->nick; modechange[1] = "-r"; kludgeme = true; diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 7244ba6de..eb2196c92 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -35,7 +35,7 @@ class cmd_sethost : public command_t this->source = "m_sethost.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { if (strlen(parameters[0]) > 64) { diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 4ec8e0fdb..12221edb0 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -14,7 +14,7 @@ class cmd_setident : public command_t this->source = "m_setident.so"; } - void Handle(char **parameters, int pcnt, userrec *user) + void Handle(const char** parameters, int pcnt, userrec *user) { for(unsigned int x = 0; x < strlen(parameters[0]); x++) { diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index af0bc2c64..040625238 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -35,7 +35,7 @@ class cmd_setidle : public command_t this->source = "m_setidle.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { if (atoi(parameters[0]) < 1) { diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index b82f6de14..9a3b2a942 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -35,7 +35,7 @@ class cmd_setname : public command_t this->source = "m_setname.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { std::string line = ""; for (int i = 0; i < pcnt-1; i++) diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 9cf2912f7..39b810dfe 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -41,7 +41,7 @@ class cmd_silence : public command_t this->source = "m_silence.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { if (!pcnt) { @@ -62,7 +62,7 @@ class cmd_silence : public command_t else if (pcnt > 0) { // one or more parameters, add or delete entry from the list (only the first parameter is used) - char *nick = parameters[0]; + const char *nick = parameters[0]; if (nick[0] == '-') { // removing an item from the list diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 5222d8f18..22c9e9246 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -555,9 +555,9 @@ class cmd_rconnect : public command_t cmd_rconnect (Module* Callback) : command_t("RCONNECT", 'o', 2), Creator(Callback) { this->source = "m_spanningtree.so"; - } + } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { WriteServ(user->fd,"NOTICE %s :*** RCONNECT: Sending remote connect to \002%s\002 to connect server \002%s\002.",user->nick,parameters[0],parameters[1]); /* Is this aimed at our server? */ @@ -565,7 +565,7 @@ class cmd_rconnect : public command_t { /* Yes, initiate the given connect */ WriteOpers("*** Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002",user->nick,parameters[0],parameters[1]); - char* para[1]; + const char* para[1]; para[0] = parameters[1]; Creator->OnPreCommand("CONNECT", para, 1, user, true); } @@ -888,7 +888,7 @@ class TreeSocket : public InspSocket return true; userrec* who = new userrec(); who->fd = FD_MAGIC_NUMBER; - char* modelist[64]; + const char* modelist[64]; memset(&modelist,0,sizeof(modelist)); for (unsigned int q = 0; q < params.size(); q++) { @@ -956,7 +956,7 @@ class TreeSocket : public InspSocket memset(&mode_users,0,sizeof(mode_users)); mode_users[0] = first; mode_users[1] = modestring; - strcpy(mode_users[1],"+"); + strcpy(first,"+"); unsigned int modectr = 2; userrec* who = NULL; @@ -991,7 +991,7 @@ class TreeSocket : public InspSocket for (unsigned int usernum = 2; usernum < params.size(); usernum++) { /* process one channel at a time, applying modes. */ - char* usr = const_cast<char*>(params[usernum].c_str()); + char* usr = (char*)params[usernum].c_str(); /* Safety check just to make sure someones not sent us an FJOIN full of spaces * (is this even possible?) */ if (usr && *usr) @@ -1028,7 +1028,7 @@ class TreeSocket : public InspSocket { /* We also always let u-lined clients win, no matter what the TS value */ log(DEBUG,"Our our channel newer than theirs, accepting their modes"); - Srv->SendMode(mode_users,modectr,who); + Srv->SendMode((const char**)mode_users,modectr,who); } else { @@ -1058,7 +1058,7 @@ class TreeSocket : public InspSocket if (ourTS >= TS) { log(DEBUG,"Our our channel newer than theirs, accepting their modes"); - Srv->SendMode(mode_users,modectr,who); + Srv->SendMode((const char**)mode_users,modectr,who); } else { @@ -2555,10 +2555,10 @@ class TreeSocket : public InspSocket } // its a user target = who->server; - char* strparams[127]; + const char* strparams[127]; for (unsigned int q = 0; q < params.size(); q++) { - strparams[q] = (char*)params[q].c_str(); + strparams[q] = params[q].c_str(); } if (!Srv->CallCommandHandler(command.c_str(), strparams, params.size(), who)) { @@ -2970,14 +2970,14 @@ class ModuleSpanningTree : public Module return serverlist.size(); } - void HandleLinks(char** parameters, int pcnt, userrec* user) + void HandleLinks(const char** parameters, int pcnt, userrec* user) { ShowLinks(TreeRoot,user,0); WriteServ(user->fd,"365 %s * :End of /LINKS list.",user->nick); return; } - void HandleLusers(char** parameters, int pcnt, userrec* user) + void HandleLusers(const char** parameters, int pcnt, userrec* user) { unsigned int n_users = usercnt(); @@ -3062,7 +3062,7 @@ class ModuleSpanningTree : public Module // (a character matrix), then draw the branches as a series of "L" shapes // from the nodes. This is not only friendlier on CPU it uses less stack. - void HandleMap(char** parameters, int pcnt, userrec* user) + void HandleMap(const char** parameters, int pcnt, userrec* user) { // This array represents a virtual screen which we will // "scratch" draw to, as the console device of an irc @@ -3118,7 +3118,7 @@ class ModuleSpanningTree : public Module return; } - int HandleSquit(char** parameters, int pcnt, userrec* user) + int HandleSquit(const char** parameters, int pcnt, userrec* user) { TreeServer* s = FindServerMask(parameters[0]); if (s) @@ -3148,7 +3148,7 @@ class ModuleSpanningTree : public Module return 1; } - int HandleTime(char** parameters, int pcnt, userrec* user) + int HandleTime(const char** parameters, int pcnt, userrec* user) { if ((user->fd > -1) && (pcnt)) { @@ -3172,7 +3172,7 @@ class ModuleSpanningTree : public Module return 1; } - int HandleRemoteWhois(char** parameters, int pcnt, userrec* user) + int HandleRemoteWhois(const char** parameters, int pcnt, userrec* user) { if ((user->fd > -1) && (pcnt > 1)) { @@ -3250,7 +3250,7 @@ class ModuleSpanningTree : public Module } } - int HandleVersion(char** parameters, int pcnt, userrec* user) + int HandleVersion(const char** parameters, int pcnt, userrec* user) { // we've already checked if pcnt > 0, so this is safe TreeServer* found = FindServerMask(parameters[0]); @@ -3287,7 +3287,7 @@ class ModuleSpanningTree : public Module return 1; } - int HandleConnect(char** parameters, int pcnt, userrec* user) + int HandleConnect(const char** parameters, int pcnt, userrec* user) { for (std::vector<Link>::iterator x = LinkBlocks.begin(); x < LinkBlocks.end(); x++) { @@ -3336,7 +3336,7 @@ class ModuleSpanningTree : public Module return 0; } - virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 625b5c971..e69db8ed5 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -92,7 +92,7 @@ class cmd_spylist : public command_t this->source = "m_spy.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { WriteOpers("*** Oper %s used SPYLIST to list +s/+p channels and keys.",user->nick); WriteServ(user->fd,"321 %s Channel :Users Name",user->nick); @@ -112,7 +112,7 @@ class cmd_spynames : public command_t this->source = "m_spy.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { chanrec* c; diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 2b7e58413..41248832d 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -31,7 +31,7 @@ class cmd_swhois : public command_t this->source = "m_swhois.so"; } - void Handle(char** parameters, int pcnt, userrec* user) + void Handle(const char** parameters, int pcnt, userrec* user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); if(dest) diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index 881024cc7..1f8aaac1a 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -51,7 +51,7 @@ class cmd_woot : public command_t this->source = "m_testcommand.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { /* We dont have to worry about deleting 'r', the core will * do it for us as required.*/ diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index da0c0faeb..2f4f040c0 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -47,7 +47,7 @@ class cmd_tban : public command_t this->source = "m_timedbans.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { chanrec* channel = Srv->FindChannel(parameters[0]); if (channel) @@ -83,7 +83,7 @@ class cmd_tban : public command_t char duration[MAXBUF]; snprintf(duration,MAXBUF,"%lu",Srv->CalcDuration(parameters[1])); std::string mask = parameters[2]; - char *setban[32]; + const char *setban[32]; setban[0] = parameters[0]; setban[1] = "+b"; setban[2] = parameters[2]; @@ -157,10 +157,10 @@ class ModuleTimedBans : public Module if (cr) { Srv->SendChannelServerNotice(Srv->GetServerName(),cr,"NOTICE "+std::string(cr->name)+" :Timed ban on "+i->mask+" expired."); - char *setban[3]; - setban[0] = (char*)i->channel.c_str(); + const char *setban[3]; + setban[0] = i->channel.c_str(); setban[1] = "-b"; - setban[2] = (char*)i->mask.c_str(); + setban[2] = i->mask.c_str(); // kludge alert! // ::SendMode expects a userrec* to send the numeric replies // back to, so we create it a fake user that isnt in the user diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 14660cf1e..c8332319f 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -35,7 +35,7 @@ class cmd_uninvite : public command_t this->source = "m_uninvite.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* u = Find(parameters[0]); chanrec* c = FindChan(parameters[1]); diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 55101705e..0b62df0a1 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -35,7 +35,7 @@ class cmd_userip : public command_t this->source = "m_userip.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { char Return[MAXBUF],junk[MAXBUF]; snprintf(Return,MAXBUF,"340 %s :",user->nick); diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 270d7aa0b..61d07a7e2 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -35,7 +35,7 @@ class cmd_vhost : public command_t this->source = "m_vhost.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { for (int index = 0; index < Conf->Enumerate("vhost"); index++) { diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index faf0792dc..c15609a4d 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -47,7 +47,7 @@ class cmd_watch : public command_t this->source = "m_watch.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { if (!pcnt) { @@ -68,7 +68,7 @@ class cmd_watch : public command_t { for (int x = 0; x < pcnt; x++) { - char *nick = parameters[x]; + const char *nick = parameters[x]; if (!strcasecmp(nick,"C")) { // watch clear |