X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_part.cpp;h=347466c22375dda74d6850c615bd4d2b7f299a27;hb=bfdf503e5204ba17479084e688a3605dbc9007a2;hp=23daecb7625e3bc92f3840ecff8d6771aab57822;hpb=293df6a8b55e89c127e60e92711ef0ef1027bff8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp index 23daecb76..347466c22 100644 --- a/src/cmd_part.cpp +++ b/src/cmd_part.cpp @@ -2,80 +2,42 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2005 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. * * --------------------------------------------------- */ -using namespace std; - -#include "inspircd_config.h" #include "inspircd.h" -#include "inspircd_io.h" -#include -#include -#ifdef GCC3 -#include -#else -#include -#endif -#include -#include -#include -#include #include "users.h" -#include "ctables.h" -#include "globals.h" -#include "modules.h" -#include "dynamic.h" -#include "wildcard.h" -#include "message.h" -#include "commands.h" -#include "mode.h" -#include "xline.h" -#include "inspstring.h" -#include "dnsqueue.h" -#include "helperfuncs.h" -#include "hashcomp.h" -#include "socketengine.h" -#include "typedefs.h" -#include "command_parse.h" -#include "cmd_part.h" +#include "commands/cmd_part.h" -extern ServerConfig* Config; -extern InspIRCd* ServerInstance; -extern int MODCOUNT; -extern std::vector modules; -extern std::vector factory; -extern time_t TIME; -extern user_hash clientlist; -extern chan_hash chanlist; -extern whowas_hash whowas; -extern std::vector all_opers; -extern std::vector local_users; -extern userrec* fd_ref_table[65536]; +extern "C" DllExport command_t* init_command(InspIRCd* Instance) +{ + return new cmd_part(Instance); +} -void cmd_part::Handle (char **parameters, int pcnt, userrec *user) +CmdResult cmd_part::Handle (const char** parameters, int pcnt, userrec *user) { - if (pcnt > 1) + if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) + return CMD_SUCCESS; + + chanrec* c = ServerInstance->FindChan(parameters[0]); + + if (c) { - /*if (ServerInstance->Parser->LoopCall(handle_part,parameters,pcnt,user,0,pcnt-2,0)) - return;*/ - 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 { - /*if (ServerInstance->Parser->LoopCall(handle_part,parameters,pcnt,user,0,pcnt-1,0)) - return;*/ - 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; +}