]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_part.cpp
Fix for bug found by danieldg, where remote nicks were truncated to NICKMAX, but...
[user/henk/code/inspircd.git] / src / commands / cmd_part.cpp
index 5137a32cabc9493f7aa666846319e9bf336aa4b0..54fd1321667c7eec4552b3e259340bec4d66d8a5 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
        return new CommandPart(Instance);
 }
 
-CmdResult CommandPart::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User *user)
 {
        std::string reason;
 
@@ -29,7 +29,7 @@ CmdResult CommandPart::Handle (const char** parameters, int pcnt, User *user)
                        reason = ServerInstance->Config->FixedPart;
                else
                {
-                       if (pcnt > 1)
+                       if (parameters.size() > 1)
                                reason = ServerInstance->Config->PrefixPart + std::string(parameters[1]) + ServerInstance->Config->SuffixPart;
                        else
                                reason = "";
@@ -37,24 +37,23 @@ CmdResult CommandPart::Handle (const char** parameters, int pcnt, User *user)
        }
        else
        {
-               reason = pcnt ? parameters[1] : "";
+               reason = parameters.size() > 1 ? parameters[1] : "";
        }
 
-       if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+       if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
                return CMD_SUCCESS;
 
        Channel* c = ServerInstance->FindChan(parameters[0]);
        
        if (c)
        {
-               const char *rreason = reason.empty() ? NULL : reason.c_str();
-               if (!c->PartUser(user, rreason))
+               if (!c->PartUser(user, reason))
                        /* Arse, who stole our channel! :/ */
                        delete c;
        }
        else
        {
-               user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]);
+               user->WriteServ( "401 %s %s :No such channel", user->nick.c_str(), parameters[0].c_str());
                return CMD_FAILURE;
        }