diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-04 23:28:57 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-04 23:28:57 +0000 |
commit | c2d1f2cdafb0a38446844f6bd3d683e8636e37b4 (patch) | |
tree | a9427eff9698f3b4921018de660c70b5ed40bba5 /src | |
parent | 222e912fc3e4a09bba3d9aeef815b6c364c5c71c (diff) |
Convert a whole bunch more
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9620 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_banredirect.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_blockamsg.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_callerid.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_cap.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_cban.cpp | 20 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_chanprotect.cpp | 6 |
7 files changed, 32 insertions, 31 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 3e61e198e..4313039aa 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -222,7 +222,7 @@ class ModuleBanRedirect : public Module { irc::modestacker modestack(false); StringDeque stackresult; - const char* mode_junk[MAXMODES+2]; + std::vector<std::string> mode_junk; mode_junk[0] = chan->name; @@ -241,10 +241,10 @@ class ModuleBanRedirect : public Module { for(StringDeque::size_type i = 0; i < stackresult.size(); i++) { - mode_junk[i+1] = stackresult[i].c_str(); + mode_junk[i+1] = stackresult[i]; } - ServerInstance->SendMode(mode_junk, stackresult.size() + 1, ServerInstance->FakeClient); + ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient); } delete redirects; diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index e4a4eaf4e..17aad007f 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -84,7 +84,7 @@ class ModuleBlockAmsg : public Module action = IBLOCK_KILLOPERS; } - 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) { // Don't do anything with unregistered users, or remote ones. if(!user || (user->registered != REG_ALL) || !IS_LOCAL(user)) @@ -94,7 +94,7 @@ class ModuleBlockAmsg : public Module // Add std::string contructor for irc::string :x irc::string cmd = command.c_str(); - if(validated && (cmd == "PRIVMSG" || cmd == "NOTICE") && (pcnt >= 2)) + if(validated && (cmd == "PRIVMSG" || cmd == "NOTICE") && (parameters.size() >= 2)) { // parameters[0] should have the target(s) in it. // I think it will be faster to first check if there are any commas, and if there are then try and parse it out. @@ -103,13 +103,13 @@ class ModuleBlockAmsg : public Module int targets = 1; int userchans = 0; - if(*parameters[0] != '#') + if(*parameters[0].c_str() != '#') { // Decrement if the first target wasn't a channel. targets--; } - for(const char* c = parameters[0]; *c; c++) + for(const char* c = parameters[0].c_str(); *c; c++) if((*c == ',') && *(c+1) && (*(c+1) == '#')) targets++; @@ -151,12 +151,12 @@ class ModuleBlockAmsg : public Module { // If there's already a BlockedMessage allocated, use it. m->message = parameters[1]; - m->target = parameters[0]; + m->target = parameters[0].c_str(); m->sent = ServerInstance->Time(); } else { - m = new BlockedMessage(parameters[1], parameters[0], ServerInstance->Time()); + m = new BlockedMessage(parameters[1], parameters[0].c_str(), ServerInstance->Time()); user->Extend("amsgblock", (char*)m); } } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index a33b493b1..2a349fdb0 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -83,9 +83,10 @@ public: * /accept nick1,nick2,nick3 * * to add 3 nicks and then show your list */ - CmdResult Handle(const char* const* parameters, int pcnt, User* user) + + CmdResult Handle(const std::vector<std::string> ¶meters, User* user) { - if (pcnt < 1) + if (parameters.size() < 1) { /* Command stuff should've dealt with this already */ return CMD_FAILURE; @@ -93,9 +94,9 @@ public: /* Even if callerid mode is not set, we let them manage their ACCEPT list so that if they go +g they can * have a list already setup. */ bool atleastonechange = false; - for (int i = 0; i < pcnt; ++i) + for (int i = 0; i < (int)parameters.size(); ++i) { - const char* arg = parameters[i]; + const char* arg = parameters[i].c_str(); irc::commasepstream css(arg); std::string tok; while (css.GetToken(tok)) diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 63d1d685f..986e40713 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -41,9 +41,9 @@ class CommandCAP : public Command this->source = "m_cap.so"; } - CmdResult Handle (const char* const* parameters, int pcnt, User *user) + CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { - irc::string subcommand = parameters[0]; + irc::string subcommand = parameters[0].c_str(); if (subcommand == "REQ") { @@ -53,7 +53,7 @@ class CommandCAP : public Command Data.user = user; Data.creator = this->Creator; - if (pcnt < 2) + if (parameters.size() < 2) return CMD_FAILURE; // tokenize the input into a nice list of requested caps diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 10948caf7..94d99c374 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -88,25 +88,25 @@ class CommandCBan : public Command TRANSLATE4(TR_TEXT,TR_TEXT,TR_TEXT,TR_END); } - CmdResult Handle(const char* const* parameters, int pcnt, User *user) + CmdResult Handle(const std::vector<std::string> ¶meters, User *user) { /* syntax: CBAN #channel time :reason goes here */ /* 'time' is a human-readable timestring, like 2d3h2s. */ - if(pcnt == 1) + if (parameters.size() == 1) { - if (ServerInstance->XLines->DelLine(parameters[0], "CBAN", user)) + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "CBAN", user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s Removed CBan on %s.",user->nick,parameters[0]); + ServerInstance->SNO->WriteToSnoMask('x',"%s Removed CBan on %s.",user->nick,parameters[0].c_str()); } else { - user->WriteServ("NOTICE %s :*** CBan %s not found in list, try /stats C.",user->nick,parameters[0]); + user->WriteServ("NOTICE %s :*** CBan %s not found in list, try /stats C.",user->nick,parameters[0].c_str()); } return CMD_SUCCESS; } - else if (pcnt >= 2) + else if (parameters.size() >= 2) { // Adding - XXX todo make this respect <insane> tag perhaps.. long duration = ServerInstance->Duration(parameters[1]); @@ -114,7 +114,7 @@ class CommandCBan : public Command try { - r = new CBan(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]); + r = new CBan(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), parameters[0].c_str()); } catch (...) { @@ -127,12 +127,12 @@ class CommandCBan : public Command { if (!duration) { - ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent CBan for %s.", user->nick, parameters[0]); + ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent CBan for %s.", user->nick, parameters[0].c_str()); } else { time_t c_requires_crap = duration + ServerInstance->Time(); - ServerInstance->SNO->WriteToSnoMask('x', "%s added timed CBan for %s, expires on %s", user->nick, parameters[0], + ServerInstance->SNO->WriteToSnoMask('x', "%s added timed CBan for %s, expires on %s", user->nick, parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str()); } @@ -141,7 +141,7 @@ class CommandCBan : public Command else { delete r; - user->WriteServ("NOTICE %s :*** CBan for %s already exists", user->nick, parameters[0]); + user->WriteServ("NOTICE %s :*** CBan for %s already exists", user->nick, parameters[0].c_str()); } } } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 4140f1386..51f74f31b 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -61,7 +61,7 @@ class CommandWebirc : public Command this->source = "m_cgiirc.so"; this->syntax = "password client hostname ip"; } - CmdResult Handle(const char* const* parameters, int pcnt, User *user) + CmdResult Handle(const std::vector<std::string> ¶meters, User *user) { if(user->registered == REG_ALL) return CMD_FAILURE; @@ -75,7 +75,7 @@ class CommandWebirc : public Command user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); if (notify) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick, user->host, parameters[2], user->host); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick, user->host, parameters[2].c_str(), user->host); user->Extend("cgiirc_webirc_hostname", new std::string(parameters[2])); user->Extend("cgiirc_webirc_ip", new std::string(parameters[3])); return CMD_LOCALONLY; diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index b15cd0d9f..07b491bb7 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -66,7 +66,7 @@ class FounderProtectBase { CUList* cl = channel->GetUsers(); std::string item = extend + std::string(channel->name); - const char* mode_junk[MAXMODES+2]; + std::vector<std::string> mode_junk; mode_junk[0] = channel->name; irc::modestacker modestack(false); std::deque<std::string> stackresult; @@ -89,9 +89,9 @@ class FounderProtectBase { for (size_t j = 0; j < stackresult.size(); j++) { - mode_junk[j+1] = stackresult[j].c_str(); + mode_junk[j+1] = stackresult[j]; } - MyInstance->SendMode(mode_junk, stackresult.size() + 1, MyInstance->FakeClient); + MyInstance->SendMode(mode_junk, MyInstance->FakeClient); } } |