diff options
author | Adam <Adam@anope.org> | 2013-10-02 13:28:53 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-10-05 00:33:03 -0400 |
commit | e5890808278a641a7aaf1a0000ec5d72767c942c (patch) | |
tree | b04e985aff8bbf74277aea8b06f07060de6ade37 /modules/commands/ns_alist.cpp | |
parent | 257b10ee912698c6378f0d02a851e3c298dc8b78 (diff) |
Fix /ns alist showing a header/column header if the user has no access
Diffstat (limited to 'modules/commands/ns_alist.cpp')
-rw-r--r-- | modules/commands/ns_alist.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/modules/commands/ns_alist.cpp b/modules/commands/ns_alist.cpp index c80a479fc..d34357c32 100644 --- a/modules/commands/ns_alist.cpp +++ b/modules/commands/ns_alist.cpp @@ -47,18 +47,10 @@ class CommandNSAList : public Command list.AddColumn(_("Number")).AddColumn(_("Channel")).AddColumn(_("Access")); - source.Reply(_("Channels that \002%s\002 has access on:"), nc->display.c_str()); - std::deque<ChannelInfo *> queue; nc->GetChannelReferences(queue); std::sort(queue.begin(), queue.end(), ChannelSort); - if (queue.empty()) - { - source.Reply(_("\002%s\002 has no access in any channels."), nc->display.c_str()); - return; - } - for (unsigned i = 0; i < queue.size(); ++i) { ChannelInfo *ci = queue[i]; @@ -100,10 +92,20 @@ class CommandNSAList : public Command std::vector<Anope::string> replies; list.Process(replies); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); - source.Reply(_("End of list - %d channels shown."), chan_count); + if (!chan_count) + { + source.Reply(_("\002%s\002 has no access in any channels."), nc->display.c_str()); + } + else + { + source.Reply(_("Channels that \002%s\002 has access on:"), nc->display.c_str()); + + for (unsigned i = 0; i < replies.size(); ++i) + source.Reply(replies[i]); + + source.Reply(_("End of list - %d channels shown."), chan_count); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override |