diff options
Diffstat (limited to 'modules/commands/ms_info.cpp')
-rw-r--r-- | modules/commands/ms_info.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp index 34533b9cb..b8b44085b 100644 --- a/modules/commands/ms_info.cpp +++ b/modules/commands/ms_info.cpp @@ -1,6 +1,6 @@ /* MemoServ core functions * - * (C) 2003-2023 Anope Team + * (C) 2003-2024 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. @@ -13,14 +13,14 @@ class CommandMSInfo : public Command { - public: +public: CommandMSInfo(Module *creator) : Command(creator, "memoserv/info", 0, 1) { this->SetDesc(_("Displays information about your memos")); this->SetSyntax(_("[\037nick\037 | \037channel\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { NickCore *nc = source.nc; const MemoInfo *mi; @@ -80,18 +80,19 @@ class CommandMSInfo : public Command } else { - unsigned count = 0, i, end; - for (i = 0, end = mi->memos->size(); i < end; ++i) + size_t count = 0; + for (size_t i = 0; i < mi->memos->size(); ++i) if (mi->GetMemo(i)->unread) ++count; + if (count == mi->memos->size()) - source.Reply(_("%s currently has \002%d\002 memos; all of them are unread."), nname.c_str(), count); + source.Reply(_("%s currently has \002%zu\002 memos; all of them are unread."), nname.c_str(), count); else if (!count) - source.Reply(_("%s currently has \002%d\002 memos."), nname.c_str(), mi->memos->size()); + source.Reply(_("%s currently has \002%zu\002 memos."), nname.c_str(), mi->memos->size()); else if (count == 1) - source.Reply(_("%s currently has \002%d\002 memos, of which \0021\002 is unread."), nname.c_str(), mi->memos->size()); + source.Reply(_("%s currently has \002%zu\002 memos, of which \0021\002 is unread."), nname.c_str(), mi->memos->size()); else - source.Reply(_("%s currently has \002%d\002 memos, of which \002%d\002 are unread."), nname.c_str(), mi->memos->size(), count); + source.Reply(_("%s currently has \002%zu\002 memos, of which \002%zu\002 are unread."), nname.c_str(), mi->memos->size(), count); } if (!mi->memomax) { @@ -137,18 +138,19 @@ class CommandMSInfo : public Command } else { - unsigned count = 0, i, end; - for (i = 0, end = mi->memos->size(); i < end; ++i) + size_t count = 0; + for (size_t i = 0; i < mi->memos->size(); ++i) if (mi->GetMemo(i)->unread) ++count; + if (count == mi->memos->size()) - source.Reply(_("You currently have \002%d\002 memos; all of them are unread."), count); + source.Reply(_("You currently have \002%zu\002 memos; all of them are unread."), count); else if (!count) - source.Reply(_("You currently have \002%d\002 memos."), mi->memos->size()); + source.Reply(_("You currently have \002%zu\002 memos."), mi->memos->size()); else if (count == 1) - source.Reply(_("You currently have \002%d\002 memos, of which \0021\002 is unread."), mi->memos->size()); + source.Reply(_("You currently have \002%zu\002 memos, of which \0021\002 is unread."), mi->memos->size()); else - source.Reply(_("You currently have \002%d\002 memos, of which \002%d\002 are unread."), mi->memos->size(), count); + source.Reply(_("You currently have \002%zu\002 memos, of which \002%zu\002 are unread."), mi->memos->size(), count); } if (!mi->memomax) @@ -197,7 +199,7 @@ class CommandMSInfo : 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(" "); @@ -220,7 +222,7 @@ class MSInfo : public Module { CommandMSInfo commandmsinfo; - public: +public: MSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandmsinfo(this) { |