X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_kick.cpp;h=c11d934f9d7ab6bf8deb41e90ef7cb9626efc499;hb=b0e469b0bbdbc76692364e1f52ef613cc02a2a06;hp=9aaa96d1f2f330067b9c9ad1b5e9d9b019ca718f;hpb=60f91c5c3c313115dc4e92af9d728c493d8bc6aa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp index 9aaa96d1f..c11d934f9 100644 --- a/src/cmd_kick.cpp +++ b/src/cmd_kick.cpp @@ -2,59 +2,42 @@ * | 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. * * --------------------------------------------------- */ -using namespace std; - -#include "inspircd_config.h" -#include "inspircd.h" -#include "inspircd_io.h" -#include -#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 "inspstring.h" -#include "helperfuncs.h" -#include "hashcomp.h" -#include "typedefs.h" -#include "command_parse.h" -#include "cmd_kick.h" +#include "inspircd.h" +#include "commands/cmd_kick.h" + +extern "C" command_t* init_command(InspIRCd* Instance) +{ + return new cmd_kick(Instance); +} -void cmd_kick::Handle (char **parameters, int pcnt, userrec *user) +/** Handle /KICK + */ +CmdResult cmd_kick::Handle (const char** parameters, int pcnt, userrec *user) { char reason[MAXKICK]; - chanrec* c = FindChan(parameters[0]); - userrec* u = Find(parameters[1]); + chanrec* c = ServerInstance->FindChan(parameters[0]); + userrec* u = ServerInstance->FindNick(parameters[1]); if (!u || !c) { - WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]); - return; + user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]); + return CMD_FAILURE; } - if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!is_uline(user->server))) + if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server))) { - WriteServ(user->fd, "442 %s %s :You're not on that channel!", user->nick, parameters[0]); - return; + user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0]); + return CMD_FAILURE; } if (pcnt > 2) @@ -66,7 +49,9 @@ void cmd_kick::Handle (char **parameters, int pcnt, userrec *user) strlcpy(reason, user->nick, MAXKICK - 1); } - kick_channel(user, u, c, reason); -} - + if (!c->KickUser(user, u, reason)) + /* Nobody left here, delete the chanrec */ + delete c; + return CMD_SUCCESS; +}