19 this->
SetDesc(
_(
"Displays one or more vhost entries"));
20 this->
SetSyntax(
_(
"[\037key\037|\037#X-Y\037]"));
26 int from = 0, to = 0, counter = 1;
32 if (!key.
empty() && key[0] ==
'#')
34 size_t tmp = key.
find(
'-');
40 for (
unsigned i = 1, end = key.
length(); i < end; ++i)
42 if (!isdigit(key[i]) && i != tmp)
49 from = convertTo<int>(key.
substr(1, tmp - 1));
50 to = convertTo<int>(key.
substr(tmp + 1));
56 unsigned display_counter = 0, listmax =
Config->GetModule(this->
owner)->Get<
unsigned>(
"listmax",
"50");
67 if (!key.
empty() && key[0] !=
'#')
74 entry[
"Number"] =
stringify(display_counter);
75 entry[
"Nick"] = na->
nick;
91 if (((counter >= from && counter <= to) || (!from && !to)) && display_counter < listmax)
95 entry[
"Number"] =
stringify(display_counter);
96 entry[
"Nick"] = na->
nick;
103 list.AddEntry(entry);
109 if (!display_counter)
111 source.Reply(
_(
"No records to display."));
116 source.Reply(
_(
"Displayed records matching key \002%s\002 (count: \002%d\002)."), key.
c_str(), display_counter);
120 source.Reply(
_(
"Displayed records from \002%d\002 to \002%d\002."), from, to);
122 source.Reply(
_(
"Displayed all records (count: \002%d\002)."), display_counter);
125 std::vector<Anope::string> replies;
126 list.Process(replies);
128 for (
unsigned i = 0; i < replies.size(); ++i)
129 source.Reply(replies[i]);
136 source.Reply(
_(
"This command lists registered vhosts to the operator\n"
137 "if a \037key\037 is specified, only entries whos nick or vhost match\n"
138 "the pattern given in \037key\037 are displayed e.g. Rob* for all\n"
139 "entries beginning with \"Rob\"\n"
140 "If a \037#X-Y\037 style is used, only entries between the range of \002X\002\n"
141 "and \002Y\002 will be displayed, e.g. \002#1-3\002 will display the first 3\n"
142 "nick/vhost entries."));
const Anope::string & GetVhostHost() const
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
void Execute(CommandSource &source, const std::vector< Anope::string > ¶ms) anope_override
void SetDesc(const Anope::string &d)
CoreExport Serialize::Checker< nickalias_map > NickAliasList
CommandHSList(Module *creator)
string substr(size_type pos=0, size_type n=npos) const
CoreExport bool Match(const string &str, const string &mask, bool case_sensitive=false, bool use_regex=false)
static const size_type npos
HSList(const Anope::string &modname, const Anope::string &creator)
#define LIST_INCORRECT_RANGE
void SetSyntax(const Anope::string &s)
Anope::string stringify(const T &x)
const Anope::string & GetVhostCreator() const
void SendSyntax(CommandSource &)
const char * c_str() const
CommandHSList commandhslist
CoreExport Anope::string strftime(time_t t, const NickCore *nc=NULL, bool short_output=false)
time_t GetVhostCreated() const
size_type find(const string &_str, size_type pos=0) const
const Anope::string & GetVhostIdent() const