diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-07 20:56:10 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-07 20:56:10 +0000 |
commit | c30f0ef741528231aefaa3b284f3ac161b1ca86c (patch) | |
tree | 93e40a297b195c08371f89f3e43b10a29d82b9b4 | |
parent | be28c7f3c74f5f856be74ebef88316bc69c583b9 (diff) |
userrec::ForceNickChange was broken (not the entire nickchange system as i'd suspected at first)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5156 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/cmd_nick.cpp | 8 | ||||
-rw-r--r-- | src/users.cpp | 17 |
2 files changed, 8 insertions, 17 deletions
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 10d95ed46..a2337ba08 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -32,7 +32,7 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) { char oldnick[NICKMAX]; - if (!*parameters[0]) + if (!parameters[0][0]) { ServerInstance->Log(DEBUG,"zero length new nick passed to handle_nick"); return CMD_FAILURE; @@ -42,11 +42,13 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) ServerInstance->Log(DEBUG,"invalid old nick passed to handle_nick"); return CMD_FAILURE; } + ServerInstance->Log(DEBUG,"Fall through"); if (irc::string(user->nick) == irc::string(parameters[0])) { /* If its exactly the same, even case, dont do anything. */ if (!strcmp(user->nick,parameters[0])) return CMD_SUCCESS; + /* Its a change of case. People insisted that they should be * able to do silly things like this even though the RFC says * the nick AAA is the same as the nick aaa. @@ -65,10 +67,6 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) } else { - if ((*parameters[0] == ':') && (*(parameters[0]+1) != 0)) - { - parameters[0]++; - } char* mq = ServerInstance->XLines->matches_qline(parameters[0]); if (mq) { diff --git a/src/users.cpp b/src/users.cpp index bfecd744c..f8b8efeb0 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1169,13 +1169,10 @@ bool userrec::ForceNickChange(const char* newnick) { try { - char nick[MAXBUF]; int MOD_RESULT = 0; - - *nick = 0; FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick)); - + if (MOD_RESULT) { ServerInstance->stats->statsCollisions++; @@ -1187,19 +1184,15 @@ bool userrec::ForceNickChange(const char* newnick) ServerInstance->stats->statsCollisions++; return false; } - - if (newnick) - { - strlcpy(this->nick, newnick, NICKMAX - 1); - } + if (this->registered == REG_ALL) { const char* pars[1]; - pars[0] = nick; + pars[0] = newnick; std::string cmd = "NICK"; - ServerInstance->Parser->CallHandler(cmd, pars, 1, this); + return (ServerInstance->Parser->CallHandler(cmd, pars, 1, this) == CMD_SUCCESS); } - return true; + return false; } catch (...) |