1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 08:16:39 +02:00

Rewrote the config reader to better handle invalid configs.

This prevents Anope from exploding when /os reload has errors.
This commit is contained in:
Adam
2010-08-17 19:27:37 -04:00
parent 2575008baa
commit e65d8b2f3d
195 changed files with 3133 additions and 3249 deletions
+16 -16
View File
@@ -33,11 +33,11 @@ class MemoListCallback : public NumberList
{
SentHeader = true;
if (ci)
notice_lang(Config.s_MemoServ, u, MEMO_LIST_CHAN_MEMOS, ci->name.c_str(), Config.s_MemoServ.c_str(), ci->name.c_str());
notice_lang(Config->s_MemoServ, u, MEMO_LIST_CHAN_MEMOS, ci->name.c_str(), Config->s_MemoServ.c_str(), ci->name.c_str());
else
notice_lang(Config.s_MemoServ, u, MEMO_LIST_MEMOS, u->nick.c_str(), Config.s_MemoServ.c_str());
notice_lang(Config->s_MemoServ, u, MEMO_LIST_MEMOS, u->nick.c_str(), Config->s_MemoServ.c_str());
notice_lang(Config.s_MemoServ, u, MEMO_LIST_HEADER);
notice_lang(Config->s_MemoServ, u, MEMO_LIST_HEADER);
}
DoList(u, ci, mi, Number - 1);
@@ -50,7 +50,7 @@ class MemoListCallback : public NumberList
char timebuf[64];
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_DATE_TIME_FORMAT, &tm);
timebuf[sizeof(timebuf) - 1] = 0; /* just in case */
notice_lang(Config.s_MemoServ, u, MEMO_LIST_FORMAT, (m->HasFlag(MF_UNREAD)) ? '*' : ' ', m->number, m->sender.c_str(), timebuf);
notice_lang(Config->s_MemoServ, u, MEMO_LIST_FORMAT, (m->HasFlag(MF_UNREAD)) ? '*' : ' ', m->number, m->sender.c_str(), timebuf);
}
};
@@ -75,12 +75,12 @@ class CommandMSList : public Command
if (!(ci = cs_findchan(chan)))
{
notice_lang(Config.s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
notice_lang(Config->s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
return MOD_CONT;
}
else if (!check_access(u, ci, CA_MEMO))
{
notice_lang(Config.s_MemoServ, u, ACCESS_DENIED);
notice_lang(Config->s_MemoServ, u, ACCESS_DENIED);
return MOD_CONT;
}
mi = &ci->memos;
@@ -92,9 +92,9 @@ class CommandMSList : public Command
else if (!mi->memos.size())
{
if (!chan.empty())
notice_lang(Config.s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan.c_str());
notice_lang(Config->s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan.c_str());
else
notice_lang(Config.s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
notice_lang(Config->s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
}
else
{
@@ -113,9 +113,9 @@ class CommandMSList : public Command
if (i == end)
{
if (!chan.empty())
notice_lang(Config.s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str());
notice_lang(Config->s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str());
else
notice_lang(Config.s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
notice_lang(Config->s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
return MOD_CONT;
}
}
@@ -131,10 +131,10 @@ class CommandMSList : public Command
{
SentHeader = true;
if (ci)
notice_lang(Config.s_MemoServ, u, !param.empty() ? MEMO_LIST_CHAN_NEW_MEMOS : MEMO_LIST_CHAN_MEMOS, ci->name.c_str(), Config.s_MemoServ.c_str(), ci->name.c_str());
notice_lang(Config->s_MemoServ, u, !param.empty() ? MEMO_LIST_CHAN_NEW_MEMOS : MEMO_LIST_CHAN_MEMOS, ci->name.c_str(), Config->s_MemoServ.c_str(), ci->name.c_str());
else
notice_lang(Config.s_MemoServ, u, !param.empty() ? MEMO_LIST_NEW_MEMOS : MEMO_LIST_MEMOS, u->nick.c_str(), Config.s_MemoServ.c_str());
notice_lang(Config.s_MemoServ, u, MEMO_LIST_HEADER);
notice_lang(Config->s_MemoServ, u, !param.empty() ? MEMO_LIST_NEW_MEMOS : MEMO_LIST_MEMOS, u->nick.c_str(), Config->s_MemoServ.c_str());
notice_lang(Config->s_MemoServ, u, MEMO_LIST_HEADER);
}
MemoListCallback::DoList(u, ci, mi, i);
@@ -146,18 +146,18 @@ class CommandMSList : public Command
bool OnHelp(User *u, const Anope::string &subcommand)
{
notice_help(Config.s_MemoServ, u, MEMO_HELP_LIST);
notice_help(Config->s_MemoServ, u, MEMO_HELP_LIST);
return true;
}
void OnSyntaxError(User *u, const Anope::string &subcommand)
{
syntax_error(Config.s_MemoServ, u, "LIST", MEMO_LIST_SYNTAX);
syntax_error(Config->s_MemoServ, u, "LIST", MEMO_LIST_SYNTAX);
}
void OnServCommand(User *u)
{
notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_LIST);
notice_lang(Config->s_MemoServ, u, MEMO_HELP_CMD_LIST);
}
};