From e5890808278a641a7aaf1a0000ec5d72767c942c Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 2 Oct 2013 13:28:53 -0400 Subject: Fix /ns alist showing a header/column header if the user has no access --- modules/commands/ns_alist.cpp | 24 +++++++++++++----------- 1 file 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 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 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 -- cgit