Update Conf.cpp

Set minArgs/maxArgs = 1
This commit is contained in:
Negash 2019-01-15 14:59:05 +03:00 committed by GitHub
parent a82cd91143
commit f304a0cd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,8 +35,8 @@ bool ServerConf::parse(ServerConf& s, const char* str)
void CustomCommandConf::init(CustomCommandConf&c, const char* name) {
c.name = name;
c.minArgs = 2;
c.maxArgs = 2;
c.minArgs = 1;
c.maxArgs = 1;
c.mode = Command::Write;
}
@ -400,8 +400,8 @@ void Conf::setCustomCommand(const ConfParser::Node* node)
CustomCommandConf::init(cc, p->key.c_str());
auto s = p->sub;
for (;s ; s = s->next) {
if (setInt(cc.minArgs, "MinArgs", s, 2)) {
} else if (setInt(cc.maxArgs, "MaxArgs", s, 2, 9999)) {
if (setInt(cc.minArgs, "MinArgs", s, 1)) {
} else if (setInt(cc.maxArgs, "MaxArgs", s, 1, 9999)) {
} else if (setCommandMode(cc.mode, "Mode", s)) {
} else {
Throw(UnknownKey, "%s:%d unknown key %s", s->file, s->line, s->key.c_str());