diff options
Diffstat (limited to 'modules/commands/os_info.cpp')
-rw-r--r-- | modules/commands/os_info.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/modules/commands/os_info.cpp b/modules/commands/os_info.cpp index 6cfe19cf1..8015f835d 100644 --- a/modules/commands/os_info.cpp +++ b/modules/commands/os_info.cpp @@ -13,15 +13,15 @@ struct OperInfo : Serializable Anope::string target; Anope::string info; Anope::string adder; - time_t created; + time_t created = 0; - OperInfo() : Serializable("OperInfo"), created(0) { } + OperInfo() : Serializable("OperInfo") { } OperInfo(const Anope::string &t, const Anope::string &i, const Anope::string &a, time_t c) : Serializable("OperInfo"), target(t), info(i), adder(a), created(c) { } - ~OperInfo(); + ~OperInfo() override; - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["target"] << target; data["info"] << info; @@ -104,7 +104,7 @@ class CommandOSInfo : public Command this->SetSyntax(_("CLEAR \037target\037")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &cmd = params[0], target = params[1], info = params.size() > 2 ? params[2] : ""; @@ -148,10 +148,8 @@ class CommandOSInfo : public Command return; } - for (unsigned i = 0; i < (*oi)->size(); ++i) + for (auto *o : *(*oi)) { - OperInfo *o = (*oi)->at(i); - if (o->info.equals_ci(info)) { source.Reply(_("The oper info already exists on \002%s\002."), target.c_str()); @@ -236,7 +234,7 @@ class CommandOSInfo : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -262,9 +260,8 @@ class OSInfo : public Module if (!oi) return; - for (unsigned i = 0; i < (*oi)->size(); ++i) + for (auto *o : *(*oi)) { - OperInfo *o = (*oi)->at(i); info[_("Oper Info")] = Anope::printf(_("(by %s on %s) %s"), o->adder.c_str(), Anope::strftime(o->created, source.GetAccount(), true).c_str(), o->info.c_str()); } } @@ -276,12 +273,12 @@ class OSInfo : public Module } - void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) override { OnInfo(source, na->nc, info); } - void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override + void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) override { OnInfo(source, ci, info); } |