diff options
Diffstat (limited to 'modules')
115 files changed, 824 insertions, 1077 deletions
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index 5f14a2eb6..72e8c60f3 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -251,8 +251,8 @@ class CommandBSBadwords : public Command source.Reply(_("Bad words list for %s:"), ci->name.c_str()); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (const auto &reply : replies) + source.Reply(reply); source.Reply(_("End of bad words list.")); } diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp index d47a98f4d..b124aa2ce 100644 --- a/modules/commands/bs_botlist.cpp +++ b/modules/commands/bs_botlist.cpp @@ -26,10 +26,8 @@ class CommandBSBotList : public Command list.AddColumn(_("Nick")).AddColumn(_("Mask")); - for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) + for (const auto &[_, bi] : *BotListByNick) { - BotInfo *bi = it->second; - if (source.HasPriv("botserv/administration") || !bi->oper_only) { ++count; @@ -50,8 +48,8 @@ class CommandBSBotList : public Command { source.Reply(_("Bot list:")); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (const auto &reply : replies) + source.Reply(reply); source.Reply(_("%d bots available."), count); } diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp index d75390dfc..d9b3afe1d 100644 --- a/modules/commands/bs_info.cpp +++ b/modules/commands/bs_info.cpp @@ -17,10 +17,8 @@ class CommandBSInfo : public Command void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi) { Anope::string buf; - for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it) + for (const auto &[_, ci] : *RegisteredChannelList) { - const ChannelInfo *ci = it->second; - if (ci->bi == bi) { buf += " " + ci->name + " "; @@ -63,15 +61,15 @@ class CommandBSInfo : public Command std::vector<Anope::string> replies; info.Process(replies); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (const auto &reply : replies) + source.Reply(reply); if (source.HasPriv("botserv/administration")) { std::vector<Anope::string> buf; this->send_bot_channels(buf, bi); - for (unsigned i = 0; i < buf.size(); ++i) - source.Reply(buf[i]); + for (const auto &line : buf) + source.Reply(line); } } @@ -94,8 +92,8 @@ class CommandBSInfo : public Command std::vector<Anope::string> replies; info.Process(replies); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (const auto &reply : replies) + source.Reply(reply); } else source.Reply(_("\002%s\002 is not a valid bot or registered channel."), query.c_str()); diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index f3a3ef7cd..051400d16 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -20,8 +20,8 @@ struct KickerDataImpl : KickerData KickerDataImpl(Extensible *obj) { amsgs = badwords = bolds = caps = colors = flood = italics = repeat = reverses = underlines = false; - for (int16_t i = 0; i < TTB_SIZE; ++i) - ttb[i] = 0; + for (auto &ttbtype : ttb) + ttbtype = 0; capsmin = capspercent = 0; floodlines = floodsecs = 0; repeattimes = 0; @@ -69,8 +69,8 @@ struct KickerDataImpl : KickerData data.SetType("repeattimes", Serialize::Data::DT_INT); data["repeattimes"] << kd->repeattimes; data.SetType("dontkickops", Serialize::Data::DT_INT); data["dontkickops"] << kd->dontkickops; data.SetType("dontkickvoices", Serialize::Data::DT_INT); data["dontkickvoices"] << kd->dontkickvoices; - for (int16_t i = 0; i < TTB_SIZE; ++i) - data["ttb"] << kd->ttb[i] << " "; + for (auto ttbtype : kd->ttb) + data["ttb"] << ttbtype << " "; } void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override @@ -136,11 +136,8 @@ class CommandBSKick : public Command source.Reply(_("Configures bot kickers. \037option\037 can be one of:")); Anope::string this_name = source.command; - for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) + for (const auto &[c_name, info] : source.service->commands) { - const Anope::string &c_name = it->first; - const CommandInfo &info = it->second; - if (c_name.find_ci(this_name + " ") == 0) { ServiceReference<Command> command("Command", info.name); @@ -928,8 +925,8 @@ struct BanData Data() { last_use = 0; - for (int i = 0; i < TTB_SIZE; ++i) - this->ttb[i] = 0; + for (auto &ttbtype : this->ttb) + ttbtype = 0; } }; @@ -997,10 +994,8 @@ class BanDataPurger : public Timer { Log(LOG_DEBUG) << "bs_main: Running bandata purger"; - for (channel_map::iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) + for (auto &[_, c] : ChannelList) { - Channel *c = it->second; - BanData *bd = c->GetExt<BanData>("bandata"); if (bd != NULL) { @@ -1049,7 +1044,7 @@ class BSKick : public Module UserData *ud = userdata.Require(uc); return ud; - } + } void check_ban(ChannelInfo *ci, User *u, KickerData *kd, int ttbtype) { @@ -1308,11 +1303,11 @@ class BSKick : public Module { int i = 0, l = 0; - for (unsigned j = 0, end = realbuf.length(); j < end; ++j) + for (auto chr : realbuf) { - if (isupper(realbuf[j])) + if (isupper(chr)) ++i; - else if (islower(realbuf[j])) + else if (islower(chr)) ++l; } diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index 8f9e8a894..0670b537f 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp |
