unrealircd

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

svsnolag.c (2337B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/svsnolag.c
      3  *   (C) 2006 Alex Berezhnyak and djGrrr
      4  *
      5  *   Fake lag exception - SVSNOLAG and SVS2NOLAG commands
      6  *
      7  *   This program is free software; you can redistribute it and/or modify
      8  *   it under the terms of the GNU General Public License as published by
      9  *   the Free Software Foundation; either version 1, or (at your option)
     10  *   any later version.
     11  *
     12  *   This program is distributed in the hope that it will be useful,
     13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  *   GNU General Public License for more details.
     16  *
     17  *   You should have received a copy of the GNU General Public License
     18  *   along with this program; if not, write to the Free Software
     19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20  */
     21 
     22 #include "unrealircd.h"
     23 
     24 CMD_FUNC(cmd_svsnolag);
     25 CMD_FUNC(cmd_svs2nolag);
     26 
     27 #define MSG_SVSNOLAG 	"SVSNOLAG"	
     28 #define MSG_SVS2NOLAG 	"SVS2NOLAG"	
     29 
     30 ModuleHeader MOD_HEADER
     31   = {
     32 	"svsnolag",
     33 	"5.0",
     34 	"commands /svsnolag and /svs2nolag", 
     35 	"UnrealIRCd Team",
     36 	"unrealircd-6",
     37     };
     38 
     39 MOD_INIT()
     40 {
     41 	CommandAdd(modinfo->handle, MSG_SVSNOLAG, cmd_svsnolag, MAXPARA, CMD_SERVER);
     42 	CommandAdd(modinfo->handle, MSG_SVS2NOLAG, cmd_svs2nolag, MAXPARA, CMD_SERVER);
     43 	MARK_AS_OFFICIAL_MODULE(modinfo);
     44 	return MOD_SUCCESS;
     45 }
     46 
     47 MOD_LOAD()
     48 {
     49 	return MOD_SUCCESS;
     50 }
     51 
     52 MOD_UNLOAD()
     53 {
     54 	return MOD_SUCCESS;
     55 }
     56 
     57 void do_svsnolag(Client *client, int parc, const char *parv[], int show_change)
     58 {
     59 	Client *target;
     60 	char *cmd = show_change ? MSG_SVS2NOLAG : MSG_SVSNOLAG;
     61 
     62 	if (!IsSvsCmdOk(client))
     63 		return;
     64 
     65 	if (parc < 3)
     66 		return;
     67 
     68 	if (!(target = find_user(parv[2], NULL)))
     69 		return;
     70 
     71 	if (!MyUser(target))
     72 	{
     73 		sendto_one(target, NULL, ":%s %s %s %s", client->name, cmd, parv[1], parv[2]);
     74 		return;
     75 	}
     76 
     77 	if (*parv[1] == '+')
     78 	{
     79 		if (!IsNoFakeLag(target))
     80 		{
     81 			SetNoFakeLag(target);
     82 			if (show_change)
     83 				sendnotice(target, "You are now exempted from fake lag");
     84 		}
     85 	}
     86 	if (*parv[1] == '-')
     87 	{
     88 		if (IsNoFakeLag(target))
     89 		{
     90 			ClearNoFakeLag(target);
     91 			if (show_change)
     92 				sendnotice(target, "You are no longer exempted from fake lag");
     93 		}
     94 	}
     95 }
     96 
     97 CMD_FUNC(cmd_svsnolag)
     98 {
     99 	do_svsnolag(client, parc, parv, 0);
    100 }
    101 
    102 CMD_FUNC(cmd_svs2nolag)
    103 {
    104 	do_svsnolag(client, parc, parv, 1);
    105 }