unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

svskill.c (2117B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/svskill.c
      3  *   (C) 2004 The UnrealIRCd Team
      4  *
      5  *   This program is free software; you can redistribute it and/or modify
      6  *   it under the terms of the GNU General Public License as published by
      7  *   the Free Software Foundation; either version 1, or (at your option)
      8  *   any later version.
      9  *
     10  *   This program is distributed in the hope that it will be useful,
     11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  *   GNU General Public License for more details.
     14  *
     15  *   You should have received a copy of the GNU General Public License
     16  *   along with this program; if not, write to the Free Software
     17  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18  */
     19 
     20 #include "unrealircd.h"
     21 
     22 CMD_FUNC(cmd_svskill);
     23 
     24 #define MSG_SVSKILL	"SVSKILL"
     25 
     26 ModuleHeader MOD_HEADER
     27   = {
     28 	"svskill",	/* Name of module */
     29 	"5.0", /* Version */
     30 	"command /svskill", /* Short description of module */
     31 	"UnrealIRCd Team",
     32 	"unrealircd-6",
     33     };
     34 
     35 
     36 /* This is called on module init, before Server Ready */
     37 MOD_INIT()
     38 {
     39 	CommandAdd(modinfo->handle, MSG_SVSKILL, cmd_svskill, MAXPARA, CMD_SERVER|CMD_USER);
     40 	MARK_AS_OFFICIAL_MODULE(modinfo);
     41 	return MOD_SUCCESS;
     42 }
     43 
     44 /* Is first run when server is 100% ready */
     45 MOD_LOAD()
     46 {
     47 	return MOD_SUCCESS;
     48 }
     49 
     50 
     51 /* Called when module is unloaded */
     52 MOD_UNLOAD()
     53 {
     54 	return MOD_SUCCESS;
     55 }
     56 
     57 /*
     58 ** cmd_svskill
     59 **	parv[1] = client
     60 **	parv[2] = kill message
     61 */
     62 CMD_FUNC(cmd_svskill)
     63 {
     64 	MessageTag *mtags = NULL;
     65 	Client *target;
     66 	const char *comment = "SVS Killed";
     67 	int n;
     68 
     69 	if (parc < 2)
     70 		return;
     71 	if (parc > 3)
     72 		return;
     73 	if (parc == 3)
     74 		comment = parv[2];
     75 
     76 	if (!IsSvsCmdOk(client))
     77 		return;
     78 
     79 	if (!(target = find_user(parv[1], NULL)))
     80 		return;
     81 
     82 	/* for new_message() we use target here, makes sense for the exit_client, right? */
     83 	new_message(target, recv_mtags, &mtags);
     84 	sendto_server(client, 0, 0, mtags, ":%s SVSKILL %s :%s", client->id, target->id, comment);
     85 	SetKilled(target);
     86 	exit_client(target, mtags, comment);
     87 	free_message_tags(mtags);
     88 }