X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_part.cpp;h=7152a3c176dbef6ebc95b12965f1468b871d6983;hb=46ff0bed0047c4cd05828c5f46dce63176e5084b;hp=39a9621404e867b6ff915e024b8498fd6f3e2ca2;hpb=085cd4278f0f495c6d008a3d157026b33a23b787;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp index 39a962140..7152a3c17 100644 --- a/src/cmd_part.cpp +++ b/src/cmd_part.cpp @@ -2,12 +2,9 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits * - * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see * the file COPYING for details. * @@ -16,23 +13,33 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" -#include "helperfuncs.h" #include "commands/cmd_part.h" -extern InspIRCd* ServerInstance; -void cmd_part::Handle (const char** parameters, int pcnt, userrec *user) + +extern "C" DllExport command_t* init_command(InspIRCd* Instance) +{ + return new cmd_part(Instance); +} + +CmdResult cmd_part::Handle (const char** parameters, int pcnt, userrec *user) { if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) - return; + return CMD_SUCCESS; + + chanrec* c = ServerInstance->FindChan(parameters[0]); - if (pcnt > 1) + if (c) { - del_channel(user,parameters[0],parameters[1],false); + if (!c->PartUser(user, pcnt > 1 ? parameters[1] : NULL)) + /* Arse, who stole our channel! :/ */ + delete c; } else { - del_channel(user,parameters[0],NULL,false); + user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]); + return CMD_FAILURE; } + + return CMD_SUCCESS; }