Pārlūkot izejas kodu

config: Allow enabling/disabling channel reg

tags/v0.7.0
Daniel Oaks 7 gadus atpakaļ
vecāks
revīzija
70b7606996
5 mainītis faili ar 25 papildinājumiem un 0 dzēšanām
  1. 2
    0
      CHANGELOG.md
  2. 5
    0
      irc/chanserv.go
  3. 8
    0
      irc/config.go
  4. 3
    0
      irc/server.go
  5. 7
    0
      oragono.yaml

+ 2
- 0
CHANGELOG.md Parādīt failu

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

+ 5
- 0
irc/chanserv.go Parādīt failu

@@ -49,6 +49,11 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
49 49
 			return
50 50
 		}
51 51
 
52
+		if !server.channelRegistrationEnabled {
53
+			client.ChanServNotice("Channel registration is not enabled")
54
+			return
55
+		}
56
+
52 57
 		server.registeredChannelsMutex.Lock()
53 58
 		defer server.registeredChannelsMutex.Unlock()
54 59
 

+ 8
- 0
irc/config.go Parādīt failu

@@ -72,6 +72,10 @@ type AccountRegistrationConfig struct {
72 72
 	}
73 73
 }
74 74
 
75
+type ChannelRegistrationConfig struct {
76
+	Enabled bool
77
+}
78
+
75 79
 type OperClassConfig struct {
76 80
 	Title        string
77 81
 	WhoisLine    string
@@ -188,6 +192,10 @@ type Config struct {
188 192
 		AuthenticationEnabled bool `yaml:"authentication-enabled"`
189 193
 	}
190 194
 
195
+	Channels struct {
196
+		Registration ChannelRegistrationConfig
197
+	}
198
+
191 199
 	OperClasses map[string]*OperClassConfig `yaml:"oper-classes"`
192 200
 
193 201
 	Opers map[string]*OperConfig

+ 3
- 0
irc/server.go Parādīt failu

@@ -84,6 +84,7 @@ type Server struct {
84 84
 	accountAuthenticationEnabled bool
85 85
 	accountRegistration          *AccountRegistration
86 86
 	accounts                     map[string]*ClientAccount
87
+	channelRegistrationEnabled   bool
87 88
 	channels                     ChannelNameMap
88 89
 	checkIdent                   bool
89 90
 	clients                      *ClientLookupSet
@@ -190,6 +191,7 @@ func NewServer(configFilename string, config *Config, logger *logger.Manager) (*
190 191
 	server := &Server{
191 192
 		accountAuthenticationEnabled: config.Accounts.AuthenticationEnabled,
192 193
 		accounts:                     make(map[string]*ClientAccount),
194
+		channelRegistrationEnabled:   config.Channels.Registration.Enabled,
193 195
 		channels:                     make(ChannelNameMap),
194 196
 		checkIdent:                   config.Server.CheckIdent,
195 197
 		clients:                      NewClientLookupSet(),
@@ -1424,6 +1426,7 @@ func (server *Server) rehash() error {
1424 1426
 	// registration
1425 1427
 	accountReg := NewAccountRegistration(config.Accounts.Registration)
1426 1428
 	server.accountRegistration = &accountReg
1429
+	server.channelRegistrationEnabled = config.Channels.Registration.Enabled
1427 1430
 
1428 1431
 	// set new sendqueue size
1429 1432
 	if config.Server.MaxSendQBytes != server.MaxSendQBytes {

+ 7
- 0
oragono.yaml Parādīt failu

@@ -135,6 +135,13 @@ accounts:
135 135
     # is account authentication enabled?
136 136
     authentication-enabled: true
137 137
 
138
+# channel options
139
+channels:
140
+    # channel registration - requires an account
141
+    registration:
142
+        # can users register new channels?
143
+        enabled: true
144
+
138 145
 # operator classes
139 146
 oper-classes:
140 147
     # local operator

Notiek ielāde…
Atcelt
Saglabāt