supported: add chantypes_update()
This commit is contained in:
parent
f3b84221d0
commit
01978a2c8c
4 changed files with 28 additions and 12 deletions
|
@ -38,6 +38,7 @@ extern const void *change_isupport(const char *, const char *(*)(const void *),
|
||||||
extern void delete_isupport(const char *);
|
extern void delete_isupport(const char *);
|
||||||
extern void show_isupport(struct Client *);
|
extern void show_isupport(struct Client *);
|
||||||
extern void init_isupport(void);
|
extern void init_isupport(void);
|
||||||
|
extern void chantypes_update(void);
|
||||||
|
|
||||||
extern const char *isupport_intptr(const void *);
|
extern const char *isupport_intptr(const void *);
|
||||||
extern const char *isupport_boolean(const void *);
|
extern const char *isupport_boolean(const void *);
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
#include "s_assert.h"
|
#include "s_assert.h"
|
||||||
#include "authproc.h"
|
#include "authproc.h"
|
||||||
|
#include "supported.h"
|
||||||
|
|
||||||
struct config_server_hide ConfigServerHide;
|
struct config_server_hide ConfigServerHide;
|
||||||
|
|
||||||
|
@ -918,6 +919,12 @@ validate_conf(void)
|
||||||
splitmode = 0;
|
splitmode = 0;
|
||||||
splitchecking = 0;
|
splitchecking = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CharAttrs['&'] |= CHANPFX_C;
|
||||||
|
if (ConfigChannel.disable_local_channels)
|
||||||
|
CharAttrs['&'] &= ~CHANPFX_C;
|
||||||
|
|
||||||
|
chantypes_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add_temp_kline()
|
/* add_temp_kline()
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
#include "chmode.h"
|
#include "chmode.h"
|
||||||
#include "send.h"
|
#include "send.h"
|
||||||
|
|
||||||
|
static char allowed_chantypes[BUFSIZE];
|
||||||
rb_dlink_list isupportlist;
|
rb_dlink_list isupportlist;
|
||||||
|
|
||||||
struct isupportitem
|
struct isupportitem
|
||||||
|
@ -245,19 +246,12 @@ isupport_chanmodes(const void *ptr)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
isupport_chantypes(const void *ptr)
|
|
||||||
{
|
|
||||||
return ConfigChannel.disable_local_channels ? "#" : "&#";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
isupport_chanlimit(const void *ptr)
|
isupport_chanlimit(const void *ptr)
|
||||||
{
|
{
|
||||||
static char result[30];
|
static char result[30];
|
||||||
|
|
||||||
snprintf(result, sizeof result, "%s:%i",
|
snprintf(result, sizeof result, "%s:%i", allowed_chantypes, ConfigChannel.max_chans_per_user);
|
||||||
ConfigChannel.disable_local_channels ? "#" : "&#", ConfigChannel.max_chans_per_user);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +308,7 @@ init_isupport(void)
|
||||||
static int topiclen = TOPICLEN;
|
static int topiclen = TOPICLEN;
|
||||||
static int maxnicklen = NICKLEN - 1;
|
static int maxnicklen = NICKLEN - 1;
|
||||||
|
|
||||||
add_isupport("CHANTYPES", isupport_chantypes, NULL);
|
add_isupport("CHANTYPES", isupport_stringptr, &allowed_chantypes);
|
||||||
add_isupport("EXCEPTS", isupport_boolean, &ConfigChannel.use_except);
|
add_isupport("EXCEPTS", isupport_boolean, &ConfigChannel.use_except);
|
||||||
add_isupport("INVEX", isupport_boolean, &ConfigChannel.use_invex);
|
add_isupport("INVEX", isupport_boolean, &ConfigChannel.use_invex);
|
||||||
add_isupport("CHANMODES", isupport_chanmodes, NULL);
|
add_isupport("CHANMODES", isupport_chanmodes, NULL);
|
||||||
|
@ -335,3 +329,18 @@ init_isupport(void)
|
||||||
add_isupport("EXTBAN", isupport_extban, NULL);
|
add_isupport("EXTBAN", isupport_extban, NULL);
|
||||||
add_isupport("CLIENTVER", isupport_string, "3.0");
|
add_isupport("CLIENTVER", isupport_string, "3.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
chantypes_update(void)
|
||||||
|
{
|
||||||
|
unsigned char *p;
|
||||||
|
memset(allowed_chantypes, '\0', sizeof allowed_chantypes);
|
||||||
|
|
||||||
|
p = (unsigned char *) allowed_chantypes;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
if (IsChanPrefix(i))
|
||||||
|
*p++ = (unsigned char) i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -183,9 +183,8 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check it begins with # or &, and local chans are disabled */
|
/* check it begins with a valid channel prefix per policy. */
|
||||||
else if(!IsChannelName(name) ||
|
else if (!IsChannelName(name))
|
||||||
( ConfigChannel.disable_local_channels && name[0] == '&'))
|
|
||||||
{
|
{
|
||||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||||
form_str(ERR_NOSUCHCHANNEL), name);
|
form_str(ERR_NOSUCHCHANNEL), name);
|
||||||
|
|
Loading…
Reference in a new issue