unrealircd

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

globops.c (2020B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/out.c
      3  *   (C) 2004 The UnrealIRCd Team
      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_globops);
     26 
     27 #define MSG_GLOBOPS 	"GLOBOPS"	
     28 
     29 ModuleHeader MOD_HEADER
     30   = {
     31 	"globops",
     32 	"5.0",
     33 	"command /globops", 
     34 	"UnrealIRCd Team",
     35 	"unrealircd-6",
     36     };
     37 
     38 MOD_INIT()
     39 {
     40 	CommandAdd(modinfo->handle, MSG_GLOBOPS, cmd_globops, 1, CMD_USER|CMD_SERVER);
     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 /** Write message to IRCOps.
     56  * parv[1] = message text
     57  */
     58 CMD_FUNC(cmd_globops)
     59 {
     60 	const char *message = parc > 1 ? parv[1] : NULL;
     61 
     62 	if (BadPtr(message))
     63 	{
     64 		sendnumeric(client, ERR_NEEDMOREPARAMS, "GLOBOPS");
     65 		return;
     66 	}
     67 
     68 	if (MyUser(client) && !ValidatePermissionsForPath("chat:globops",client,NULL,NULL,NULL))
     69 	{
     70 		sendnumeric(client, ERR_NOPRIVILEGES);
     71 		return;
     72 	}
     73 
     74 	if (MyUser(client))
     75 	{
     76 		/* Easy */
     77 		sendto_umode_global(UMODE_OPER, "from %s: %s", client->name, message);
     78 	} else
     79 	{
     80 		/* Backward-compatible (3.2.x) */
     81 		sendto_umode(UMODE_OPER, "from %s: %s", client->name, message);
     82 		sendto_server(client, 0, 0, NULL, ":%s SENDUMODE o :from %s: %s",
     83 		    me.id, client->name, message);
     84 	}
     85 }