mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 16:23:13 +02:00
new extban ~O:operclassname. Enables you to make a netadmin only channel like +iI ~O:netadmin*
&remove old adminonly (+A) channel mode a bit more
This commit is contained in:
@@ -807,9 +807,6 @@ src/modules/cap_invitenotify.dll: src/modules/cap_invitenotify.c $(INCLUDES)
|
||||
src/modules/ssl_antidos.dll: src/modules/ssl_antidos.c $(INCLUDES)
|
||||
$(CC) $(MODCFLAGS) src/modules/ssl_antidos.c $(MODLFLAGS)
|
||||
|
||||
src/modules/chanmodes/adminonly.dll: src/modules/chanmodes/adminonly.c $(INCLUDES)
|
||||
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/adminonly.c $(MODLFLAGS)
|
||||
|
||||
src/modules/chanmodes/censor.dll: src/modules/chanmodes/censor.c $(INCLUDES)
|
||||
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/censor.c $(MODLFLAGS)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ INCLUDES = ../../include/auth.h ../../include/channel.h \
|
||||
R_MODULES= \
|
||||
nocolor.so stripcolor.so issecure.so permanent.so jointhrottle.so floodprot.so \
|
||||
noctcp.so link.so censor.so delayjoin.so noknock.so noinvite.so operonly.so \
|
||||
adminonly.so nonotice.so regonly.so nonickchange.so nokick.so regonlyspeak.so \
|
||||
nonotice.so regonly.so nonickchange.so nokick.so regonlyspeak.so \
|
||||
secureonly.so
|
||||
|
||||
MODULES=$(R_MODULES)
|
||||
@@ -107,10 +107,6 @@ operonly.so: operonly.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o operonly.so operonly.c
|
||||
|
||||
adminonly.so: adminonly.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o adminonly.so adminonly.c
|
||||
|
||||
nonotice.so: nonotice.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o nonotice.so nonotice.c
|
||||
|
||||
@@ -30,7 +30,8 @@ INCLUDES = ../../include/auth.h ../../include/channel.h \
|
||||
../../include/version.h ../../include/whowas.h
|
||||
|
||||
R_MODULES= \
|
||||
join.so quiet.so nickchange.so inchannel.so realname.so regnick.so account.so
|
||||
join.so quiet.so nickchange.so inchannel.so realname.so regnick.so \
|
||||
account.so operclass.so
|
||||
|
||||
MODULES=$(R_MODULES)
|
||||
MODULEFLAGS=@MODULEFLAGS@
|
||||
@@ -83,3 +84,7 @@ regnick.so: regnick.c $(INCLUDES)
|
||||
account.so: account.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o account.so account.c
|
||||
|
||||
operclass.so: operclass.c $(INCLUDES)
|
||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||
-o operclass.so operclass.c
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Extended ban type: ban (or rather: exempt or invex) an operclass.
|
||||
* (C) Copyright 2003-.. Bram Matthys (Syzop) and the UnrealIRCd team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 1, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "unrealircd.h"
|
||||
|
||||
ModuleHeader MOD_HEADER(operclass)
|
||||
= {
|
||||
"chanmodes/extbans/operclass",
|
||||
"$Id$",
|
||||
"ExtBan ~O - Ban/exempt operclass",
|
||||
"3.2-b8-1",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Forward declarations */
|
||||
char *extban_operclass_conv_param(char *para);
|
||||
int extban_operclass_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type);
|
||||
|
||||
/** Called upon module init */
|
||||
DLLFUNC int MOD_INIT(operclass)(ModuleInfo *modinfo)
|
||||
{
|
||||
ExtbanInfo req;
|
||||
|
||||
req.flag = 'O';
|
||||
req.is_ok = NULL;
|
||||
req.conv_param = extban_operclass_conv_param;
|
||||
req.is_banned = extban_operclass_is_banned;
|
||||
req.options = EXTBOPT_INVEX;
|
||||
if (!ExtbanAdd(modinfo->handle, req))
|
||||
{
|
||||
config_error("could not register extended ban type");
|
||||
return MOD_FAILED;
|
||||
}
|
||||
|
||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/** Called upon module load */
|
||||
DLLFUNC int MOD_LOAD(operclass)(int module_load)
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/** Called upon unload */
|
||||
DLLFUNC int MOD_UNLOAD(operclass)(int module_unload)
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#define OPERCLASSLEN 64
|
||||
|
||||
char *extban_operclass_conv_param(char *para)
|
||||
{
|
||||
static char retbuf[OPERCLASSLEN + 4];
|
||||
char *p;
|
||||
|
||||
strlcpy(retbuf, para, sizeof(retbuf));
|
||||
|
||||
/* allow alpha, numeric, -, _, * and ? wildcards */
|
||||
for (p = retbuf+3; *p; p++)
|
||||
if (!strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_?*", *p))
|
||||
*p = '\0';
|
||||
|
||||
if (retbuf[3] == '\0')
|
||||
return NULL; /* just "~O:" is invalid */
|
||||
|
||||
return retbuf;
|
||||
}
|
||||
|
||||
int extban_operclass_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type)
|
||||
{
|
||||
char *ban = banin+3;
|
||||
|
||||
if (MyClient(sptr) && IsAnOper(sptr))
|
||||
{
|
||||
char *operclass = NULL;
|
||||
ConfigItem_oper *oper = Find_oper(sptr->user->operlogin);
|
||||
if (oper && oper->operclass)
|
||||
operclass = oper->operclass;
|
||||
|
||||
if (operclass && !match(ban, operclass))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user