unrealircd

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

svswatch.c (2011B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/svswatch.c
      3  *   (C) 2003 Bram Matthys (Syzop) 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_svswatch);
     23 
     24 /* Place includes here */
     25 #define MSG_SVSWATCH       "SVSWATCH"
     26 
     27 ModuleHeader MOD_HEADER
     28   = {
     29 	"svswatch",	/* Name of module */
     30 	"5.0", /* Version */
     31 	"command /svswatch", /* Short description of module */
     32 	"UnrealIRCd Team",
     33 	"unrealircd-6",
     34     };
     35 
     36 /* This is called on module init, before Server Ready */
     37 MOD_INIT()
     38 {
     39 	CommandAdd(modinfo->handle, MSG_SVSWATCH, cmd_svswatch, MAXPARA, CMD_SERVER);
     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 /* cmd_svswatch() - written by Syzop, suggested by Griever.
     58  * parv[1] - target nick
     59  * parv[2] - parameters
     60  */
     61 CMD_FUNC(cmd_svswatch)
     62 {
     63 	Client *target;
     64 
     65 	if (!IsSvsCmdOk(client))
     66 		return;
     67 
     68 	if (parc < 3 || BadPtr(parv[2]) || !(target = find_user(parv[1], NULL)))
     69 		return;
     70 
     71 	if (MyUser(target))
     72 	{
     73 		parv[0] = target->name;
     74 		parv[1] = parv[2];
     75 		parv[2] = NULL;
     76 		do_cmd(target, NULL, "WATCH", 2, parv);
     77 	}
     78 	else
     79 		sendto_one(target, NULL, ":%s SVSWATCH %s :%s", client->name, parv[1], parv[2]);
     80 }