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 /src/language.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 'src/language.cpp')
-rw-r--r-- | src/language.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/language.cpp b/src/language.cpp index 6e9192756..32f96b461 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -168,7 +168,7 @@ void lang_sanitize() { len = strlen(langtexts[i][j]); strscpy(tmp, langtexts[i][j], sizeof(tmp)); - if (Config.UseStrictPrivMsg) + if (Config->UseStrictPrivMsg) strnrepl(tmp, sizeof(tmp), "%R", "/"); else strnrepl(tmp, sizeof(tmp), "%R", "/msg "); @@ -221,8 +221,8 @@ void lang_init() /* Not what I intended to do, but these services are so archaïc * that it's difficult to do more. */ - if ((Config.NSDefLanguage = langlist[Config.NSDefLanguage]) < 0) - Config.NSDefLanguage = DEF_LANGUAGE; + if ((Config->NSDefLanguage = langlist[Config->NSDefLanguage]) < 0) + Config->NSDefLanguage = DEF_LANGUAGE; if (!langtexts[DEF_LANGUAGE]) fatal("Unable to load default language"); @@ -247,7 +247,7 @@ void lang_init() int strftime_lang(char *buf, int size, User *u, int format, struct tm *tm) { - int language = u && u->Account() ? u->Account()->language : Config.NSDefLanguage; + int language = u && u->Account() ? u->Account()->language : Config->NSDefLanguage; char tmpbuf[BUFSIZE], buf2[BUFSIZE]; char *s; int i, ret; @@ -318,7 +318,7 @@ void syntax_error(const Anope::string &service, User *u, const Anope::string &co const char *getstring(NickAlias *na, int index) { // Default to config - int langidx = Config.NSDefLanguage; + int langidx = Config->NSDefLanguage; // If they are registered (na->nc), and NOT forbidden if (na && na->nc && !na->HasFlag(NS_FORBIDDEN)) @@ -330,7 +330,7 @@ const char *getstring(NickAlias *na, int index) const char *getstring(const NickCore *nc, int index) { // Default to config - int langidx = Config.NSDefLanguage; + int langidx = Config->NSDefLanguage; if (nc) langidx = nc->language; @@ -346,7 +346,7 @@ const char *getstring(const User *u, int index) const char *getstring(int index) { // Default to config - int langidx = Config.NSDefLanguage; + int langidx = Config->NSDefLanguage; return langtexts[langidx][index]; } |