config: Allow enabling/disabling channel reg

This commit is contained in:
Daniel Oaks
2017-03-24 12:52:38 +10:00
parent ea748a9f7b
commit 70b7606996
5 changed files with 25 additions and 0 deletions
+5
View File
@@ -49,6 +49,11 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
return
}
if !server.channelRegistrationEnabled {
client.ChanServNotice("Channel registration is not enabled")
return
}
server.registeredChannelsMutex.Lock()
defer server.registeredChannelsMutex.Unlock()
+8
View File
@@ -72,6 +72,10 @@ type AccountRegistrationConfig struct {
}
}
type ChannelRegistrationConfig struct {
Enabled bool
}
type OperClassConfig struct {
Title string
WhoisLine string
@@ -188,6 +192,10 @@ type Config struct {
AuthenticationEnabled bool `yaml:"authentication-enabled"`
}
Channels struct {
Registration ChannelRegistrationConfig
}
OperClasses map[string]*OperClassConfig `yaml:"oper-classes"`
Opers map[string]*OperConfig
+3
View File
@@ -84,6 +84,7 @@ type Server struct {
accountAuthenticationEnabled bool
accountRegistration *AccountRegistration
accounts map[string]*ClientAccount
channelRegistrationEnabled bool
channels ChannelNameMap
checkIdent bool
clients *ClientLookupSet
@@ -190,6 +191,7 @@ func NewServer(configFilename string, config *Config, logger *logger.Manager) (*
server := &Server{
accountAuthenticationEnabled: config.Accounts.AuthenticationEnabled,
accounts: make(map[string]*ClientAccount),
channelRegistrationEnabled: config.Channels.Registration.Enabled,
channels: make(ChannelNameMap),
checkIdent: config.Server.CheckIdent,
clients: NewClientLookupSet(),
@@ -1424,6 +1426,7 @@ func (server *Server) rehash() error {
// registration
accountReg := NewAccountRegistration(config.Accounts.Registration)
server.accountRegistration = &accountReg
server.channelRegistrationEnabled = config.Channels.Registration.Enabled
// set new sendqueue size
if config.Server.MaxSendQBytes != server.MaxSendQBytes {