Borrow some ircd-seven code to create channel::use_local_channels.

This commit is contained in:
B.Greenham 2010-02-28 22:42:59 -05:00
parent 7956414175
commit 0eceaff17a
8 changed files with 28 additions and 3 deletions

View File

@ -339,6 +339,7 @@ channel {
use_except = yes;
use_knock = yes;
use_forward = yes;
use_local_channels = yes;
knock_delay = 5 minutes;
knock_delay_channel = 1 minute;
max_chans_per_user = 15;

View File

@ -738,6 +738,12 @@ channel {
*/
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
* the knock command.
*/

View File

@ -228,6 +228,7 @@ struct config_channel_entry
int use_invex;
int use_knock;
int use_forward;
int use_local_channels;
int knock_delay;
int knock_delay_channel;
int max_bans;

View File

@ -608,6 +608,12 @@ static struct InfoStruct info_table[] = {
&ConfigChannel.use_knock,
"Enable /KNOCK",
},
{
"use_local_channels",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_local_channels,
"Enable local channels (&channels)"
},
{
"resv_forcepart",
OUTPUT_BOOLEAN_YN,

View File

@ -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 */
else if(!IsChannelName(name))
else if(!IsChannelName(name) ||
( !ConfigChannel.use_local_channels && name[0] == '&'))
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name);

View File

@ -2227,6 +2227,7 @@ static struct ConfEntry conf_channel_table[] =
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
{ "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 },
{ "kick_no_rejoin_time", CF_INT, NULL, 0, &ConfigChannel.kick_no_rejoin_time },
{ "\0", 0, NULL, 0, NULL }

View File

@ -753,6 +753,7 @@ set_default_conf(void)
ConfigChannel.use_invex = YES;
ConfigChannel.use_knock = YES;
ConfigChannel.use_forward = YES;
ConfigChannel.use_local_channels = YES;
ConfigChannel.knock_delay = 300;
ConfigChannel.knock_delay_channel = 60;
ConfigChannel.max_chans_per_user = 15;

View File

@ -244,12 +244,20 @@ isupport_chanmodes(const void *ptr)
return result;
}
static const char *
isupport_chantypes(const void *ptr)
{
return ConfigChannel.use_local_channels ? "&#" : "#";
}
static const char *
isupport_chanlimit(const void *ptr)
{
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;
}
@ -310,7 +318,7 @@ init_isupport(void)
static int channellen = LOC_CHANNELLEN;
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("INVEX", isupport_boolean, &ConfigChannel.use_invex);
add_isupport("CHANMODES", isupport_chanmodes, NULL);