diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_check.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_chghost.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_chgident.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_chgname.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_clones.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_close.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_umodes.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_conn_waitpong.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_customtitle.cpp | 6 |
9 files changed, 32 insertions, 34 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 88644f61a..36880d5ed 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -27,7 +27,7 @@ class CommandCheck : public Command syntax = "<nickname>|<ip>|<hostmask>|<channel>"; } - CmdResult Handle (const char* const* parameters, int pcnt, User *user) + CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { User *targuser; Channel *targchan; @@ -131,13 +131,13 @@ class CommandCheck : public Command /* hostname or other */ for (user_hash::const_iterator a = ServerInstance->Users->clientlist->begin(); a != ServerInstance->Users->clientlist->end(); a++) { - if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0])) + if (match(a->second->host, parameters[0].c_str()) || match(a->second->dhost, parameters[0].c_str())) { /* host or vhost matches mask */ user->WriteServ(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost()); } /* IP address */ - else if (match(a->second->GetIPString(), parameters[0], true)) + else if (match(a->second->GetIPString(), parameters[0].c_str(), true)) { /* same IP. */ user->WriteServ(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost()); diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index e067bd78b..c327d27b3 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -29,9 +29,9 @@ class CommandChghost : public Command TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - CmdResult Handle(const char* const* parameters, int pcnt, User *user) + CmdResult Handle(const std::vector<std::string> ¶meters, User *user) { - const char * x = parameters[1]; + const char * x = parameters[1].c_str(); for (; *x; x++) { @@ -41,13 +41,13 @@ class CommandChghost : public Command return CMD_FAILURE; } } - if (!*parameters[0]) + if (parameters[0].empty()) { user->WriteServ("NOTICE %s :*** CHGHOST: Host must be specified", user->nick); return CMD_FAILURE; } - if ((parameters[1] - x) > 63) + if ((parameters[1].c_str() - x) > 63) { user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick); return CMD_FAILURE; @@ -56,11 +56,11 @@ class CommandChghost : public Command if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0].c_str()); return CMD_FAILURE; } - if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->ULine(user->server))) + if ((dest->ChangeDisplayedHost(parameters[1].c_str())) && (!ServerInstance->ULine(user->server))) { // fix by brain - ulines set hosts silently ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->dhost); diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 74ccc49ba..3a39c2f13 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -27,35 +27,35 @@ class CommandChgident : public Command TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - CmdResult Handle(const char* const* parameters, int pcnt, User *user) + CmdResult Handle(const std::vector<std::string> ¶meters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0].c_str()); return CMD_FAILURE; } - if (!*parameters[1]) + if (parameters[1].empty()) { user->WriteServ("NOTICE %s :*** CHGIDENT: Ident must be specified", user->nick); return CMD_FAILURE; } - if (strlen(parameters[1]) > IDENTMAX - 1) + if (parameters[1].length() > IDENTMAX - 1) { user->WriteServ("NOTICE %s :*** CHGIDENT: Ident is too long", user->nick); return CMD_FAILURE; } - if (!ServerInstance->IsIdent(parameters[1])) + if (!ServerInstance->IsIdent(parameters[1].c_str())) { user->WriteServ("NOTICE %s :*** CHGIDENT: Invalid characters in ident", user->nick); return CMD_FAILURE; } - dest->ChangeIdent(parameters[1]); + dest->ChangeIdent(parameters[1].c_str()); if (!ServerInstance->ULine(user->server)) ServerInstance->SNO->WriteToSnoMask('A', "%s used CHGIDENT to change %s's ident to '%s'", user->nick, dest->nick, dest->ident); diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index b58150692..a8a852820 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -27,23 +27,23 @@ class CommandChgname : public Command TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } - CmdResult Handle(const char* const* parameters, int pcnt, User *user) + CmdResult Handle(const std::vector<std::string> ¶meters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0].c_str()); return CMD_FAILURE; } - if (!*parameters[1]) + if (parameters[1].empty()) { user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick); return CMD_FAILURE; } - if (strlen(parameters[1]) > MAXGECOS) + if (parameters[1].length() > MAXGECOS) { user->WriteServ("NOTICE %s :*** GECOS too long", user->nick); return CMD_FAILURE; @@ -51,7 +51,7 @@ class CommandChgname : public Command if (IS_LOCAL(dest)) { - dest->ChangeName(parameters[1]); + dest->ChangeName(parameters[1].c_str()); ServerInstance->SNO->WriteToSnoMask('A', "%s used CHGNAME to change %s's real name to '%s'", user->nick, dest->nick, dest->fullname); return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */ } diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index eff9ed9af..02f0f3fae 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -27,12 +27,12 @@ class CommandClones : public Command syntax = "<limit>"; } - CmdResult Handle (const char* const* parameters, int pcnt, User *user) + CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { std::string clonesstr = "304 " + std::string(user->nick) + " :CLONES"; - unsigned long limit = atoi(parameters[0]); + unsigned long limit = atoi(parameters[0].c_str()); /* * Syntax of a /clones reply: diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 152ba3c59..fb4b03682 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -24,7 +24,7 @@ class CommandClose : public Command this->source = "m_close.so"; } - CmdResult Handle (const char* const* parameters, int pcnt, User *user) + CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { std::map<std::string,int> closed; diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 15fe8c3f2..ba3d6968d 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -71,10 +71,9 @@ class ModuleModesOnConnect : public Module while (ss >> buf) tokens.push_back(buf); - int size = tokens.size() + 1; - const char** modes = new const char*[size]; + std::vector<std::string> modes; modes[0] = user->nick; - modes[1] = tokens[0].c_str(); + modes[1] = tokens[0]; if (tokens.size() > 1) { @@ -82,13 +81,12 @@ class ModuleModesOnConnect : public Module int i = 2; for (unsigned int k = 1; k < tokens.size(); k++) { - modes[i] = tokens[k].c_str(); + modes[i] = tokens[k]; i++; } } - ServerInstance->Parser->CallHandler("MODE", modes, size, user); - delete [] modes; + ServerInstance->Parser->CallHandler("MODE", modes, user); } break; } diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 41900966c..2373c8163 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -69,7 +69,7 @@ class ModuleWaitPong : public Module return 0; } - virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User* user, bool validated, const std::string &original_line) + virtual int OnPreCommand(const std::string &command, const std::vector<std::string> ¶meters, User* user, bool validated, const std::string &original_line) { if (command == "PONG") { @@ -78,7 +78,7 @@ class ModuleWaitPong : public Module if (pingrpl) { - if (strcmp(pingrpl, parameters[0]) == 0) + if (strcmp(pingrpl, parameters[0].c_str()) == 0) { delete[] pingrpl; user->Shrink(extenstr); diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 5d0e77ffe..1dbcc219e 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -43,7 +43,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) return false; } - CmdResult Handle(const char* const* parameters, int pcnt, User* user) + CmdResult Handle(const std::vector<std::string> ¶meters, User* user) { if (!IS_LOCAL(user)) return CMD_LOCALONLY; @@ -64,7 +64,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) std::string title = Conf.ReadValue("title", "title", "", i); std::string vhost = Conf.ReadValue("title", "vhost", "", i); - if (!strcmp(name.c_str(),parameters[0]) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1], hash.c_str()) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty()) + if (!strcmp(name.c_str(),parameters[0].c_str()) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty()) { std::string* text; user->GetExt("ctitle", text); @@ -95,7 +95,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) if (!ServerInstance->ULine(user->server)) // Ulines also fail TITLEs silently - ServerInstance->SNO->WriteToSnoMask('A', "Failed TITLE attempt by %s!%s@%s using login '%s'",user->nick,user->ident,user->host,parameters[0]); + ServerInstance->SNO->WriteToSnoMask('A', "Failed TITLE attempt by %s!%s@%s using login '%s'",user->nick,user->ident,user->host,parameters[0].c_str()); user->WriteServ("NOTICE %s :Invalid title credentials",user->nick); return CMD_SUCCESS; |