diff options
| author | Adam <Adam@anope.org> | 2013-05-05 21:05:43 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2013-05-05 21:05:43 -0400 |
| commit | 5b3f81ea78f7a8ab69ff94cbf2bbf07f5966682e (patch) | |
| tree | 3536557fea79ffd77bb5a885465e579eeeafb8ff | |
| parent | 3e8752fe665c3cdf683f2b5fa271231fb3a624df (diff) | |
That doesn't work either, just don't use references.
find ./ -name '*.cpp' -exec sed -i 's/Get<const Anope::string\&>/Get<const Anope::string>/g' {} \;
64 files changed, 260 insertions, 266 deletions
diff --git a/include/config.h b/include/config.h index 5d9005f63..194b7fe74 100644 --- a/include/config.h +++ b/include/config.h @@ -49,7 +49,7 @@ namespace Configuration */ template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const { - const Anope::string &value = this->Get<const Anope::string &>(tag, def); + const Anope::string &value = this->Get<const Anope::string>(tag, def); try { return convertTo<T>(value); @@ -64,7 +64,7 @@ namespace Configuration const item_map* GetItems() const; }; - template<> CoreExport const Anope::string& Block::Get(const Anope::string &tag, const Anope::string& def) const; + template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const; template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const; template<> CoreExport const char* Block::Get(const Anope::string &tag, const Anope::string &def) const; template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const; diff --git a/modules/bs_autoassign.cpp b/modules/bs_autoassign.cpp index 3604fe69b..ae60f5b5a 100644 --- a/modules/bs_autoassign.cpp +++ b/modules/bs_autoassign.cpp @@ -20,7 +20,7 @@ class BSAutoAssign : public Module void OnChanRegistered(ChannelInfo *ci) anope_override { - const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string &>("bot"); + const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string>("bot"); if (bot.empty()) return; diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index de434337b..88dd751c3 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -801,13 +801,13 @@ class CSAccess : public Module { Configuration::Block *priv = conf->GetBlock("privilege", i); - const Anope::string &pname = priv->Get<const Anope::string &>("name"); + const Anope::string &pname = priv->Get<const Anope::string>("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = priv->Get<const Anope::string &>("level"); + const Anope::string &value = priv->Get<const Anope::string>("level"); if (value.empty()) continue; else if (value.equals_ci("founder")) diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index bb1e6ecd6..51665d309 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -546,7 +546,7 @@ class CSAKick : public Module mask = autokick->mask; reason = autokick->reason; if (reason.empty()) - reason = Config->GetModule(this)->Get<const Anope::string &>("autokickreason"); + reason = Config->GetModule(this)->Get<const Anope::string>("autokickreason"); if (reason.empty()) reason = "User has been banned from the channel"; return EVENT_STOP; diff --git a/modules/commands/cs_fantasy_stats.cpp b/modules/commands/cs_fantasy_stats.cpp index 381063c34..b8c83e73b 100644 --- a/modules/commands/cs_fantasy_stats.cpp +++ b/modules/commands/cs_fantasy_stats.cpp @@ -79,10 +79,10 @@ class CSStats : public Module void OnReload(Configuration::Conf *conf) anope_override { - prefix = conf->GetModule(this)->Get<const Anope::string &>("prefix"); + prefix = conf->GetModule(this)->Get<const Anope::string>("prefix"); if (prefix.empty()) prefix = "anope_"; - this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule(this)->Get<const Anope::string &>("engine")); + this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule(this)->Get<const Anope::string>("engine")); } SQL::Result RunQuery(const SQL::Query &query) diff --git a/modules/commands/cs_fantasy_top.cpp b/modules/commands/cs_fantasy_top.cpp index a3e35eb3c..7f82ba221 100644 --- a/modules/commands/cs_fantasy_top.cpp +++ b/modules/commands/cs_fantasy_top.cpp @@ -104,10 +104,10 @@ class CSTop : public Module void OnReload(Configuration::Conf *conf) anope_override { - prefix = conf->GetModule(this)->Get<const Anope::string &>("prefix"); + prefix = conf->GetModule(this)->Get<const Anope::string>("prefix"); if (prefix.empty()) prefix = "anope_"; - this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule(this)->Get<const Anope::string &>("engine")); + this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule(this)->Get<const Anope::string>("engine")); } SQL::Result RunQuery(const SQL::Query &query) diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index 8ed4cc8c6..18b72ef29 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -406,13 +406,13 @@ class CSFlags : public Module { Configuration::Block *priv = conf->GetBlock("privilege", i); - const Anope::string &pname = priv->Get<const Anope::string &>("name"); + const Anope::string &pname = priv->Get<const Anope::string>("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &value = priv->Get<const Anope::string &>("flag"); + const Anope::string &value = priv->Get<const Anope::string>("flag"); if (value.empty()) continue; diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp index 5d0f16f60..9718b73a1 100644 --- a/modules/commands/cs_list.cpp +++ b/modules/commands/cs_list.cpp @@ -151,7 +151,7 @@ class CommandCSList : public Command " \002LIST #51-100\002\n" " Lists all registered channels within the given range (51-100).")); - if (!Config->GetBlock("options")->Get<const Anope::string &>("regexengine").empty()) + if (!Config->GetBlock("options")->Get<const Anope::string>("regexengine").empty()) { source.Reply(" "); source.Reply(_("Regex matches are also supported using the %s engine.\n" diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index 325b652cd..9402f5b78 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -150,11 +150,11 @@ class CSSetMisc : public Module { Configuration::Block *block = conf->GetBlock("command", i); - if (block->Get<const Anope::string &>("command") != "chanserv/set/misc") + if (block->Get<const Anope::string>("command") != "chanserv/set/misc") continue; - Anope::string cname = block->Get<const Anope::string &>("name"); - Anope::string desc = block->Get<const Anope::string &>("misc_description"); + Anope::string cname = block->Get<const Anope::string>("name"); + Anope::string desc = block->Get<const Anope::string>("misc_description"); if (cname.empty() || desc.empty()) continue; diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 1e1cd0646..9efde866c 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -557,13 +557,13 @@ class CSXOP : public Module for (int i = 0; i < conf->CountBlock("privilege"); ++i) { Configuration::Block *block = conf->GetBlock("privilege", i); - const Anope::string &pname = block->Get<const Anope::string &>("name"); + const Anope::string &pname = block->Get<const Anope::string>("name"); Privilege *p = PrivilegeManager::FindPrivilege(pname); if (p == NULL) continue; - const Anope::string &xop = block->Get<const Anope::string &>("xop"); + const Anope::string &xop = block->Get<const Anope::string>("xop"); if (pname.empty() || xop.empty()) continue; @@ -573,8 +573,8 @@ class CSXOP : public Module for (int i = 0; i < conf->CountBlock("command"); ++i) { Configuration::Block *block = conf->GetBlock("command", i); - const Anope::string &cname = block->Get<const Anope::string &>("name"), - &cserv = block->Get<const Anope::string &>("command"); + const Anope::string &cname = block->Get<const Anope::string>("name"), + &cserv = block->Get<const Anope::string>("command"); if (cname.empty() || cserv != "chanserv/xop") continue; diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index cca6cd91c..97551cfcb 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -117,7 +117,7 @@ class CommandNSGroup : public Command } NickAlias *target, *na = NickAlias::Find(u->nick); - const Anope::string &guestnick = Config->GetBlock("options")->Get<const Anope::string &>("guestnickprefix"); + const Anope::string &guestnick = Config->GetBlock("options")->Get<const Anope::string>("guestnickprefix"); time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay"); if (!(target = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); diff --git a/modules/commands/ns_list.cpp b/modules/commands/ns_list.cpp index 88d5929eb..69648c2f4 100644 --- a/modules/commands/ns_list.cpp +++ b/modules/commands/ns_list.cpp @@ -167,7 +167,7 @@ class CommandNSList : public Command " \002LIST #51-100\002\n" " Lists all registered nicks within the given range (51-100).")); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string &>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index a9dbce470..6da7d4db1 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -116,7 +116,7 @@ class CommandNSRegister : public Command size_t nicklen = u_nick.length(); Anope::string pass = params[0]; Anope::string email = params.size() > 1 ? params[1] : ""; - const Anope::string &nsregister = Config->GetModule(this->owner)->Get<const Anope::string &>("registration"); + const Anope::string &nsregister = Config->GetModule(this->owner)->Get<const Anope::string>("registration"); if (Anope::ReadOnly) { @@ -143,7 +143,7 @@ class CommandNSRegister : public Command /* Guest nick can now have a series of between 1 and 7 digits. * --lara */ - const Anope::string &guestnick = Config->GetBlock("options")->Get<const Anope::string &>("guestnickprefix"); + const Anope::string &guestnick = Config->GetBlock("options")->Get<const Anope::string>("guestnickprefix"); if (nicklen <= guestnick.length() + 7 && nicklen >= guestnick.length() + 1 && !u_nick.find_ci(guestnick) && u_nick.substr(guestnick.length()).find_first_not_of("1234567890") == Anope::string::npos) { source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str()); @@ -290,7 +290,7 @@ class CommandNSResend : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - if (!Config->GetModule(this->owner)->Get<const Anope::string &>("registration").equals_ci("mail")) + if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) return; const NickAlias *na = NickAlias::Find(source.GetNick()); @@ -318,7 +318,7 @@ class CommandNSResend : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override { - if (!Config->GetModule(this->owner)->Get<const Anope::string &>("registration").equals_ci("mail")) + if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) return false; this->SendSyntax(source); @@ -330,7 +330,7 @@ class CommandNSResend : public Command void OnServHelp(CommandSource &source) anope_override { - if (Config->GetModule(this->owner)->Get<const Anope::string &>("registration").equals_ci("mail")) + if (Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) Command::OnServHelp(source); } }; @@ -345,7 +345,7 @@ class NSRegister : public Module NSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsregister(this), commandnsconfirm(this), commandnsrsend(this) { - if (Config->GetModule(this)->Get<const Anope::string &>("registration").equals_ci("disable")) + if (Config->GetModule(this)->Get<const Anope::string>("registration").equals_ci("disable")) throw ModuleException("Module " + this->name + " will not load with registration disabled."); } }; @@ -377,11 +377,11 @@ static bool SendRegmail(User *u, const NickAlias *na, const BotInfo *bi) message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const char *>("registration_message")); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string &>("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); subject = subject.replace_all_cs("%c", codebuf); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string &>("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); message = message.replace_all_cs("%c", codebuf); return Mail::Send(u, nc, bi, subject, message); diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index f4516c5a6..62fa0905f 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -143,11 +143,11 @@ static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi) message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const char *>("reset_message")); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string &>("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); subject = subject.replace_all_cs("%c", passcode); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string &>("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); message = message.replace_all_cs("%c", passcode); ResetInfo *ri = new ResetInfo; diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index fdc3aaac6..f0bff477e 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -468,11 +468,11 @@ class CommandNSSetEmail : public Command message = Config->GetBlock("mail")->Get<const char *>("emailchange_message"); subject = subject.replace_all_cs("%e", u->Account()->email); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string &>("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); subject = subject.replace_all_cs("%c", code); message = message.replace_all_cs("%e", u->Account()->email); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string &>("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); message = message.replace_all_cs("%c", code); return Mail::Send(u, u->Account(), bi, subject, message); diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index 871a1191f..ae7c2cb53 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -169,13 +169,13 @@ class NSSetMisc : public Module { Configuration::Block *block = conf->GetBlock("command", i); - const Anope::string &cmd = block->Get<const Anope::string &>("command"); + const Anope::string &cmd = block->Get<const Anope::string>("command"); if (cmd != "nickserv/set/misc" && cmd != "nickserv/saset/misc") continue; - Anope::string cname = block->Get<const Anope::string &>("name"); - Anope::string desc = block->Get<const Anope::string &>("misc_description"); + Anope::string cname = block->Get<const Anope::string>("name"); + Anope::string desc = block->Get<const Anope::string>("misc_description"); if (cname.empty() || desc.empty()) continue; diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index c90dd096f..b7433d0eb 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -121,7 +121,7 @@ class CommandOSAKill : public Command if (mask[0] == '/' && mask[mask.length() - 1] == '/') { - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string &>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (regexengine.empty()) { @@ -419,7 +419,7 @@ class CommandOSAKill : public Command "be given, even if it is the same as the default. The\n" "current AKILL default expiry time can be found with the\n" "\002STATS AKILL\002 command.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string &>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index a75d4691b..6d47d3a9f 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -345,26 +345,26 @@ class OSDefcon : public Module DefconConfig dconfig; dconfig.defaultlevel = block->Get<int>("defaultlevel"); - dconfig.defcons[4] = block->Get<const Anope::string &>("level4"); - dconfig.defcons[3] = block->Get<const Anope::string &>("level3"); - dconfig.defcons[2] = block->Get<const Anope::string &>("level2"); - dconfig.defcons[1] = block->Get<const Anope::string &>("level1"); + dconfig.defcons[4] = block-> |
