diff options
author | Adam <Adam@anope.org> | 2013-09-27 10:58:11 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-09-27 19:11:02 -0400 |
commit | 02d67f682a0f507575369df99ab80024f5e3d7ce (patch) | |
tree | 8a81947aa0a2bbd2d957ebc1978e49b8415113f0 /modules/commands/os_forbid.cpp | |
parent | b3061087401a4f8d22b122fa4dfd11c98e75da3c (diff) |
Allow /os forbid list <type>
Diffstat (limited to 'modules/commands/os_forbid.cpp')
-rw-r--r-- | modules/commands/os_forbid.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index fa7732d33..0e8c34e78 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -292,10 +292,14 @@ class CommandOSForbid : public Command ListFormatter list(source.GetAccount()); list.AddColumn(_("Mask")).AddColumn(_("Type")).AddColumn(_("Creator")).AddColumn(_("Expires")).AddColumn(_("Reason")); + unsigned shown = 0; for (unsigned i = 0; i < forbids.size(); ++i) { ForbidData *d = forbids[i]; + if (ftype != FT_SIZE && ftype != d->type) + continue; + Anope::string stype; if (d->type == FT_NICK) stype = "NICK"; @@ -315,17 +319,28 @@ class CommandOSForbid : public Command entry["Expires"] = d->expires ? Anope::strftime(d->expires, NULL, true).c_str() : Language::Translate(source.GetAccount(), _("Never")); entry["Reason"] = d->reason; list.AddEntry(entry); + ++shown; } - source.Reply(_("Forbid list:")); + if (!shown) + { + source.Reply(_("There are no forbids of type %s."), subcommand.upper().c_str()); + } + else + { + source.Reply(_("Forbid list:")); - std::vector<Anope::string> replies; - list.Process(replies); + std::vector<Anope::string> replies; + list.Process(replies); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (unsigned i = 0; i < replies.size(); ++i) + source.Reply(replies[i]); - source.Reply(_("End of forbid list.")); + if (shown >= forbids.size()) + source.Reply(_("End of forbid list.")); + else + source.Reply(_("End of forbid list - %d/%d entries shown."), shown, forbids.size()); + } } } else |