unrealircd

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

svspart.c (2370B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/svspart.c
      3  *   (C) 2000-2001 Carsten V. Munk and 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_svspart);
     23 
     24 #define MSG_SVSPART       "SVSPART"
     25 
     26 ModuleHeader MOD_HEADER
     27   = {
     28 	"svspart",	/* Name of module */
     29 	"5.0", /* Version */
     30 	"command /svspart", /* Short description of module */
     31 	"UnrealIRCd Team",
     32 	"unrealircd-6",
     33     };
     34 
     35 /* This is called on module init, before Server Ready */
     36 MOD_INIT()
     37 {
     38 	CommandAdd(modinfo->handle, MSG_SVSPART, cmd_svspart, 3, CMD_USER|CMD_SERVER);
     39 	MARK_AS_OFFICIAL_MODULE(modinfo);
     40 	return MOD_SUCCESS;
     41 }
     42 
     43 /* Is first run when server is 100% ready */
     44 MOD_LOAD()
     45 {
     46 	return MOD_SUCCESS;
     47 }
     48 
     49 /* Called when module is unloaded */
     50 MOD_UNLOAD()
     51 {
     52 	return MOD_SUCCESS;	
     53 }
     54 
     55 /* cmd_svspart() - Lamego - Wed Jul 21 20:04:48 1999
     56    Copied off PTlink IRCd (C) PTlink coders team.
     57   Modified for PART by Stskeeps
     58 	parv[1] - nick to make part
     59 	parv[2] - channel(s) to part
     60 	parv[3] - comment
     61 */
     62 CMD_FUNC(cmd_svspart)
     63 {
     64 	Client *target;
     65 	const char *comment = (parc > 3 && parv[3] ? parv[3] : NULL);
     66 	if (!IsSvsCmdOk(client))
     67 		return;
     68 
     69 	if (parc < 3 || !(target = find_user(parv[1], NULL))) 
     70 		return;
     71 
     72 	if (MyUser(target))
     73 	{
     74 		parv[0] = target->name;
     75 		parv[1] = parv[2];
     76 		parv[2] = comment;
     77 		parv[3] = NULL;
     78 		do_cmd(target, NULL, "PART", comment ? 3 : 2, parv);
     79 		/* NOTE: target may be killed now by spamfilter due to the part reason */
     80 	}
     81 	else
     82 	{
     83 		if (comment)
     84 			sendto_one(target, NULL, ":%s SVSPART %s %s :%s", client->name,
     85 			    parv[1], parv[2], parv[3]);
     86 		else
     87 			sendto_one(target, NULL, ":%s SVSPART %s %s", client->name,
     88 			    parv[1], parv[2]);
     89 	}
     90 }