diff options
author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-10 13:54:09 +0000 |
---|---|---|
committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-10 13:54:09 +0000 |
commit | b15c46d79518feb7a7027069bb99d6054a185e0f (patch) | |
tree | eb52f57972296df2ef9396df47c50e2042f7ddce /src | |
parent | e7a15723172f46d1f0b192fc959c7a649830173d (diff) |
Move getstring() and getstring2() from macros to functions. This fixes a bunch of warnings, and means they are actually *readable*, as well as type-safe and const.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1975 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/language.c | 25 | ||||
-rw-r--r-- | src/misc.c | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/language.c b/src/language.c index 0f5fe8124..a1cf34874 100644 --- a/src/language.c +++ b/src/language.c @@ -306,4 +306,29 @@ void syntax_error(char *service, User * u, const char *command, int msgnum) notice_lang(service, u, MORE_INFO, service, command); } +const char *getstring(NickAlias *na, int index) +{ + // Default to config + int langidx = NSDefLanguage; + + // If they are registered (na->nc), and NOT forbidden + if (na->nc && !na->status & NS_FORBIDDEN) + langidx = na->nc->language; // set language to their nickcore's language + + return langtexts[langidx][index]; +} + +const char *getstring2(NickCore *nc, int index) +{ + // Default to config + int langidx = NSDefLanguage; + + if (nc) + { + langidx = nc->language; + } + + return langtexts[langidx][index]; +} + /*************************************************************************/ diff --git a/src/misc.c b/src/misc.c index 0c8d8d650..4d4a31a3a 100644 --- a/src/misc.c +++ b/src/misc.c @@ -423,7 +423,7 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds) int need_comma = 0; char buf2[64], *end; - char *comma = getstring(na, COMMA_SPACE); + const char *comma = getstring(na, COMMA_SPACE); /* We first calculate everything */ days = seconds / 86400; |