unrealircd

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

isregistered.c (1796B)

      1 /*
      2  * Channel Mode +r
      3  * (C) Copyright 2021 Syzop and the UnrealIRCd team
      4  *
      5  * This program is free software; you can redistribute it and/or modify
      6  * it under the terms of the GNU General Public License as published by
      7  * the Free Software Foundation; either version 1, or (at your option)
      8  * any later version.
      9  *
     10  * This program is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  * GNU General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU General Public License
     16  * along with this program; if not, write to the Free Software
     17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     18  */
     19 
     20 #include "unrealircd.h"
     21 
     22 
     23 ModuleHeader MOD_HEADER
     24   = {
     25 	"chanmodes/isregistered",
     26 	"6.0",
     27 	"Channel Mode +r",
     28 	"UnrealIRCd Team",
     29 	"unrealircd-6",
     30     };
     31 
     32 Cmode_t EXTCMODE_REGISTERED;
     33 
     34 #define IsRegisteredChannel(channel)    (channel->mode.mode & EXTCMODE_REGISTERED)
     35 
     36 int isregistered_chanmode_is_ok(Client *client, Channel *channel, char mode, const char *param, int type, int what);
     37 
     38 MOD_INIT()
     39 {
     40 	CmodeInfo req;
     41 
     42 	MARK_AS_OFFICIAL_MODULE(modinfo);
     43 
     44 	memset(&req, 0, sizeof(req));
     45 	req.paracount = 0;
     46 	req.letter = 'r';
     47 	req.is_ok = isregistered_chanmode_is_ok;
     48 	CmodeAdd(modinfo->handle, req, &EXTCMODE_REGISTERED);
     49 
     50 	return MOD_SUCCESS;
     51 }
     52 
     53 MOD_LOAD()
     54 {
     55 	return MOD_SUCCESS;
     56 }
     57 
     58 MOD_UNLOAD()
     59 {
     60 	return MOD_SUCCESS;
     61 }
     62 
     63 int isregistered_chanmode_is_ok(Client *client, Channel *channel, char mode, const char *param, int type, int what)
     64 {
     65 	if (!IsServer(client) && !IsULine(client))
     66 	{
     67 		if (type == EXCHK_ACCESS_ERR)
     68 			sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, channel->name);
     69 		return EX_ALWAYS_DENY;
     70 	}
     71 	return EX_ALLOW;
     72 }