diff options
author | Adam <Adam@anope.org> | 2010-08-17 19:27:37 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-08-17 19:27:37 -0400 |
commit | e65d8b2f3dfdb40858259b3bb48ef6998c31e62f (patch) | |
tree | fd845bdef5664d025ab19c262ae2c5e9d23d7bb2 /modules/core/hs_set.cpp | |
parent | 2575008baa5c9d0ca789680da1a3b81dc74786f7 (diff) |
Rewrote the config reader to better handle invalid configs.
This prevents Anope from exploding when /os reload has errors.
Diffstat (limited to 'modules/core/hs_set.cpp')
-rw-r--r-- | modules/core/hs_set.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/modules/core/hs_set.cpp b/modules/core/hs_set.cpp index 604593e34..8ee6a8723 100644 --- a/modules/core/hs_set.cpp +++ b/modules/core/hs_set.cpp @@ -35,12 +35,12 @@ class CommandHSSet : public Command rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */ if (rawhostmask.empty()) { - notice_lang(Config.s_HostServ, u, HOST_SET_SYNTAX, Config.s_HostServ.c_str()); + notice_lang(Config->s_HostServ, u, HOST_SET_SYNTAX, Config->s_HostServ.c_str()); return MOD_CONT; } - if (vIdent.length() > Config.UserLen) + if (vIdent.length() > Config->UserLen) { - notice_lang(Config.s_HostServ, u, HOST_SET_IDENTTOOLONG, Config.UserLen); + notice_lang(Config->s_HostServ, u, HOST_SET_IDENTTOOLONG, Config->UserLen); return MOD_CONT; } else @@ -48,27 +48,27 @@ class CommandHSSet : public Command for (Anope::string::iterator s = vIdent.begin(), s_end = vIdent.end(); s != s_end; ++s) if (!isvalidchar(*s)) { - notice_lang(Config.s_HostServ, u, HOST_SET_IDENT_ERROR); + notice_lang(Config->s_HostServ, u, HOST_SET_IDENT_ERROR); return MOD_CONT; } } if (!ircd->vident) { - notice_lang(Config.s_HostServ, u, HOST_NO_VIDENT); + notice_lang(Config->s_HostServ, u, HOST_NO_VIDENT); return MOD_CONT; } } - if (rawhostmask.length() < Config.HostLen) + if (rawhostmask.length() < Config->HostLen) hostmask = rawhostmask; else { - notice_lang(Config.s_HostServ, u, HOST_SET_TOOLONG, Config.HostLen); + notice_lang(Config->s_HostServ, u, HOST_SET_TOOLONG, Config->HostLen); return MOD_CONT; } if (!isValidHost(hostmask, 3)) { - notice_lang(Config.s_HostServ, u, HOST_SET_ERROR); + notice_lang(Config->s_HostServ, u, HOST_SET_ERROR); return MOD_CONT; } @@ -78,7 +78,7 @@ class CommandHSSet : public Command { if (na->HasFlag(NS_FORBIDDEN)) { - notice_lang(Config.s_HostServ, u, NICK_X_FORBIDDEN, nick.c_str()); + notice_lang(Config->s_HostServ, u, NICK_X_FORBIDDEN, nick.c_str()); return MOD_CONT; } Alog() << "vHost for user \2" << nick << "\2 set to \2" << (!vIdent.empty() && ircd->vident ? vIdent : "") << (!vIdent.empty() && ircd->vident ? "@" : "") << hostmask << " \2 by oper \2" << u->nick << "\2"; @@ -86,29 +86,29 @@ class CommandHSSet : public Command na->hostinfo.SetVhost(vIdent, hostmask, u->nick); FOREACH_MOD(I_OnSetVhost, OnSetVhost(na)); if (!vIdent.empty()) - notice_lang(Config.s_HostServ, u, HOST_IDENT_SET, nick.c_str(), vIdent.c_str(), hostmask.c_str()); + notice_lang(Config->s_HostServ, u, HOST_IDENT_SET, nick.c_str(), vIdent.c_str(), hostmask.c_str()); else - notice_lang(Config.s_HostServ, u, HOST_SET, nick.c_str(), hostmask.c_str()); + notice_lang(Config->s_HostServ, u, HOST_SET, nick.c_str(), hostmask.c_str()); } else - notice_lang(Config.s_HostServ, u, HOST_NOREG, nick.c_str()); + notice_lang(Config->s_HostServ, u, HOST_NOREG, nick.c_str()); return MOD_CONT; } bool OnHelp(User *u, const Anope::string &subcommand) { - notice_help(Config.s_HostServ, u, HOST_HELP_SET); + notice_help(Config->s_HostServ, u, HOST_HELP_SET); return true; } void OnSyntaxError(User *u, const Anope::string &subcommand) { - syntax_error(Config.s_HostServ, u, "SET", HOST_SET_SYNTAX); + syntax_error(Config->s_HostServ, u, "SET", HOST_SET_SYNTAX); } void OnServHelp(User *u) { - notice_lang(Config.s_HostServ, u, HOST_HELP_CMD_SET); + notice_lang(Config->s_HostServ, u, HOST_HELP_CMD_SET); } }; |