unrealircd

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

chanop.c (1928B)

      1 /*
      2  * Channel Mode +o
      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 ModuleHeader MOD_HEADER
     23   = {
     24 	"chanmodes/chanop",
     25 	"6.0",
     26 	"Channel Mode +o",
     27 	"UnrealIRCd Team",
     28 	"unrealircd-6",
     29     };
     30 
     31 /* Forward declarations */
     32 int cmode_chanop_is_ok(Client *client, Channel *channel, char mode, const char *para, int type, int what);
     33 
     34 MOD_INIT()
     35 {
     36 	CmodeInfo creq;
     37 	ModDataInfo mreq;
     38 
     39 	MARK_AS_OFFICIAL_MODULE(modinfo);
     40 
     41 	memset(&creq, 0, sizeof(creq));
     42 	creq.paracount = 1;
     43 	creq.is_ok = cmode_chanop_is_ok;
     44 	creq.letter = 'o';
     45 	creq.prefix = '@';
     46 	creq.sjoin_prefix = '@';
     47 	creq.rank = RANK_CHANOP;
     48 	creq.unset_with_param = 1;
     49 	creq.type = CMODE_MEMBER;
     50 	CmodeAdd(modinfo->handle, creq, NULL);
     51 
     52 	return MOD_SUCCESS;
     53 }
     54 
     55 MOD_LOAD()
     56 {
     57 	return MOD_SUCCESS;
     58 }
     59 
     60 MOD_UNLOAD()
     61 {
     62 	return MOD_SUCCESS;
     63 }
     64 
     65 int cmode_chanop_is_ok(Client *client, Channel *channel, char mode, const char *param, int type, int what)
     66 {
     67 	if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR))
     68 	{
     69 		if (check_channel_access(client, channel, "oaq"))
     70 			return EX_ALLOW;
     71 		if (type == EXCHK_ACCESS_ERR)
     72 			sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
     73 		return EX_DENY;
     74 	}
     75 
     76 	/* fallthrough -- should not be used */
     77 	return EX_DENY;
     78 }