diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-07-25 21:58:20 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-07-25 21:58:20 -0400 |
commit | ae38212c1ce829c783edf971081c90137abb49a0 (patch) | |
tree | 5c652d9cdc38103dec6fa112d57fca882b4e3e44 /modules/core/cs_set.cpp | |
parent | 15d7f0f6fe8bb903275f603f734c13f65f3aa906 (diff) |
Epic commit to replace most of the strings in Anope with a single Anope::string class, plus some other little fixes here and there. If you follow 1.9.x development and are testing things, THIS is one of those things that NEEDS testing.
Diffstat (limited to 'modules/core/cs_set.cpp')
-rw-r--r-- | modules/core/cs_set.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index c9331e6a3..b9acb2a53 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -15,21 +15,22 @@ class CommandCSSet : public Command { - std::map<ci::string, Command *> subcommands; + typedef std::map<Anope::string, Command *, hash_compare_ci_string> subcommand_map; + subcommand_map subcommands; public: - CommandCSSet(const ci::string &cname) : Command(cname, 2, 3) + CommandCSSet(const Anope::string &cname) : Command(cname, 2, 3) { } ~CommandCSSet() { - for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) + for (subcommand_map::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) delete it->second; this->subcommands.clear(); } - CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { if (readonly) { @@ -46,26 +47,26 @@ class CommandCSSet : public Command if (c) { - ci::string cmdparams = cs_findchan(params[0])->name.c_str(); - for (std::vector<ci::string>::const_iterator it = params.begin() + 2, it_end = params.end(); it != it_end; ++it) + Anope::string cmdparams = cs_findchan(params[0])->name; + for (std::vector<Anope::string>::const_iterator it = params.begin() + 2, it_end = params.end(); it != it_end; ++it) cmdparams += " " + *it; mod_run_cmd(ChanServ, u, c, params[1], cmdparams); } else { notice_lang(Config.s_ChanServ, u, CHAN_SET_UNKNOWN_OPTION, params[1].c_str()); - notice_lang(Config.s_ChanServ, u, MORE_INFO, Config.s_ChanServ, "SET"); + notice_lang(Config.s_ChanServ, u, MORE_INFO, Config.s_ChanServ.c_str(), "SET"); } return MOD_CONT; } - bool OnHelp(User *u, const ci::string &subcommand) + bool OnHelp(User *u, const Anope::string &subcommand) { if (subcommand.empty()) { notice_help(Config.s_ChanServ, u, CHAN_HELP_SET_HEAD); - for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) + for (subcommand_map::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) it->second->OnServHelp(u); notice_help(Config.s_ChanServ, u, CHAN_HELP_SET_TAIL); return true; @@ -81,7 +82,7 @@ class CommandCSSet : public Command return false; } - void OnSyntaxError(User *u, const ci::string &subcommand) + void OnSyntaxError(User *u, const Anope::string &subcommand) { syntax_error(Config.s_ChanServ, u, "SET", CHAN_SET_SYNTAX); } @@ -96,14 +97,14 @@ class CommandCSSet : public Command return this->subcommands.insert(std::make_pair(c->name, c)).second; } - bool DelSubcommand(const ci::string &command) + bool DelSubcommand(const Anope::string &command) { return this->subcommands.erase(command); } - Command *FindCommand(const ci::string &subcommand) + Command *FindCommand(const Anope::string &subcommand) { - std::map<ci::string, Command *>::const_iterator it = this->subcommands.find(subcommand); + subcommand_map::const_iterator it = this->subcommands.find(subcommand); if (it != this->subcommands.end()) return it->second; @@ -115,7 +116,7 @@ class CommandCSSet : public Command class CSSet : public Module { public: - CSSet(const std::string &modname, const std::string &creator) : Module(modname, creator) + CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); |