X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_part.cpp;h=9887d844ed4ed448ca14d77b5a7be161711013e7;hb=4c83624ed825ca123401a45c8d2844ba6453a85b;hp=3bf22ac5d3d8725ac43951a0f1cacbd7d9ff94c0;hpb=bab14f0dd2345c9d7dcbc47c918563709e1ac094;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp index 3bf22ac5d..9887d844e 100644 --- a/src/cmd_part.cpp +++ b/src/cmd_part.cpp @@ -1 +1,42 @@ -/* +------------------------------------+ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * * InspIRCd: (C) 2002-2007 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see * the file COPYING for details. * * --------------------------------------------------- */ #include "inspircd.h" #include "users.h" #include "commands/cmd_part.h" 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 CMD_SUCCESS; chanrec* c = ServerInstance->FindChan(parameters[0]); if (c) { if (!c->PartUser(user, pcnt > 1 ? parameters[1] : NULL)) /* Arse, who stole our channel! :/ */ delete c; } else { user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]); return CMD_FAILURE; } return CMD_SUCCESS; } \ No newline at end of file +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" +#include "commands/cmd_part.h" + +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 CMD_SUCCESS; + + chanrec* c = ServerInstance->FindChan(parameters[0]); + + if (c) + { + if (!c->PartUser(user, pcnt > 1 ? parameters[1] : NULL)) + /* Arse, who stole our channel! :/ */ + delete c; + } + else + { + user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]); + return CMD_FAILURE; + } + + return CMD_SUCCESS; +}