unrealircd

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

tsctl.c (2035B)

      1 /*
      2  *   Unreal Internet Relay Chat Daemon, src/modules/tsctl.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 ModuleHeader MOD_HEADER
     24   = {
     25 	"tsctl",	/* Name of module */
     26 	"5.0", /* Version */
     27 	"command /tsctl", /* Short description of module */
     28 	"UnrealIRCd Team",
     29 	"unrealircd-6",
     30     };
     31 
     32 CMD_FUNC(cmd_tsctl);
     33 
     34 MOD_INIT()
     35 {
     36 	CommandAdd(modinfo->handle, "TSCTL", cmd_tsctl, MAXPARA, CMD_USER|CMD_SERVER);
     37 	MARK_AS_OFFICIAL_MODULE(modinfo);
     38 	return MOD_SUCCESS;
     39 }
     40 
     41 MOD_LOAD()
     42 {
     43 	return MOD_SUCCESS;
     44 }
     45 
     46 MOD_UNLOAD()
     47 {
     48 	return MOD_SUCCESS;
     49 }
     50 
     51 CMD_FUNC(cmd_tsctl)
     52 {
     53 	if (!ValidatePermissionsForPath("server:tsctl:view",client,NULL,NULL,NULL))
     54 	{
     55 		sendnumeric(client, ERR_NOPRIVILEGES);
     56 		return;
     57 	}
     58 
     59 	if (MyUser(client) && (!parv[1] || strcasecmp(parv[1], "alltime")))
     60 	{
     61 		sendnotice(client, "/TSCTL now shows the time on all servers. You can no longer modify the time.");
     62 		parv[1] = "alltime";
     63 	}
     64 
     65 	if (parv[1] && !strcasecmp(parv[1], "alltime"))
     66 	{
     67 		struct timeval currenttime_tv;
     68 		gettimeofday(&currenttime_tv, NULL);
     69 		sendnotice(client, "*** Server=%s TStime=%lld.%ld",
     70 			me.name, (long long)currenttime_tv.tv_sec, (long)currenttime_tv.tv_usec);
     71 		sendto_server(client, 0, 0, NULL, ":%s TSCTL alltime", client->id);
     72 		return;
     73 	}
     74 }