autochanmodes support

This commit is contained in:
JD Horelick 2010-02-24 22:18:13 -05:00
parent 44a8fbc29e
commit 13ec57db15
8 changed files with 31 additions and 3 deletions

View File

@ -2,7 +2,6 @@ Todo list for Shadowircd 6.0
----------------------------- -----------------------------
* swhois support * swhois support
* custom operstrings (?) * custom operstrings (?)
* autochanmodes defined in the .conf (cmodes that are set on a channel on initial join.)
* halfops - probably enabled/disabled via a configure switch on in the .conf * halfops - probably enabled/disabled via a configure switch on in the .conf
* owner/+a prefix/cmode - see comment for halfops :D * owner/+a prefix/cmode - see comment for halfops :D
* "soft" callerid umode (+G, only allows PM's from users in the same channel as you) * "soft" callerid umode (+G, only allows PM's from users in the same channel as you)

View File

@ -326,6 +326,7 @@ exempt {
}; };
channel { channel {
autochanmodes = "nt";
use_invex = yes; use_invex = yes;
use_except = yes; use_except = yes;
use_knock = yes; use_knock = yes;

View File

@ -673,6 +673,11 @@ exempt {
/* The channel block contains options pertaining to channels */ /* The channel block contains options pertaining to channels */
channel { channel {
/* autochanmodes: Modes that will be set on a unregistered channel
* when the first user joins it.
*/
autochanmodes = "nt";
/* invex: Enable/disable channel mode +I, a n!u@h list of masks /* invex: Enable/disable channel mode +I, a n!u@h list of masks
* that can join a +i channel without an invite. * that can join a +i channel without an invite.
*/ */

View File

@ -222,6 +222,7 @@ struct config_file_entry
struct config_channel_entry struct config_channel_entry
{ {
char * autochanmodes;
int use_except; int use_except;
int use_invex; int use_invex;
int use_knock; int use_knock;

View File

@ -332,6 +332,12 @@ static struct InfoStruct info_table[] = {
&ServerInfo.network_desc, &ServerInfo.network_desc,
"Network description" "Network description"
}, },
{
"autochanmodes",
OUTPUT_STRING,
&ConfigChannel.autochanmodes,
"Channelmodes set on channel creation"
},
{ {
"nick_delay", "nick_delay",
OUTPUT_DECIMAL, OUTPUT_DECIMAL,

View File

@ -1679,8 +1679,22 @@ void user_join(struct Client * client_p, struct Client * source_p, const char *
if(flags & CHFL_CHANOP) if(flags & CHFL_CHANOP)
{ {
chptr->channelts = rb_current_time(); chptr->channelts = rb_current_time();
/* autochanmodes stuff */
if(ConfigChannel.autochanmodes)
{
char * ch;
for(ch = ConfigChannel.autochanmodes; *ch; *ch++)
{
chptr->mode.mode |= chmode_table[*ch].mode_type;
}
}
else
{
chptr->mode.mode |= MODE_TOPICLIMIT; chptr->mode.mode |= MODE_TOPICLIMIT;
chptr->mode.mode |= MODE_NOPRIVMSGS; chptr->mode.mode |= MODE_NOPRIVMSGS;
}
modes = channel_modes(chptr, &me); modes = channel_modes(chptr, &me);
sendto_channel_local(ONLY_CHANOPS, chptr, ":%s MODE %s %s", sendto_channel_local(ONLY_CHANOPS, chptr, ":%s MODE %s %s",

View File

@ -2200,6 +2200,7 @@ static struct ConfEntry conf_general_table[] =
static struct ConfEntry conf_channel_table[] = static struct ConfEntry conf_channel_table[] =
{ {
{ "autochanmodes", CF_QSTRING, NULL, 0, &ConfigChannel.autochanmodes },
{ "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count }, { "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count },
{ "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count }, { "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count },
{ "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho }, { "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho },

View File

@ -746,6 +746,7 @@ set_default_conf(void)
ConfigFileEntry.oper_only_umodes = UMODE_SERVNOTICE; ConfigFileEntry.oper_only_umodes = UMODE_SERVNOTICE;
ConfigFileEntry.oper_snomask = SNO_GENERAL; ConfigFileEntry.oper_snomask = SNO_GENERAL;
ConfigChannel.autochanmodes = rb_strdup("nt");
ConfigChannel.use_except = YES; ConfigChannel.use_except = YES;
ConfigChannel.use_invex = YES; ConfigChannel.use_invex = YES;
ConfigChannel.use_knock = YES; ConfigChannel.use_knock = YES;