diff options
| author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-19 21:59:31 +0000 |
|---|---|---|
| committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-19 21:59:31 +0000 |
| commit | 7723437a81ee0858a448ad599889469c4113dd57 (patch) | |
| tree | f13ec2db84506c7767d25cd4f860e631ac94f890 /src/core | |
| parent | 805253de3686a9710bebec05bf857974ae9a80e4 (diff) | |
Fix a few warnings. Also move split_usermask into cs_akick, as this is the only place it is used.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2119 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/cs_akick.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index 50a0d8257..9be8e34e0 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -20,6 +20,37 @@ void myChanServHelp(User * u); +/* Split a usermask up into its constitutent parts. Returned strings are + * malloc()'d, and should be free()'d when done with. Returns "*" for + * missing parts. + */ + +static void split_usermask(const char *mask, const char **nick, const char **user, + const char **host) +{ + char *mask2 = sstrdup(mask); + + *nick = strtok(mask2, "!"); + *user = strtok(NULL, "@"); + *host = strtok(NULL, ""); + /* Handle special case: mask == user@host */ + if (*nick && !*user && strchr(*nick, '@')) { + *nick = NULL; + *user = strtok(mask2, "@"); + *host = strtok(NULL, ""); + } + if (!*nick) + *nick = "*"; + if (!*user) + *user = "*"; + if (!*host) + *host = "*"; + *nick = sstrdup(*nick); + *user = sstrdup(*user); + *host = sstrdup(*host); + delete [] mask2; +} + /** * Add the help response to anopes /cs help output. @@ -194,7 +225,7 @@ class CommandCSAKick : public Command } else if (stricmp(cmd, "ADD") == 0) { NickAlias *na = findnick(mask), *na2; NickCore *nc = NULL; - char *nick, *user, *host; + const char *nick, *user, *host; int freemask = 0; if (readonly) { |
