Add channel::disabledmodes.

This replaces use_invex, use_except, and use_forward, although
those options are still used internally and will continue to work
for users, to maintain config compatibility between charybdis
and shadowircd.
This commit is contained in:
B.Greenham 2010-10-11 14:12:52 -04:00
parent 829ce93fb8
commit 4c16b692f3
6 changed files with 141 additions and 28 deletions

View File

@ -1,6 +1,5 @@
Todo list for ShadowIRCd 6.2 Todo list for ShadowIRCd 6.2
---------------------------- ----------------------------
* modesetize umodes
* global/remote SET, via shared block flag. * global/remote SET, via shared block flag.
* on the fly dnsbl exceptions (?) * on the fly dnsbl exceptions (?)
* evaluate snotes and possibly make a lot more netwide. * evaluate snotes and possibly make a lot more netwide.

View File

@ -372,15 +372,13 @@ exempt {
}; };
channel { channel {
#disabledmodes = "ME";
autochanmodes = "nt"; autochanmodes = "nt";
admin_on_channel_create = no; admin_on_channel_create = no;
exemptchanops = "NT"; exemptchanops = "NT";
use_halfop = yes; use_halfop = yes;
use_admin = yes; use_admin = yes;
use_invex = yes;
use_except = yes;
use_knock = yes; use_knock = yes;
use_forward = yes;
use_local_channels = yes; use_local_channels = yes;
knock_delay = 5 minutes; knock_delay = 5 minutes;
knock_delay_channel = 1 minute; knock_delay_channel = 1 minute;

View File

@ -740,6 +740,16 @@ exempt {
/* The channel block contains options pertaining to channels */ /* The channel block contains options pertaining to channels */
channel { channel {
/* disabledmodes: Modes that will be disabled, users will not be
* able to set them. This is only read on startup, you need to
* restart the ircd for this to have any effect. This only prevents
* local users/opers from setting these modes. This does not prevent
* remote servers/users (ex: services) from setting them. Make sure
* your services and remote servers are properly configured when
* using this option!
*/
#disabledmodes = "ME";
/* autochanmodes: Modes that will be set on a unregistered channel /* autochanmodes: Modes that will be set on a unregistered channel
* when the first user joins it. * when the first user joins it.
*/ */
@ -776,30 +786,6 @@ channel {
*/ */
use_admin = yes; use_admin = yes;
/* invex: Enable/disable channel mode +I, a n!u@h list of masks
* that can join a +i channel without an invite. Disabling this option
* via rehash will leave all previously set invexes hanging around,
* though they will not do anything. For this reason, you may want to
* restart to disable this option.
*/
use_invex = yes;
/* except: Enable/disable channel mode +e, a n!u@h list of masks
* that can join a channel through a ban (+b). Disabling this option
* via rehash will leave all previously set excepts hanging around,
* though they will not do anything. For this reason, you may want to
* restart to disable this option.
*/
use_except = yes;
/* forward: Enable/disable channel mode +f, which allows you to set
* a channel to forward users to if they can't join because of +i etc.
* Disabling this option via rehash will leave all previously set
* forwards hanging around, though they will not do anything. For
* this reason, you may want to restart to disable this option.
*/
use_forward = yes;
/* knock: Allows users to request an invite to a channel that /* knock: Allows users to request an invite to a channel that
* is locked somehow (+ikl). If the channel is +p or you are banned * is locked somehow (+ikl). If the channel is +p or you are banned
* the knock will not be sent. * the knock will not be sent.

View File

@ -239,6 +239,7 @@ struct config_channel_entry
{ {
char * autochanmodes; char * autochanmodes;
char * exemptchanops; char * exemptchanops;
char * disabledmodes;
int admin_on_channel_create; int admin_on_channel_create;
int use_halfop; int use_halfop;
int use_admin; int use_admin;

View File

@ -2265,6 +2265,7 @@ static struct ConfEntry conf_channel_table[] =
{ {
{ "autochanmodes", CF_QSTRING, NULL, 0, &ConfigChannel.autochanmodes }, { "autochanmodes", CF_QSTRING, NULL, 0, &ConfigChannel.autochanmodes },
{ "exemptchanops", CF_QSTRING, NULL, 0, &ConfigChannel.exemptchanops }, { "exemptchanops", CF_QSTRING, NULL, 0, &ConfigChannel.exemptchanops },
{ "disabledmodes", CF_QSTRING, NULL, 0, &ConfigChannel.disabledmodes },
{ "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count }, { "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count },
{ "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count }, { "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count },
{ "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho }, { "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho },

View File

@ -51,6 +51,7 @@
#include "sslproc.h" #include "sslproc.h"
#include "bandbi.h" #include "bandbi.h"
#include "operhash.h" #include "operhash.h"
#include "chmode.h"
struct config_server_hide ConfigServerHide; struct config_server_hide ConfigServerHide;
@ -85,6 +86,8 @@ extern char yytext[];
static int verify_access(struct Client *client_p, const char *username); static int verify_access(struct Client *client_p, const char *username);
static int attach_iline(struct Client *, struct ConfItem *); static int attach_iline(struct Client *, struct ConfItem *);
int startup = 1;
void void
init_s_conf(void) init_s_conf(void)
{ {
@ -764,6 +767,7 @@ set_default_conf(void)
ConfigChannel.autochanmodes = rb_strdup("nt"); ConfigChannel.autochanmodes = rb_strdup("nt");
ConfigChannel.exemptchanops = rb_strdup(""); ConfigChannel.exemptchanops = rb_strdup("");
ConfigChannel.disabledmodes = rb_strdup("");
ConfigChannel.admin_on_channel_create = NO; ConfigChannel.admin_on_channel_create = NO;
ConfigChannel.use_halfop = YES; ConfigChannel.use_halfop = YES;
ConfigChannel.use_admin = YES; ConfigChannel.use_admin = YES;
@ -940,6 +944,130 @@ validate_conf(void)
if(*ech == 'K') if(*ech == 'K')
ConfigChannel.exempt_cmode_K = 1; ConfigChannel.exempt_cmode_K = 1;
} }
/* orphan any modes specified in channel::disabledmodes */
char * dm;
if(startup && !EmptyString(ConfigChannel.disabledmodes))
{
for(dm = ConfigChannel.disabledmodes; *dm; dm++)
{
if(*dm == 'C')
{
cflag_orphan('C');
continue;
}
if(*dm == 'r')
{
cflag_orphan('r');
continue;
}
if(*dm == 'c')
{
cflag_orphan('c');
continue;
}
if(*dm == 'L')
{
cflag_orphan('L');
continue;
}
if(*dm == 'P')
{
cflag_orphan('P');
continue;
}
if(*dm == 'z')
{
cflag_orphan('z');
continue;
}
if(*dm == 'g')
{
cflag_orphan('g');
continue;
}
if(*dm == 'F')
{
cflag_orphan('F');
continue;
}
if(*dm == 'Q')
{
cflag_orphan('Q');
continue;
}
if(*dm == 'q')
{
cflag_orphan('q');
continue;
}
if(*dm == 'I')
{
cflag_orphan('I');
ConfigChannel.use_invex = "NO";
continue;
}
if(*dm == 'e')
{
cflag_orphan('e');
ConfigChannel.use_except = "NO";
continue;
}
if(*dm == 'f')
{
cflag_orphan('f');
ConfigChannel.use_forward = "NO";
continue;
}
if(*dm == 'j')
{
cflag_orphan('j');
continue;
}
if(*dm == 'T')
{
cflag_orphan('T');
continue;
}
if(*dm == 'D')
{
cflag_orphan('D');
continue;
}
if(*dm == 'E')
{
cflag_orphan('E');
continue;
}
if(*dm == 'N')
{
cflag_orphan('N');
continue;
}
if(*dm == 'G')
{
cflag_orphan('G');
continue;
}
if(*dm == 'J')
{
cflag_orphan('J');
continue;
}
if(*dm == 'K')
{
cflag_orphan('K');
continue;
}
if(*dm == 'M')
{
cflag_orphan('M');
continue;
}
}
}
startup = 0;
} }
/* add_temp_kline() /* add_temp_kline()