unrealircd

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

sdesc.c (2377B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/sdesc.c
      3  *   (C) 1999-2001 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
      4  *
      5  *   See file AUTHORS in IRC package for additional names of
      6  *   the programmers. 
      7  *
      8  *   This program is free software; you can redistribute it and/or modify
      9  *   it under the terms of the GNU General Public License as published by
     10  *   the Free Software Foundation; either version 1, or (at your option)
     11  *   any later version.
     12  *
     13  *   This program is distributed in the hope that it will be useful,
     14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  *   GNU General Public License for more details.
     17  *
     18  *   You should have received a copy of the GNU General Public License
     19  *   along with this program; if not, write to the Free Software
     20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21  */
     22 
     23 #include "unrealircd.h"
     24 
     25 CMD_FUNC(cmd_sdesc);
     26 
     27 #define MSG_SDESC 	"SDESC"	/* sdesc */
     28 
     29 ModuleHeader MOD_HEADER
     30   = {
     31 	"sdesc",	/* Name of module */
     32 	"5.0", /* Version */
     33 	"command /sdesc", /* Short description of module */
     34 	"UnrealIRCd Team",
     35 	"unrealircd-6",
     36     };
     37 
     38 MOD_INIT()
     39 {
     40 	CommandAdd(modinfo->handle, MSG_SDESC, cmd_sdesc, 1, CMD_USER);
     41 	MARK_AS_OFFICIAL_MODULE(modinfo);
     42 	return MOD_SUCCESS;
     43 }
     44 
     45 MOD_LOAD()
     46 {
     47 	return MOD_SUCCESS;
     48 }
     49 
     50 MOD_UNLOAD()
     51 {
     52 	return MOD_SUCCESS;
     53 }
     54 
     55 /* cmd_sdesc - 15/05/1999 - Stskeeps
     56  *  :prefix SDESC
     57  *  parv[1] - description
     58  *  D: Sets server info if you are Server Admin (ONLINE)
     59 */
     60 
     61 CMD_FUNC(cmd_sdesc)
     62 {
     63 	if (!ValidatePermissionsForPath("server:description",client,NULL,NULL,NULL))
     64 	{
     65 		sendnumeric(client, ERR_NOPRIVILEGES);
     66 		return;
     67 	}
     68 	
     69 	if ((parc < 2) || BadPtr(parv[1]))
     70 	{
     71 		sendnumeric(client, ERR_NEEDMOREPARAMS, "SDESC");
     72 		return;
     73 	}
     74 
     75 	if (strlen(parv[1]) > REALLEN)
     76 	{
     77 		if (MyConnect(client))
     78 		{
     79 			sendnotice(client, "*** /SDESC Error: \"Server info\" may maximum be %i characters of length",
     80 				REALLEN);
     81 			return;
     82 		}
     83 	}
     84 
     85 	strlncpy(client->uplink->info, parv[1], sizeof(client->uplink->info), REALLEN);
     86 
     87 	sendto_server(client, 0, 0, NULL, ":%s SDESC :%s", client->name, parv[1]);
     88 
     89 	unreal_log(ULOG_INFO, "sdesc", "SDESC_COMMAND", client,
     90 	           "Server description for $server is now '$server.server.info' (changed by $client)",
     91 	           log_data_client("server", client->uplink));
     92 }