Borrow some ircd-seven code to create channel::use_local_channels.
This commit is contained in:
parent
7956414175
commit
0eceaff17a
|
@ -339,6 +339,7 @@ channel {
|
||||||
use_except = yes;
|
use_except = yes;
|
||||||
use_knock = yes;
|
use_knock = yes;
|
||||||
use_forward = yes;
|
use_forward = yes;
|
||||||
|
use_local_channels = yes;
|
||||||
knock_delay = 5 minutes;
|
knock_delay = 5 minutes;
|
||||||
knock_delay_channel = 1 minute;
|
knock_delay_channel = 1 minute;
|
||||||
max_chans_per_user = 15;
|
max_chans_per_user = 15;
|
||||||
|
|
|
@ -738,6 +738,12 @@ channel {
|
||||||
*/
|
*/
|
||||||
use_knock = yes;
|
use_knock = yes;
|
||||||
|
|
||||||
|
/* local channels: &Channel - a channel that exists only on one server
|
||||||
|
* people on other servers will not be able to see or join local channels
|
||||||
|
* from another server.
|
||||||
|
*/
|
||||||
|
use_local_channels = yes;
|
||||||
|
|
||||||
/* knock delay: The amount of time a user must wait between issuing
|
/* knock delay: The amount of time a user must wait between issuing
|
||||||
* the knock command.
|
* the knock command.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -228,6 +228,7 @@ struct config_channel_entry
|
||||||
int use_invex;
|
int use_invex;
|
||||||
int use_knock;
|
int use_knock;
|
||||||
int use_forward;
|
int use_forward;
|
||||||
|
int use_local_channels;
|
||||||
int knock_delay;
|
int knock_delay;
|
||||||
int knock_delay_channel;
|
int knock_delay_channel;
|
||||||
int max_bans;
|
int max_bans;
|
||||||
|
|
|
@ -608,6 +608,12 @@ static struct InfoStruct info_table[] = {
|
||||||
&ConfigChannel.use_knock,
|
&ConfigChannel.use_knock,
|
||||||
"Enable /KNOCK",
|
"Enable /KNOCK",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"use_local_channels",
|
||||||
|
OUTPUT_BOOLEAN_YN,
|
||||||
|
&ConfigChannel.use_local_channels,
|
||||||
|
"Enable local channels (&channels)"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resv_forcepart",
|
"resv_forcepart",
|
||||||
OUTPUT_BOOLEAN_YN,
|
OUTPUT_BOOLEAN_YN,
|
||||||
|
|
|
@ -1668,7 +1668,8 @@ void user_join(struct Client * client_p, struct Client * source_p, const char *
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check it begins with # or &, and local chans are disabled */
|
/* check it begins with # or &, and local chans are disabled */
|
||||||
else if(!IsChannelName(name))
|
else if(!IsChannelName(name) ||
|
||||||
|
( !ConfigChannel.use_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);
|
||||||
|
|
|
@ -2227,6 +2227,7 @@ static struct ConfEntry conf_channel_table[] =
|
||||||
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
|
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
|
||||||
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
|
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
|
||||||
{ "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward },
|
{ "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward },
|
||||||
|
{ "use_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.use_local_channels },
|
||||||
{ "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart },
|
{ "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart },
|
||||||
{ "kick_no_rejoin_time", CF_INT, NULL, 0, &ConfigChannel.kick_no_rejoin_time },
|
{ "kick_no_rejoin_time", CF_INT, NULL, 0, &ConfigChannel.kick_no_rejoin_time },
|
||||||
{ "\0", 0, NULL, 0, NULL }
|
{ "\0", 0, NULL, 0, NULL }
|
||||||
|
|
|
@ -753,6 +753,7 @@ set_default_conf(void)
|
||||||
ConfigChannel.use_invex = YES;
|
ConfigChannel.use_invex = YES;
|
||||||
ConfigChannel.use_knock = YES;
|
ConfigChannel.use_knock = YES;
|
||||||
ConfigChannel.use_forward = YES;
|
ConfigChannel.use_forward = YES;
|
||||||
|
ConfigChannel.use_local_channels = YES;
|
||||||
ConfigChannel.knock_delay = 300;
|
ConfigChannel.knock_delay = 300;
|
||||||
ConfigChannel.knock_delay_channel = 60;
|
ConfigChannel.knock_delay_channel = 60;
|
||||||
ConfigChannel.max_chans_per_user = 15;
|
ConfigChannel.max_chans_per_user = 15;
|
||||||
|
|
|
@ -244,12 +244,20 @@ isupport_chanmodes(const void *ptr)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
isupport_chantypes(const void *ptr)
|
||||||
|
{
|
||||||
|
return ConfigChannel.use_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];
|
||||||
|
|
||||||
rb_snprintf(result, sizeof result, "&#:%i", ConfigChannel.max_chans_per_user);
|
rb_snprintf(result, sizeof result, "%s:%i",
|
||||||
|
ConfigChannel.use_local_channels ? "&#" : "#",
|
||||||
|
ConfigChannel.max_chans_per_user);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +318,7 @@ init_isupport(void)
|
||||||
static int channellen = LOC_CHANNELLEN;
|
static int channellen = LOC_CHANNELLEN;
|
||||||
static int topiclen = TOPICLEN;
|
static int topiclen = TOPICLEN;
|
||||||
|
|
||||||
add_isupport("CHANTYPES", isupport_string, "&#");
|
add_isupport("CHANTYPES", isupport_chantypes, NULL);
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue