0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 19:28:52 +02:00

Proper channel mode classification. Fixes existing ad hoc

channel mode classification which is required by RPL_MYINFO indicating arity,
and RPL_ISUPPORT indicating an enumerated class. The content of these replies
had previously been generated by hardcoded strings of some letters.

Channel modes require classification which corresponds to the
CHANMODES= data in RPL_ISUPPORT. Classes A,B,C can then be
listed in the unary column of RPL_MYINFO. cflag_add() is updated
for this. Additional cleanup of chmode.h and channel.h
circularity is also proffered within.

Submitted-by: Jason Volk <jason@zemos.net>
This commit is contained in:
William Pitcock 2016-06-25 22:54:37 -05:00
parent 499f3437c7
commit 7e1bb8ad0d
20 changed files with 250 additions and 455 deletions

View file

@ -25,7 +25,7 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('A', chm_staff);
mymode = cflag_add('A', CHM_D, chm_staff);
if (mymode == 0)
return -1;

View file

@ -26,7 +26,7 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('U', chm_simple);
mymode = cflag_add('U', CHM_D, chm_simple);
if (mymode == 0)
return -1;

View file

@ -66,7 +66,7 @@ chm_nonotice_process(hook_data_privmsg_channel *data)
static int
_modinit(void)
{
mode_nonotice = cflag_add('T', chm_simple);
mode_nonotice = cflag_add('T', CHM_D, chm_simple);
if (mode_nonotice == 0)
return -1;

View file

@ -25,7 +25,7 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('O', chm_staff);
mymode = cflag_add('O', CHM_D, chm_staff);
if (mymode == 0)
return -1;

View file

@ -25,6 +25,7 @@ _modinit(void)
{
chmode_table['O'].set_func = chm_operonly;
chmode_table['O'].mode_type = 0;
chmode_table['O'].mode_class = CHM_D;
return 0;
}
@ -34,6 +35,7 @@ _moddeinit(void)
{
chmode_table['O'].set_func = chm_nosuch;
chmode_table['O'].mode_type = 0;
chmode_table['O'].mode_class = 0;
}
static void

View file

@ -33,7 +33,7 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('M', chm_hidden);
mymode = cflag_add('M', CHM_D, chm_hidden);
if (mymode == 0)
return -1;

View file

@ -26,6 +26,7 @@ _modinit(void)
{
chmode_table['R'].set_func = chm_quietunreg;
chmode_table['R'].mode_type = 0;
chmode_table['R'].mode_class = CHM_D;
return 0;
}
@ -35,6 +36,7 @@ _moddeinit(void)
{
chmode_table['R'].set_func = chm_nosuch;
chmode_table['R'].mode_type = 0;
chmode_table['R'].mode_class = 0;
}
static void

View file

@ -25,7 +25,7 @@ static unsigned int mymode;
static int
_modinit(void)
{
mymode = cflag_add('S', chm_simple);
mymode = cflag_add('S', CHM_D, chm_simple);
if (mymode == 0)
return -1;

View file

@ -25,6 +25,7 @@ _modinit(void)
{
chmode_table['S'].set_func = chm_sslonly;
chmode_table['S'].mode_type = 0;
chmode_table['S'].mode_class = CHM_D;
return 0;
}
@ -34,6 +35,7 @@ _moddeinit(void)
{
chmode_table['S'].set_func = chm_nosuch;
chmode_table['S'].mode_type = 0;
chmode_table['S'].mode_class = 0;
}
static void

View file

@ -45,7 +45,7 @@ static int
_modinit(void)
{
/* initalize the +N cmode */
mymode = cflag_add('N', chm_simple);
mymode = cflag_add('N', CHM_D, chm_simple);
if (mymode == 0)
return -1;

View file

@ -25,15 +25,20 @@
#ifndef INCLUDED_channel_h
#define INCLUDED_channel_h
#define MODEBUFLEN 200
#include "setup.h"
#include "chmode.h"
/* Maximum mode changes allowed per client, per server is different */
#define MAXMODEPARAMS 4
#define MAXMODEPARAMSSERV 10
#include <setup.h>
struct Client;
/* channel status flags */
#define CHFL_PEON 0x0000 /* normal member of channel */
#define CHFL_VOICE 0x0001 /* the power to speak */
#define CHFL_CHANOP 0x0002 /* Channel operator */
#define CHFL_BANNED 0x0008 /* cached as banned */
#define CHFL_QUIETED 0x0010 /* cached as being +q victim */
#define ONLY_SERVERS 0x0020
#define ONLY_OPERS 0x0040
#define ALL_MEMBERS CHFL_PEON
#define ONLY_CHANOPS CHFL_CHANOP
#define ONLY_CHANOPSVOICED (CHFL_CHANOP|CHFL_VOICE)
/* mode structure for channels */
struct Mode
@ -121,62 +126,16 @@ struct ChModeChange
int mems;
};
typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
struct ChannelMode
{
ChannelModeFunc set_func;
long mode_type;
};
typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
struct Channel *chptr, long mode_type);
/* can_send results */
#define CAN_SEND_NO 0
#define CAN_SEND_NONOP 1
#define CAN_SEND_OPV 2
/* channel status flags */
#define CHFL_PEON 0x0000 /* normal member of channel */
#define CHFL_VOICE 0x0001 /* the power to speak */
#define CHFL_CHANOP 0x0002 /* Channel operator */
#define CHFL_BANNED 0x0008 /* cached as banned */
#define CHFL_QUIETED 0x0010 /* cached as being +q victim */
#define ONLY_SERVERS 0x0020
#define ONLY_OPERS 0x0040
#define ALL_MEMBERS CHFL_PEON
#define ONLY_CHANOPS CHFL_CHANOP
#define ONLY_CHANOPSVOICED (CHFL_CHANOP|CHFL_VOICE)
#define is_chanop(x) ((x) && (x)->flags & CHFL_CHANOP)
#define is_voiced(x) ((x) && (x)->flags & CHFL_VOICE)
#define is_chanop_voiced(x) ((x) && (x)->flags & (CHFL_CHANOP|CHFL_VOICE))
#define can_send_banned(x) ((x) && (x)->flags & (CHFL_BANNED|CHFL_QUIETED))
/* channel modes ONLY */
#define MODE_PRIVATE 0x0001
#define MODE_SECRET 0x0002
#define MODE_MODERATED 0x0004
#define MODE_TOPICLIMIT 0x0008
#define MODE_INVITEONLY 0x0010
#define MODE_NOPRIVMSGS 0x0020
#define MODE_REGONLY 0x0040
#define MODE_EXLIMIT 0x0100 /* exempt from list limits, +b/+e/+I/+q */
#define MODE_PERMANENT 0x0200 /* permanant channel, +P */
#define MODE_OPMODERATE 0x0400 /* send rejected messages to ops */
#define MODE_FREEINVITE 0x0800 /* allow free use of /invite */
#define MODE_FREETARGET 0x1000 /* can be forwarded to without authorization */
#define MODE_DISFORWARD 0x2000 /* disable channel forwarding */
#define CHFL_BAN 0x10000000 /* ban channel flag */
#define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */
#define CHFL_INVEX 0x40000000
#define CHFL_QUIET 0x80000000
/* mode flags for direction indication */
#define MODE_QUERY 0
#define MODE_ADD 1
@ -195,11 +154,6 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
#define IsChannelName(name) ((name) && (*(name) == '#' || *(name) == '&'))
/* extban function results */
#define EXTBAN_INVALID -1 /* invalid mask, false even if negated */
#define EXTBAN_NOMATCH 0 /* valid mask, no match */
#define EXTBAN_MATCH 1 /* matches */
extern rb_dlink_list global_channel_list;
void init_channels(void);
@ -262,16 +216,12 @@ extern void set_channel_mode(struct Client *client_p, struct Client *source_p,
extern void set_channel_mlock(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, const char *newmlock, bool propagate);
extern struct ChannelMode chmode_table[256];
extern bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid,
const char *forward, rb_dlink_list * list, long mode_type);
extern struct Ban * del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list,
long mode_type);
extern ExtbanFunc extban_table[256];
extern int match_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type);
extern int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type);
const char * get_extban_string(void);

View file

@ -32,49 +32,92 @@
*/
#define ERR_CUSTOM 1000
/* Maximum mode changes allowed per client, per server is different */
#define MAXMODEPARAMS 4
#define MAXMODEPARAMSSERV 10
#define MODEBUFLEN 200
/* Channel mode classification */
typedef enum
{
CHM_A, // Mode has a parameter apropos a list (or no param for xfer)
CHM_B, // Always has a parameter
CHM_C, // Only has a parameter on MODE_ADD
CHM_D, // Never has a parameter
}
ChmClass;
/* Channel mode mask */
#define MODE_PRIVATE 0x00000001
#define MODE_SECRET 0x00000002
#define MODE_MODERATED 0x00000004
#define MODE_TOPICLIMIT 0x00000008
#define MODE_INVITEONLY 0x00000010
#define MODE_NOPRIVMSGS 0x00000020
#define MODE_REGONLY 0x00000040
#define MODE_EXLIMIT 0x00000100 /* exempt from list limits, +b/+e/+I/+q */
#define MODE_PERMANENT 0x00000200 /* permanant channel, +P */
#define MODE_OPMODERATE 0x00000400 /* send rejected messages to ops */
#define MODE_FREEINVITE 0x00000800 /* allow free use of /invite */
#define MODE_FREETARGET 0x00001000 /* can be forwarded to without authorization */
#define MODE_DISFORWARD 0x00002000 /* disable channel forwarding */
#define CHFL_BAN 0x10000000 /* ban channel flag */
#define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */
#define CHFL_INVEX 0x40000000
#define CHFL_QUIET 0x80000000
/* extban function results */
#define EXTBAN_INVALID -1 /* invalid mask, false even if negated */
#define EXTBAN_NOMATCH 0 /* valid mask, no match */
#define EXTBAN_MATCH 1 /* matches */
struct Client;
struct Channel;
typedef int (*ExtbanFunc)
(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type);
typedef void (*ChmFunc)
(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn, const char **parv, int *errors, int dir, char c, long mode_type);
struct Chm
{
ChmFunc set_func;
ChmClass mode_class;
long mode_type;
};
extern struct Chm chmode_table[256];
extern ExtbanFunc extban_table[256];
extern char chmode_arity[2][256];
extern char chmode_class[4][256];
extern int chmode_flags[256];
extern void chm_nosuch(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_orphaned(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_simple(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_ban(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_hidden(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_staff(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_forward(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_throttle(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_key(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_limit(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_op(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern void chm_voice(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);
extern unsigned int cflag_add(char c, ChannelModeFunc function);
extern void cflag_orphan(char c);
extern void construct_cflags_strings(void);
extern char cflagsbuf[256];
extern char cflagsmyinfo[256];
#define CHM_FUNCTION(_NAME_) \
void _NAME_(struct Client *source_p, struct Channel *chptr, \
int alevel, int parc, int *parn, const char **parv, \
int *errors, int dir, char c, long mode_type);
CHM_FUNCTION(chm_nosuch)
CHM_FUNCTION(chm_orphaned)
CHM_FUNCTION(chm_simple)
CHM_FUNCTION(chm_ban)
CHM_FUNCTION(chm_hidden)
CHM_FUNCTION(chm_staff)
CHM_FUNCTION(chm_forward)
CHM_FUNCTION(chm_throttle)
CHM_FUNCTION(chm_key)
CHM_FUNCTION(chm_limit)
CHM_FUNCTION(chm_op)
CHM_FUNCTION(chm_voice)
unsigned int cflag_add(const unsigned char c, const ChmClass chmclass, const ChmFunc function);
void cflag_orphan(const unsigned char c);
void chmode_init(void);
#endif

View file

@ -31,7 +31,7 @@
#define NUMERIC_STR_1 ":Welcome to the %s Internet Relay Chat Network %s"
#define NUMERIC_STR_2 ":Your host is %s, running version %s"
#define NUMERIC_STR_3 ":This server was created %s"
#define NUMERIC_STR_4 "%s %s %s %s bkloveqjfI"
#define NUMERIC_STR_4 "%s %s %s %s %s"
#define NUMERIC_STR_5 "%s :are supported by this server"
#define NUMERIC_STR_8 "%s :Server notice mask"
#define NUMERIC_STR_10 "%s %d :Please use this Server/Port instead"

View file

@ -65,65 +65,133 @@ static int mode_limit;
static int mode_limit_simple;
static int mask_pos;
static int removed_mask_pos;
char cflagsbuf[256];
char cflagsmyinfo[256];
int chmode_flags[256];
extern int h_get_channel_access;
/* OPTIMIZE ME! -- dwr */
void
construct_cflags_strings(void)
int chmode_flags[256]; // Table of mode flag integers
char chmode_arity[2][256]; // RPL_MYINFO (note that [0] is for 0 OR MORE params)
char chmode_class[4][256]; // RPL_ISUPPORT classification
struct Chm chmode_table[256] =
{
int i;
char *ptr = cflagsbuf;
char *ptr2 = cflagsmyinfo;
/* 0x00 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0x0F */
/* 0x10 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0x1F */
/* 0x20 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0x2F */
/* 0x30 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0x3F */
*ptr = '\0';
*ptr2 = '\0';
// Leading tab only please:
// <tab>{<sp>handler,<sp>class,<sp>flag<sp>},<sp> /* X */
for(i = 0; i < 256; i++)
{ }, /* @ */
{ }, /* A */
{ }, /* B */
{ 0, CHM_D, 0 }, /* C */
{ }, /* D */
{ }, /* E */
{ chm_simple, CHM_D, MODE_FREETARGET }, /* F */
{ }, /* G */
{ }, /* H */
{ chm_ban, CHM_A, CHFL_INVEX }, /* I */
{ }, /* J */
{ }, /* K */
{ chm_staff, CHM_D, MODE_EXLIMIT }, /* L */
{ }, /* M */
{ }, /* N */
{ }, /* O */
{ chm_staff, CHM_D, MODE_PERMANENT }, /* P */
{ chm_simple, CHM_D, MODE_DISFORWARD }, /* Q */
{ }, /* R */
{ }, /* S */
{ }, /* T */
{ }, /* U */
{ }, /* V */
{ }, /* W */
{ }, /* X */
{ }, /* Y */
{ }, /* Z */
/* 0x5B */ {},{},{},{},{},{}, /* 0x60 */
{ }, /* a */
{ chm_ban, CHM_A, CHFL_BAN }, /* b */
{ }, /* c */
{ }, /* d */
{ chm_ban, CHM_A, CHFL_EXCEPTION }, /* e */
{ chm_forward, CHM_C, 0 }, /* f */
{ chm_simple, CHM_D, MODE_FREEINVITE }, /* g */
{ }, /* h */
{ chm_simple, CHM_D, MODE_INVITEONLY }, /* i */
{ chm_throttle, CHM_C, 0 }, /* j */
{ chm_key, CHM_B, 0 }, /* k */
{ chm_limit, CHM_C, 0 }, /* l */
{ chm_simple, CHM_D, MODE_MODERATED }, /* m */
{ chm_simple, CHM_D, MODE_NOPRIVMSGS }, /* n */
{ chm_op, CHM_B, 0 }, /* o */
{ chm_simple, CHM_D, MODE_PRIVATE }, /* p */
{ chm_ban, CHM_A, CHFL_QUIET }, /* q */
{ chm_simple, CHM_D, MODE_REGONLY }, /* r */
{ chm_simple, CHM_D, MODE_SECRET }, /* s */
{ chm_simple, CHM_D, MODE_TOPICLIMIT }, /* t */
{ }, /* u */
{ chm_voice, CHM_B, 0 }, /* v */
{ }, /* w */
{ }, /* x */
{ }, /* y */
{ chm_simple, CHM_D, MODE_OPMODERATE }, /* z */
/* 0x7B */ {},{},{},{},{}, /* 0x7F */
/* 0x80 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0x9F */
/* 0x90 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0x9F */
/* 0xA0 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0xAF */
/* 0xB0 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0xBF */
/* 0xC0 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0xCF */
/* 0xD0 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0xDF */
/* 0xE0 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0xEF */
/* 0xF0 */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}, /* 0xFF */
};
/* OPTIMIZE ME! -- dwr
* sure! --jzk */
void
chmode_init(void)
{
/* Reset the state generated by earlier calls to this function */
memset(chmode_flags, '\0', sizeof(chmode_flags));
chmode_class[CHM_A][0] = '\0';
chmode_class[CHM_B][0] = '\0';
chmode_class[CHM_C][0] = '\0';
chmode_class[CHM_D][0] = '\0';
chmode_arity[0][0] = '\0';
chmode_arity[1][0] = '\0';
/* Filter out anything disabled by the configuraton */
unsigned long disabled = 0;
if (!ConfigChannel.use_invex) disabled |= CHFL_INVEX;
if (!ConfigChannel.use_except) disabled |= CHFL_EXCEPTION;
if (!ConfigChannel.use_forward) disabled |= MODE_FREETARGET | MODE_DISFORWARD;
/* Construct the chmode data */
for (size_t i = 0; i < 256; i++)
{
if( !(chmode_table[i].set_func == chm_ban) &&
!(chmode_table[i].set_func == chm_forward) &&
!(chmode_table[i].set_func == chm_throttle) &&
!(chmode_table[i].set_func == chm_key) &&
!(chmode_table[i].set_func == chm_limit) &&
!(chmode_table[i].set_func == chm_op) &&
!(chmode_table[i].set_func == chm_voice))
if(!chmode_table[i].set_func)
{
chmode_flags[i] = chmode_table[i].mode_type;
}
else
{
chmode_flags[i] = 0;
chmode_table[i].set_func = chm_nosuch;
chmode_table[i].mode_class = CHM_D;
continue;
}
switch (chmode_flags[i])
{
case MODE_FREETARGET:
case MODE_DISFORWARD:
if(ConfigChannel.use_forward)
*ptr++ = (char) i;
break;
default:
if(chmode_flags[i] != 0)
{
*ptr++ = (char) i;
}
}
if(chmode_table[i].mode_type & disabled || chmode_table[i].set_func == chm_nosuch)
continue;
/* Should we leave orphaned check here? -- dwr */
if(!(chmode_table[i].set_func == chm_nosuch) && !(chmode_table[i].set_func == chm_orphaned))
{
*ptr2++ = (char) i;
}
const char ch[2] = {i, 0};
chmode_flags[i] = chmode_table[i].mode_type;
rb_strlcat(chmode_class[chmode_table[i].mode_class], ch, 256);
rb_strlcat(chmode_arity[0], ch, 256);
}
*ptr++ = '\0';
*ptr2++ = '\0';
/* Any non-CHM_D mode has parameters, this sets up RPL_MYINFO */
for (size_t i = 0; i < 3; i++)
rb_strlcat(chmode_arity[1], chmode_class[i], 256);
}
/*
@ -149,31 +217,32 @@ find_cflag_slot(void)
}
unsigned int
cflag_add(char c_, ChannelModeFunc function)
cflag_add(const unsigned char c, const ChmClass mode_class, const ChmFunc function)
{
int c = (unsigned char)c_;
if (chmode_table[c].set_func != chm_nosuch &&
chmode_table[c].set_func != chm_orphaned)
if(chmode_table[c].set_func &&
chmode_table[c].set_func != chm_nosuch &&
chmode_table[c].set_func != chm_orphaned)
return 0;
if (chmode_table[c].set_func == chm_nosuch)
if(chmode_table[c].set_func == chm_nosuch)
chmode_table[c].mode_type = find_cflag_slot();
if (chmode_table[c].mode_type == 0)
if(chmode_table[c].mode_type == 0)
return 0;
chmode_table[c].set_func = function;
construct_cflags_strings();
chmode_table[c].mode_class = mode_class;
chmode_init();
return chmode_table[c].mode_type;
}
void
cflag_orphan(char c_)
cflag_orphan(const unsigned char c)
{
int c = (unsigned char)c_;
s_assert(chmode_flags[c] != 0);
chmode_table[c].set_func = chm_orphaned;
construct_cflags_strings();
chmode_init();
}
int
@ -1385,279 +1454,6 @@ chm_key(struct Client *source_p, struct Channel *chptr,
}
}
/* *INDENT-OFF* */
struct ChannelMode chmode_table[256] =
{
{chm_nosuch, 0 }, /* 0x00 */
{chm_nosuch, 0 }, /* 0x01 */
{chm_nosuch, 0 }, /* 0x02 */
{chm_nosuch, 0 }, /* 0x03 */
{chm_nosuch, 0 }, /* 0x04 */
{chm_nosuch, 0 }, /* 0x05 */
{chm_nosuch, 0 }, /* 0x06 */
{chm_nosuch, 0 }, /* 0x07 */
{chm_nosuch, 0 }, /* 0x08 */
{chm_nosuch, 0 }, /* 0x09 */
{chm_nosuch, 0 }, /* 0x0a */
{chm_nosuch, 0 }, /* 0x0b */
{chm_nosuch, 0 }, /* 0x0c */
{chm_nosuch, 0 }, /* 0x0d */
{chm_nosuch, 0 }, /* 0x0e */
{chm_nosuch, 0 }, /* 0x0f */
{chm_nosuch, 0 }, /* 0x10 */
{chm_nosuch, 0 }, /* 0x11 */
{chm_nosuch, 0 }, /* 0x12 */
{chm_nosuch, 0 }, /* 0x13 */
{chm_nosuch, 0 }, /* 0x14 */
{chm_nosuch, 0 }, /* 0x15 */
{chm_nosuch, 0 }, /* 0x16 */
{chm_nosuch, 0 }, /* 0x17 */
{chm_nosuch, 0 }, /* 0x18 */
{chm_nosuch, 0 }, /* 0x19 */
{chm_nosuch, 0 }, /* 0x1a */
{chm_nosuch, 0 }, /* 0x1b */
{chm_nosuch, 0 }, /* 0x1c */
{chm_nosuch, 0 }, /* 0x1d */
{chm_nosuch, 0 }, /* 0x1e */
{chm_nosuch, 0 }, /* 0x1f */
{chm_nosuch, 0 }, /* 0x20 */
{chm_nosuch, 0 }, /* 0x21 */
{chm_nosuch, 0 }, /* 0x22 */
{chm_nosuch, 0 }, /* 0x23 */
{chm_nosuch, 0 }, /* 0x24 */
{chm_nosuch, 0 }, /* 0x25 */
{chm_nosuch, 0 }, /* 0x26 */
{chm_nosuch, 0 }, /* 0x27 */
{chm_nosuch, 0 }, /* 0x28 */
{chm_nosuch, 0 }, /* 0x29 */
{chm_nosuch, 0 }, /* 0x2a */
{chm_nosuch, 0 }, /* 0x2b */
{chm_nosuch, 0 }, /* 0x2c */
{chm_nosuch, 0 }, /* 0x2d */
{chm_nosuch, 0 }, /* 0x2e */
{chm_nosuch, 0 }, /* 0x2f */
{chm_nosuch, 0 }, /* 0x30 */
{chm_nosuch, 0 }, /* 0x31 */
{chm_nosuch, 0 }, /* 0x32 */
{chm_nosuch, 0 }, /* 0x33 */
{chm_nosuch, 0 }, /* 0x34 */
{chm_nosuch, 0 }, /* 0x35 */
{chm_nosuch, 0 }, /* 0x36 */
{chm_nosuch, 0 }, /* 0x37 */
{chm_nosuch, 0 }, /* 0x38 */
{chm_nosuch, 0 }, /* 0x39 */
{chm_nosuch, 0 }, /* 0x3a */
{chm_nosuch, 0 }, /* 0x3b */
{chm_nosuch, 0 }, /* 0x3c */
{chm_nosuch, 0 }, /* 0x3d */
{chm_nosuch, 0 }, /* 0x3e */
{chm_nosuch, 0 }, /* 0x3f */
{chm_nosuch, 0 }, /* @ */
{chm_nosuch, 0 }, /* A */
{chm_nosuch, 0 }, /* B */
{chm_nosuch, 0 }, /* C */
{chm_nosuch, 0 }, /* D */
{chm_nosuch, 0 }, /* E */
{chm_simple, MODE_FREETARGET }, /* F */
{chm_nosuch, 0 }, /* G */
{chm_nosuch, 0 }, /* H */
{chm_ban, CHFL_INVEX }, /* I */
{chm_nosuch, 0 }, /* J */
{chm_nosuch, 0 }, /* K */
{chm_staff, MODE_EXLIMIT }, /* L */
{chm_nosuch, 0 }, /* M */
{chm_nosuch, 0 }, /* N */
{chm_nosuch, 0 }, /* O */
{chm_staff, MODE_PERMANENT }, /* P */
{chm_simple, MODE_DISFORWARD }, /* Q */
{chm_nosuch, 0 }, /* R */
{chm_nosuch, 0 }, /* S */
{chm_nosuch, 0 }, /* T */
{chm_nosuch, 0 }, /* U */
{chm_nosuch, 0 }, /* V */
{chm_nosuch, 0 }, /* W */
{chm_nosuch, 0 }, /* X */
{chm_nosuch, 0 }, /* Y */
{chm_nosuch, 0 }, /* Z */
{chm_nosuch, 0 },
{chm_nosuch, 0 },
{chm_nosuch, 0 },
{chm_nosuch, 0 },
{chm_nosuch, 0 },
{chm_nosuch, 0 },
{chm_nosuch, 0 }, /* a */
{chm_ban, CHFL_BAN }, /* b */
{chm_nosuch, 0 }, /* c */
{chm_nosuch, 0 }, /* d */
{chm_ban, CHFL_EXCEPTION }, /* e */
{chm_forward, 0 }, /* f */
{chm_simple, MODE_FREEINVITE }, /* g */
{chm_nosuch, 0 }, /* h */
{chm_simple, MODE_INVITEONLY }, /* i */
{chm_throttle, 0 }, /* j */
{chm_key, 0 }, /* k */
{chm_limit, 0 }, /* l */
{chm_simple, MODE_MODERATED }, /* m */
{chm_simple, MODE_NOPRIVMSGS }, /* n */
{chm_op, 0 }, /* o */
{chm_simple, MODE_PRIVATE }, /* p */
{chm_ban, CHFL_QUIET }, /* q */
{chm_simple, MODE_REGONLY }, /* r */
{chm_simple, MODE_SECRET }, /* s */
{chm_simple, MODE_TOPICLIMIT }, /* t */
{chm_nosuch, 0 }, /* u */
{chm_voice, 0 }, /* v */
{chm_nosuch, 0 }, /* w */
{chm_nosuch, 0 }, /* x */
{chm_nosuch, 0 }, /* y */
{chm_simple, MODE_OPMODERATE }, /* z */
{chm_nosuch, 0 }, /* 0x7b */
{chm_nosuch, 0 }, /* 0x7c */
{chm_nosuch, 0 }, /* 0x7d */
{chm_nosuch, 0 }, /* 0x7e */
{chm_nosuch, 0 }, /* 0x7f */
{chm_nosuch, 0 }, /* 0x80 */
{chm_nosuch, 0 }, /* 0x81 */
{chm_nosuch, 0 }, /* 0x82 */
{chm_nosuch, 0 }, /* 0x83 */
{chm_nosuch, 0 }, /* 0x84 */
{chm_nosuch, 0 }, /* 0x85 */
{chm_nosuch, 0 }, /* 0x86 */
{chm_nosuch, 0 }, /* 0x87 */
{chm_nosuch, 0 }, /* 0x88 */
{chm_nosuch, 0 }, /* 0x89 */
{chm_nosuch, 0 }, /* 0x8a */
{chm_nosuch, 0 }, /* 0x8b */
{chm_nosuch, 0 }, /* 0x8c */
{chm_nosuch, 0 }, /* 0x8d */
{chm_nosuch, 0 }, /* 0x8e */
{chm_nosuch, 0 }, /* 0x8f */
{chm_nosuch, 0 }, /* 0x90 */
{chm_nosuch, 0 }, /* 0x91 */
{chm_nosuch, 0 }, /* 0x92 */
{chm_nosuch, 0 }, /* 0x93 */
{chm_nosuch, 0 }, /* 0x94 */
{chm_nosuch, 0 }, /* 0x95 */
{chm_nosuch, 0 }, /* 0x96 */
{chm_nosuch, 0 }, /* 0x97 */
{chm_nosuch, 0 }, /* 0x98 */
{chm_nosuch, 0 }, /* 0x99 */
{chm_nosuch, 0 }, /* 0x9a */
{chm_nosuch, 0 }, /* 0x9b */
{chm_nosuch, 0 }, /* 0x9c */
{chm_nosuch, 0 }, /* 0x9d */
{chm_nosuch, 0 }, /* 0x9e */
{chm_nosuch, 0 }, /* 0x9f */
{chm_nosuch, 0 }, /* 0xa0 */
{chm_nosuch, 0 }, /* 0xa1 */
{chm_nosuch, 0 }, /* 0xa2 */
{chm_nosuch, 0 }, /* 0xa3 */
{chm_nosuch, 0 }, /* 0xa4 */
{chm_nosuch, 0 }, /* 0xa5 */
{chm_nosuch, 0 }, /* 0xa6 */
{chm_nosuch, 0 }, /* 0xa7 */
{chm_nosuch, 0 }, /* 0xa8 */
{chm_nosuch, 0 }, /* 0xa9 */
{chm_nosuch, 0 }, /* 0xaa */
{chm_nosuch, 0 }, /* 0xab */
{chm_nosuch, 0 }, /* 0xac */
{chm_nosuch, 0 }, /* 0xad */
{chm_nosuch, 0 }, /* 0xae */
{chm_nosuch, 0 }, /* 0xaf */
{chm_nosuch, 0 }, /* 0xb0 */
{chm_nosuch, 0 }, /* 0xb1 */
{chm_nosuch, 0 }, /* 0xb2 */
{chm_nosuch, 0 }, /* 0xb3 */
{chm_nosuch, 0 }, /* 0xb4 */
{chm_nosuch, 0 }, /* 0xb5 */
{chm_nosuch, 0 }, /* 0xb6 */
{chm_nosuch, 0 }, /* 0xb7 */
{chm_nosuch, 0 }, /* 0xb8 */
{chm_nosuch, 0 }, /* 0xb9 */
{chm_nosuch, 0 }, /* 0xba */
{chm_nosuch, 0 }, /* 0xbb */
{chm_nosuch, 0 }, /* 0xbc */
{chm_nosuch, 0 }, /* 0xbd */
{chm_nosuch, 0 }, /* 0xbe */
{chm_nosuch, 0 }, /* 0xbf */
{chm_nosuch, 0 }, /* 0xc0 */
{chm_nosuch, 0 }, /* 0xc1 */
{chm_nosuch, 0 }, /* 0xc2 */
{chm_nosuch, 0 }, /* 0xc3 */
{chm_nosuch, 0 }, /* 0xc4 */
{chm_nosuch, 0 }, /* 0xc5 */
{chm_nosuch, 0 }, /* 0xc6 */
{chm_nosuch, 0 }, /* 0xc7 */
{chm_nosuch, 0 }, /* 0xc8 */
{chm_nosuch, 0 }, /* 0xc9 */
{chm_nosuch, 0 }, /* 0xca */
{chm_nosuch, 0 }, /* 0xcb */
{chm_nosuch, 0 }, /* 0xcc */
{chm_nosuch, 0 }, /* 0xcd */
{chm_nosuch, 0 }, /* 0xce */
{chm_nosuch, 0 }, /* 0xcf */
{chm_nosuch, 0 }, /* 0xd0 */
{chm_nosuch, 0 }, /* 0xd1 */
{chm_nosuch, 0 }, /* 0xd2 */
{chm_nosuch, 0 }, /* 0xd3 */
{chm_nosuch, 0 }, /* 0xd4 */
{chm_nosuch, 0 }, /* 0xd5 */
{chm_nosuch, 0 }, /* 0xd6 */
{chm_nosuch, 0 }, /* 0xd7 */
{chm_nosuch, 0 }, /* 0xd8 */
{chm_nosuch, 0 }, /* 0xd9 */
{chm_nosuch, 0 }, /* 0xda */
{chm_nosuch, 0 }, /* 0xdb */
{chm_nosuch, 0 }, /* 0xdc */
{chm_nosuch, 0 }, /* 0xdd */
{chm_nosuch, 0 }, /* 0xde */
{chm_nosuch, 0 }, /* 0xdf */
{chm_nosuch, 0 }, /* 0xe0 */
{chm_nosuch, 0 }, /* 0xe1 */
{chm_nosuch, 0 }, /* 0xe2 */
{chm_nosuch, 0 }, /* 0xe3 */
{chm_nosuch, 0 }, /* 0xe4 */
{chm_nosuch, 0 }, /* 0xe5 */
{chm_nosuch, 0 }, /* 0xe6 */
{chm_nosuch, 0 }, /* 0xe7 */
{chm_nosuch, 0 }, /* 0xe8 */
{chm_nosuch, 0 }, /* 0xe9 */
{chm_nosuch, 0 }, /* 0xea */
{chm_nosuch, 0 }, /* 0xeb */
{chm_nosuch, 0 }, /* 0xec */
{chm_nosuch, 0 }, /* 0xed */
{chm_nosuch, 0 }, /* 0xee */
{chm_nosuch, 0 }, /* 0xef */
{chm_nosuch, 0 }, /* 0xf0 */
{chm_nosuch, 0 }, /* 0xf1 */
{chm_nosuch, 0 }, /* 0xf2 */
{chm_nosuch, 0 }, /* 0xf3 */
{chm_nosuch, 0 }, /* 0xf4 */
{chm_nosuch, 0 }, /* 0xf5 */
{chm_nosuch, 0 }, /* 0xf6 */
{chm_nosuch, 0 }, /* 0xf7 */
{chm_nosuch, 0 }, /* 0xf8 */
{chm_nosuch, 0 }, /* 0xf9 */
{chm_nosuch, 0 }, /* 0xfa */
{chm_nosuch, 0 }, /* 0xfb */
{chm_nosuch, 0 }, /* 0xfc */
{chm_nosuch, 0 }, /* 0xfd */
{chm_nosuch, 0 }, /* 0xfe */
{chm_nosuch, 0 }, /* 0xff */
};
/* *INDENT-ON* */
/* set_channel_mode()
*
* inputs - client, source, channel, membership pointer, params

View file

@ -802,8 +802,7 @@ charybdis_main(int argc, char * const argv[])
init_reject();
init_cache();
init_monitor();
construct_cflags_strings();
chmode_init();
init_authd(); /* Start up authd. */
init_dns(); /* Start up DNS query system */

View file

@ -835,7 +835,7 @@ read_conf(void)
/* Some global values are also loaded here. */
check_class(); /* Make sure classes are valid */
privilegeset_delete_all_illegal();
construct_cflags_strings();
chmode_init();
}
static void

View file

@ -1341,7 +1341,7 @@ user_welcome(struct Client *source_p)
sendto_one_numeric(source_p, RPL_YOURHOST, form_str(RPL_YOURHOST),
get_listener_name(source_p->localClient->listener), ircd_version);
sendto_one_numeric(source_p, RPL_CREATED, form_str(RPL_CREATED), creation);
sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo);
sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, chmode_arity[0], chmode_arity[1]);
show_isupport(source_p);

View file

@ -237,11 +237,12 @@ isupport_chanmodes(const void *ptr)
{
static char result[80];
snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "",
ConfigChannel.use_forward ? "f" : "",
cflagsbuf);
snprintf(result, sizeof result, "%s,%s,%s,%s",
chmode_class[CHM_A],
chmode_class[CHM_B],
chmode_class[CHM_C],
chmode_class[CHM_D]);
return result;
}

View file

@ -66,7 +66,7 @@ chm_nocolour_process(hook_data_privmsg_channel *data)
static int
_modinit(void)
{
mode_nocolour = cflag_add('c', chm_simple);
mode_nocolour = cflag_add('c', CHM_D, chm_simple);
if (mode_nocolour == 0)
return -1;

View file

@ -66,7 +66,7 @@ chm_noctcp_process(hook_data_privmsg_channel *data)
static int
_modinit(void)
{
mode_noctcp = cflag_add('C', chm_simple);
mode_noctcp = cflag_add('C', CHM_D, chm_simple);
if (mode_noctcp == 0)
return -1;