diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-28 20:52:27 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-28 20:52:27 +0000 |
commit | adbbfd1238e4f87872fa1acbf3d19e550a62e47a (patch) | |
tree | 66248ad593d6c65d018cc9262bd7b8cd5563f23c | |
parent | b6caa4073c9c8a291dabfe6e6613b7f08917b214 (diff) |
Removed useless isnick() checks in Give* and Take*, in the name of tidiness
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2683 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/mode.cpp | 52 |
1 files changed, 9 insertions, 43 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 787e9f1f3..3302b0042 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -58,18 +58,11 @@ char* ModeParser::GiveOps(userrec *user,char *dest,chanrec *chan,int status) { userrec *d; - if ((!user) || (!dest) || (!chan)) + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** GiveOps was given an invalid parameter"); return NULL; } - - if (!isnick(dest)) - { - log(DEFAULT,"the target nickname given to GiveOps was invalid"); - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); - return NULL; - } d = Find(dest); if (!d) { @@ -121,18 +114,13 @@ char* ModeParser::GiveHops(userrec *user,char *dest,chanrec *chan,int status) { userrec *d; - if ((!user) || (!dest) || (!chan)) + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** GiveHops was given an invalid parameter"); return NULL; } d = Find(dest); - if (!isnick(dest)) - { - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); - return NULL; - } if (!d) { WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); @@ -177,18 +165,13 @@ char* ModeParser::GiveVoice(userrec *user,char *dest,chanrec *chan,int status) { userrec *d; - if ((!user) || (!dest) || (!chan)) + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** GiveVoice was given an invalid parameter"); return NULL; } d = Find(dest); - if (!isnick(dest)) - { - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); - return NULL; - } if (!d) { WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); @@ -233,19 +216,13 @@ char* ModeParser::TakeOps(userrec *user,char *dest,chanrec *chan,int status) { userrec *d; - if ((!user) || (!dest) || (!chan)) + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** TakeOps was given an invalid parameter"); return NULL; } d = Find(dest); - if (!isnick(dest)) - { - log(DEBUG,"TakeOps was given an invalid target nickname of %s",dest); - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); - return NULL; - } if (!d) { log(DEBUG,"TakeOps couldnt resolve the target nickname: %s",dest); @@ -292,18 +269,13 @@ char* ModeParser::TakeHops(userrec *user,char *dest,chanrec *chan,int status) { userrec *d; - if ((!user) || (!dest) || (!chan)) + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** TakeHops was given an invalid parameter"); return NULL; } d = Find(dest); - if (!isnick(dest)) - { - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); - return NULL; - } if (!d) { WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); @@ -349,18 +321,13 @@ char* ModeParser::TakeVoice(userrec *user,char *dest,chanrec *chan,int status) { userrec *d; - if ((!user) || (!dest) || (!chan)) + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** TakeVoice was given an invalid parameter"); return NULL; } d = Find(dest); - if (!isnick(dest)) - { - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); - return NULL; - } if (!d) { WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest); @@ -403,14 +370,13 @@ char* ModeParser::TakeVoice(userrec *user,char *dest,chanrec *chan,int status) char* ModeParser::AddBan(userrec *user,char *dest,chanrec *chan,int status) { - if ((!user) || (!dest) || (!chan)) { + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter"); return NULL; } BanItem b; - if ((!user) || (!dest) || (!chan)) - return NULL; + unsigned int l = strlen(dest); if (strchr(dest,'!')==0) return NULL; @@ -468,7 +434,7 @@ char* ModeParser::AddBan(userrec *user,char *dest,chanrec *chan,int status) char* ModeParser::TakeBan(userrec *user,char *dest,chanrec *chan,int status) { - if ((!user) || (!dest) || (!chan)) { + if ((!user) || (!dest) || (!chan) || (!*dest)) { log(DEFAULT,"*** BUG *** TakeBan was given an invalid parameter"); return 0; } |