3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 05:19:25 +01:00

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

View File

@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). For the purpo
New release of Oragono!
### Config Changes
* `channels` section added to control channel registration.
* `logging` key under `server` removed, replaced with `logging` section.
* `registration` and `authentication-enabled` keys moved under `accounts` section.
* `sts` section added under `server`.
@ -15,6 +16,7 @@ New release of Oragono!
### Security
### Added
* Added `ChanServ` service, to allow channel registration.
* Added `USERHOST` command (thanks @vegax87).
* Added draft IRCv3 capability [draft/sts](http://ircv3.net/specs/core/sts-3.3.html).

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()

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

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 {

View File

@ -135,6 +135,13 @@ accounts:
# is account authentication enabled?
authentication-enabled: true
# channel options
channels:
# channel registration - requires an account
registration:
# can users register new channels?
enabled: true
# operator classes
oper-classes:
# local operator