unrealircd

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

lag.c (2113B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/lag.c
      3  *   (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
      4  *   Moved to modules by Fish (Justin Hammond)
      5  *
      6  *   This program is free software; you can redistribute it and/or modify
      7  *   it under the terms of the GNU General Public License as published by
      8  *   the Free Software Foundation; either version 1, or (at your option)
      9  *   any later version.
     10  *
     11  *   This program is distributed in the hope that it will be useful,
     12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14  *   GNU General Public License for more details.
     15  *
     16  *   You should have received a copy of the GNU General Public License
     17  *   along with this program; if not, write to the Free Software
     18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19  */
     20 
     21 #include "unrealircd.h"
     22 
     23 CMD_FUNC(cmd_lag);
     24 
     25 /* Place includes here */
     26 #define MSG_LAG         "LAG"   /* Lag detect */
     27 
     28 ModuleHeader MOD_HEADER
     29   = {
     30 	"lag",	/* Name of module */
     31 	"5.0", /* Version */
     32 	"command /lag", /* Short description of module */
     33 	"UnrealIRCd Team",
     34 	"unrealircd-6",
     35     };
     36 
     37 /* This is called on module init, before Server Ready */
     38 MOD_INIT()
     39 {
     40 	CommandAdd(modinfo->handle, MSG_LAG, cmd_lag, MAXPARA, CMD_USER|CMD_SERVER);
     41 	MARK_AS_OFFICIAL_MODULE(modinfo);
     42 	return MOD_SUCCESS;
     43 }
     44 
     45 /* Is first run when server is 100% ready */
     46 MOD_LOAD()
     47 {
     48 	return MOD_SUCCESS;
     49 }
     50 
     51 /* Called when module is unloaded */
     52 MOD_UNLOAD()
     53 {
     54 	return MOD_SUCCESS;
     55 }
     56 
     57 /* cmd_lag (lag measure) - Stskeeps
     58  * parv[1] = server to query
     59 */
     60 
     61 CMD_FUNC(cmd_lag)
     62 {
     63 	if (!ValidatePermissionsForPath("server:info:lag",client,NULL,NULL,NULL))
     64 	{
     65 		sendnumeric(client, ERR_NOPRIVILEGES);
     66 		return;
     67 	}
     68 
     69 	if (parc < 2)
     70 	{
     71 		sendnumeric(client, ERR_NEEDMOREPARAMS, "LAG");
     72 		return;
     73 	}
     74 
     75 	if (*parv[1] == '\0')
     76 	{
     77 		sendnumeric(client, ERR_NEEDMOREPARAMS, "LAG");
     78 		return;
     79 	}
     80 
     81 	if (hunt_server(client, recv_mtags, "LAG", 1, parc, parv) == HUNTED_NOSUCH)
     82 		return;
     83 
     84 	sendnotice(client, "Lag reply -- %s %s %lld", me.name, parv[1], (long long)TStime());
     85 }