diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-09 03:14:27 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-03-09 03:14:27 +0000 |
commit | 3b634c37703423e670509313ff7816a34b4cac31 (patch) | |
tree | dbe0c9e9db019c5fdeccf0797adc011b66287d44 /src/core/cs_set.c | |
parent | 4184b7df4494a2f343038c95c7df09d18b4bcdd8 (diff) |
Fix /cs set mlock to not use strtok, which wasn't working due to the change in the command API to not use strtok at all, indirectly found because of bug #1020 (which was for 1.9.0 where /cs set mlock functions properly).
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2149 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core/cs_set.c')
-rw-r--r-- | src/core/cs_set.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/core/cs_set.c b/src/core/cs_set.c index add0598ea..f9426b510 100644 --- a/src/core/cs_set.c +++ b/src/core/cs_set.c @@ -15,6 +15,7 @@ #include "module.h" #include "encrypt.h" +#include "hashcomp.h" class CommandCSSet : public Command { @@ -186,7 +187,7 @@ class CommandCSSet : public Command return MOD_CONT; } - CommandReturn DoSetMLock(User * u, ChannelInfo * ci, const char *param) + CommandReturn DoSetMLock(User * u, ChannelInfo * ci, const char *modes) { int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */ unsigned char mode; @@ -212,7 +213,17 @@ class CommandCSSet : public Command ci->mlock_redirect = NULL; } - while ((mode = *param++)) { + std::string params(modes), param; + unsigned space = params.find(' '); + if (space != std::string::npos) + { + param = params.substr(space + 1); + params = params.substr(0, space); + modes = params.c_str(); + } + spacesepstream modeparams(param); + + while ((mode = *modes++)) { switch (mode) { case '+': add = 1; @@ -234,7 +245,10 @@ class CommandCSSet : public Command ci->mlock_on |= cbm->flag; ci->mlock_off &= ~cbm->flag; if (cbm->cssetvalue) - cbm->cssetvalue(ci, strtok(NULL, " ")); + { + modeparams.GetToken(param); + cbm->cssetvalue(ci, param.c_str()); + } } else { ci->mlock_off |= cbm->flag; if (ci->mlock_on & cbm->flag) { @@ -246,7 +260,7 @@ class CommandCSSet : public Command } else { notice_lang(s_ChanServ, u, CHAN_SET_MLOCK_UNKNOWN_CHAR, mode); } - } /* while (*param) */ + } /* while (*modes) */ if (ircd->Lmode) { /* We can't mlock +L if +l is not mlocked as well. */ |