Put back use_forward.

This commit is contained in:
Jilles Tjoelker 2011-09-25 16:22:29 +02:00
parent 93fbe9c349
commit 2da6f6ebd7
11 changed files with 47 additions and 6 deletions

View file

@ -325,6 +325,7 @@ exempt {
channel { channel {
use_invex = yes; use_invex = yes;
use_except = yes; use_except = yes;
use_forward = yes;
use_knock = yes; use_knock = yes;
knock_delay = 5 minutes; knock_delay = 5 minutes;
knock_delay_channel = 1 minute; knock_delay_channel = 1 minute;

View file

@ -679,6 +679,12 @@ channel {
*/ */
use_except = yes; use_except = yes;
/* forward: Enable/disable channel mode +f, a channel to forward
* users to if they can't join because of +i etc. Also enables ban
* forwarding, <mask>$<channel>.
*/
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

@ -237,6 +237,7 @@ struct config_channel_entry
{ {
int use_except; int use_except;
int use_invex; int use_invex;
int use_forward;
int use_knock; int use_knock;
int knock_delay; int knock_delay;
int knock_delay_channel; int knock_delay_channel;

View file

@ -1125,7 +1125,8 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time); len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time);
pbuf += len; pbuf += len;
} }
if(mode->forward[0] && strcmp(oldmode->forward, mode->forward)) if(mode->forward[0] && strcmp(oldmode->forward, mode->forward) &&
ConfigChannel.use_forward)
{ {
if(dir != MODE_ADD) if(dir != MODE_ADD)
{ {

View file

@ -602,6 +602,12 @@ static struct InfoStruct info_table[] = {
&ConfigChannel.use_invex, &ConfigChannel.use_invex,
"Enable chanmode +I (invite exceptions)", "Enable chanmode +I (invite exceptions)",
}, },
{
"use_forward",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_forward,
"Enable chanmode +f (channel forwarding)",
},
{ {
"use_knock", "use_knock",
OUTPUT_BOOLEAN_YN, OUTPUT_BOOLEAN_YN,

View file

@ -1236,7 +1236,8 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
chptr->mode.join_time); chptr->mode.join_time);
} }
if(*chptr->mode.forward) if(*chptr->mode.forward &&
(ConfigChannel.use_forward || !IsClient(client_p)))
{ {
*mbuf++ = 'f'; *mbuf++ = 'f';

View file

@ -106,8 +106,9 @@ construct_cflags_strings(void)
{ {
case MODE_EXLIMIT: case MODE_EXLIMIT:
case MODE_DISFORWARD: case MODE_DISFORWARD:
/* TODO FIXME: make use_forward work again */ if(ConfigChannel.use_forward)
*ptr++ = (char) i; *ptr++ = (char) i;
break;
case MODE_REGONLY: case MODE_REGONLY:
if(rb_dlink_list_length(&service_list)) if(rb_dlink_list_length(&service_list))
{ {
@ -552,6 +553,11 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
/* setting + */ /* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type)) if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{ {
/* if +f is disabled, ignore an attempt to set +QF locally */
if(!ConfigChannel.use_forward && MyClient(source_p) &&
(c == 'Q' || c == 'F'))
return;
chptr->mode.mode |= mode_type; chptr->mode.mode |= mode_type;
mode_changes[mode_count].letter = c; mode_changes[mode_count].letter = c;
@ -829,6 +835,10 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
return; return;
} }
if(forward != NULL && !ConfigChannel.use_forward &&
MyClient(source_p))
forward = NULL;
/* dont allow local clients to overflow the banlist, dont /* dont allow local clients to overflow the banlist, dont
* let remote servers set duplicate bans * let remote servers set duplicate bans
*/ */
@ -1176,6 +1186,11 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
struct membership *msptr; struct membership *msptr;
const char *forward; const char *forward;
/* if +f is disabled, ignore local attempts to set it */
if(!ConfigChannel.use_forward && MyClient(source_p) &&
(dir == MODE_ADD) && (parc > *parn))
return;
if(dir == MODE_QUERY || (dir == MODE_ADD && parc <= *parn)) if(dir == MODE_QUERY || (dir == MODE_ADD && parc <= *parn))
{ {
if (!(*errors & SM_ERR_RPL_F)) if (!(*errors & SM_ERR_RPL_F))
@ -1254,7 +1269,8 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].dir = MODE_ADD; mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0; mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0; mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS; mode_changes[mode_count].mems =
ConfigChannel.use_forward ? ALL_MEMBERS : ONLY_SERVERS;
mode_changes[mode_count].id = NULL; mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = forward; mode_changes[mode_count++].arg = forward;
} }

View file

@ -2275,6 +2275,7 @@ static struct ConfEntry conf_channel_table[] =
{ "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels }, { "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels },
{ "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except }, { "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except },
{ "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex }, { "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex },
{ "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward },
{ "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock }, { "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock },
{ "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart }, { "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart },
{ "channel_target_change", CF_YESNO, NULL, 0, &ConfigChannel.channel_target_change }, { "channel_target_change", CF_YESNO, NULL, 0, &ConfigChannel.channel_target_change },

View file

@ -756,6 +756,7 @@ set_default_conf(void)
ConfigChannel.use_except = YES; ConfigChannel.use_except = YES;
ConfigChannel.use_invex = YES; ConfigChannel.use_invex = YES;
ConfigChannel.use_forward = YES;
ConfigChannel.use_knock = YES; ConfigChannel.use_knock = YES;
ConfigChannel.knock_delay = 300; ConfigChannel.knock_delay = 300;
ConfigChannel.knock_delay_channel = 60; ConfigChannel.knock_delay_channel = 60;

View file

@ -1073,6 +1073,12 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
if (MyConnect(source_p) && *pm == 'Q' && !ConfigChannel.use_forward)
{
badflag = YES;
break;
}
if((flag = user_modes[(unsigned char) *pm])) if((flag = user_modes[(unsigned char) *pm]))
{ {
if(MyConnect(source_p) if(MyConnect(source_p)

View file

@ -228,9 +228,10 @@ isupport_chanmodes(const void *ptr)
{ {
static char result[80]; static char result[80];
rb_snprintf(result, sizeof result, "%s%sbq,k,flj,%s", rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
ConfigChannel.use_except ? "e" : "", ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "", ConfigChannel.use_invex ? "I" : "",
ConfigChannel.use_forward ? "f" : "",
cflagsbuf); cflagsbuf);
return result; return result;
} }