Bladeren bron

rename 'bouncer' to 'multiclient'

tags/v2.0.0-rc1
Shivaram Lingamneni 4 jaren geleden
bovenliggende
commit
f5ca35ed72
9 gewijzigde bestanden met toevoegingen van 53 en 68 verwijderingen
  1. 0
    6
      gencapdefs.py
  2. 9
    7
      irc/accounts.go
  3. 1
    6
      irc/caps/defs.go
  4. 4
    6
      irc/client_lookup_set.go
  5. 12
    17
      irc/config.go
  6. 2
    2
      irc/database.go
  7. 2
    2
      irc/getters.go
  8. 19
    19
      irc/nickserv.go
  9. 4
    3
      oragono.yaml

+ 0
- 6
gencapdefs.py Bestand weergeven

135
         url="https://ircv3.net/specs/extensions/userhost-in-names-3.2.html",
135
         url="https://ircv3.net/specs/extensions/userhost-in-names-3.2.html",
136
         standard="IRCv3",
136
         standard="IRCv3",
137
     ),
137
     ),
138
-    CapDef(
139
-        identifier="Bouncer",
140
-        name="oragono.io/bnc",
141
-        url="https://oragono.io/bnc",
142
-        standard="Oragono-specific",
143
-    ),
144
     CapDef(
138
     CapDef(
145
         identifier="ZNCSelfMessage",
139
         identifier="ZNCSelfMessage",
146
         name="znc.in/self-message",
140
         name="znc.in/self-message",

+ 9
- 7
irc/accounts.go Bestand weergeven

77
 }
77
 }
78
 
78
 
79
 func (am *AccountManager) createAlwaysOnClients(config *Config) {
79
 func (am *AccountManager) createAlwaysOnClients(config *Config) {
80
-	if config.Accounts.Bouncer.AlwaysOn == PersistentDisabled {
80
+	if config.Accounts.Multiclient.AlwaysOn == PersistentDisabled {
81
 		return
81
 		return
82
 	}
82
 	}
83
 
83
 
103
 	for _, accountName := range accounts {
103
 	for _, accountName := range accounts {
104
 		account, err := am.LoadAccount(accountName)
104
 		account, err := am.LoadAccount(accountName)
105
 		if err == nil && account.Verified &&
105
 		if err == nil && account.Verified &&
106
-			persistenceEnabled(config.Accounts.Bouncer.AlwaysOn, account.Settings.AlwaysOn) {
106
+			persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, account.Settings.AlwaysOn) {
107
 			am.server.AddAlwaysOnClient(account, am.loadChannels(accountName), am.loadLastSignoff(accountName))
107
 			am.server.AddAlwaysOnClient(account, am.loadChannels(accountName), am.loadLastSignoff(accountName))
108
 		}
108
 		}
109
 	}
109
 	}
1676
 	return nil
1676
 	return nil
1677
 }
1677
 }
1678
 
1678
 
1679
-type BouncerAllowedSetting int
1679
+type MulticlientAllowedSetting int
1680
 
1680
 
1681
 const (
1681
 const (
1682
-	BouncerAllowedServerDefault BouncerAllowedSetting = iota
1683
-	BouncerDisallowedByUser
1684
-	BouncerAllowedByUser
1682
+	MulticlientAllowedServerDefault MulticlientAllowedSetting = iota
1683
+	MulticlientDisallowedByUser
1684
+	MulticlientAllowedByUser
1685
 )
1685
 )
1686
 
1686
 
1687
 // controls whether/when clients without event-playback support see fake
1687
 // controls whether/when clients without event-playback support see fake
1708
 	return
1708
 	return
1709
 }
1709
 }
1710
 
1710
 
1711
+// XXX: AllowBouncer cannot be renamed AllowMulticlient because it is stored in
1712
+// persistent JSON blobs in the database
1711
 type AccountSettings struct {
1713
 type AccountSettings struct {
1712
 	AutoreplayLines  *int
1714
 	AutoreplayLines  *int
1713
 	NickEnforcement  NickEnforcementMethod
1715
 	NickEnforcement  NickEnforcementMethod
1714
-	AllowBouncer     BouncerAllowedSetting
1716
+	AllowBouncer     MulticlientAllowedSetting
1715
 	ReplayJoins      ReplayJoinsSetting
1717
 	ReplayJoins      ReplayJoinsSetting
1716
 	AlwaysOn         PersistentStatus
1718
 	AlwaysOn         PersistentStatus
1717
 	AutoreplayMissed bool
1719
 	AutoreplayMissed bool

+ 1
- 6
irc/caps/defs.go Bestand weergeven

7
 
7
 
8
 const (
8
 const (
9
 	// number of recognized capabilities:
9
 	// number of recognized capabilities:
10
-	numCapabs = 27
10
+	numCapabs = 26
11
 	// length of the uint64 array that represents the bitset:
11
 	// length of the uint64 array that represents the bitset:
12
 	bitsetLen = 1
12
 	bitsetLen = 1
13
 )
13
 )
89
 	// https://ircv3.net/specs/extensions/multi-prefix-3.1.html
89
 	// https://ircv3.net/specs/extensions/multi-prefix-3.1.html
90
 	MultiPrefix Capability = iota
90
 	MultiPrefix Capability = iota
91
 
91
 
92
-	// Bouncer is the Oragono-specific capability named "oragono.io/bnc":
93
-	// https://oragono.io/bnc
94
-	Bouncer Capability = iota
95
-
96
 	// Nope is the Oragono vendor capability named "oragono.io/nope":
92
 	// Nope is the Oragono vendor capability named "oragono.io/nope":
97
 	// https://oragono.io/nope
93
 	// https://oragono.io/nope
98
 	Nope Capability = iota
94
 	Nope Capability = iota
144
 		"labeled-response",
140
 		"labeled-response",
145
 		"message-tags",
141
 		"message-tags",
146
 		"multi-prefix",
142
 		"multi-prefix",
147
-		"oragono.io/bnc",
148
 		"oragono.io/nope",
143
 		"oragono.io/nope",
149
 		"sasl",
144
 		"sasl",
150
 		"server-time",
145
 		"server-time",

+ 4
- 6
irc/client_lookup_set.go Bestand weergeven

142
 	client.stateMutex.RUnlock()
142
 	client.stateMutex.RUnlock()
143
 
143
 
144
 	// recompute this (client.alwaysOn is not set for unregistered clients):
144
 	// recompute this (client.alwaysOn is not set for unregistered clients):
145
-	alwaysOn := account != "" && persistenceEnabled(config.Accounts.Bouncer.AlwaysOn, settings.AlwaysOn)
145
+	alwaysOn := account != "" && persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
146
 
146
 
147
 	if alwaysOn && registered {
147
 	if alwaysOn && registered {
148
 		return "", errCantChangeNick
148
 		return "", errCantChangeNick
149
 	}
149
 	}
150
 
150
 
151
 	var bouncerAllowed bool
151
 	var bouncerAllowed bool
152
-	if config.Accounts.Bouncer.Enabled {
152
+	if config.Accounts.Multiclient.Enabled {
153
 		if alwaysOn {
153
 		if alwaysOn {
154
 			// ignore the pre-reg nick, force a reattach
154
 			// ignore the pre-reg nick, force a reattach
155
 			newNick = accountName
155
 			newNick = accountName
156
 			newcfnick = account
156
 			newcfnick = account
157
 			bouncerAllowed = true
157
 			bouncerAllowed = true
158
-		} else if session != nil && session.capabilities.Has(caps.Bouncer) {
159
-			bouncerAllowed = true
160
 		} else {
158
 		} else {
161
-			if config.Accounts.Bouncer.AllowedByDefault && settings.AllowBouncer != BouncerDisallowedByUser {
159
+			if config.Accounts.Multiclient.AllowedByDefault && settings.AllowBouncer != MulticlientDisallowedByUser {
162
 				bouncerAllowed = true
160
 				bouncerAllowed = true
163
-			} else if settings.AllowBouncer == BouncerAllowedByUser {
161
+			} else if settings.AllowBouncer == MulticlientAllowedByUser {
164
 				bouncerAllowed = true
162
 				bouncerAllowed = true
165
 			}
163
 			}
166
 		}
164
 		}

+ 12
- 17
irc/config.go Bestand weergeven

207
 	}
207
 	}
208
 }
208
 }
209
 
209
 
210
+type MulticlientConfig struct {
211
+	Enabled          bool
212
+	AllowedByDefault bool             `yaml:"allowed-by-default"`
213
+	AlwaysOn         PersistentStatus `yaml:"always-on"`
214
+}
215
+
210
 type AccountConfig struct {
216
 type AccountConfig struct {
211
 	Registration          AccountRegistrationConfig
217
 	Registration          AccountRegistrationConfig
212
 	AuthenticationEnabled bool `yaml:"authentication-enabled"`
218
 	AuthenticationEnabled bool `yaml:"authentication-enabled"`
223
 	} `yaml:"login-throttling"`
229
 	} `yaml:"login-throttling"`
224
 	SkipServerPassword bool                  `yaml:"skip-server-password"`
230
 	SkipServerPassword bool                  `yaml:"skip-server-password"`
225
 	NickReservation    NickReservationConfig `yaml:"nick-reservation"`
231
 	NickReservation    NickReservationConfig `yaml:"nick-reservation"`
226
-	Bouncer            struct {
227
-		Enabled          bool
228
-		AllowedByDefault bool             `yaml:"allowed-by-default"`
229
-		AlwaysOn         PersistentStatus `yaml:"always-on"`
230
-	}
231
-	VHosts VHostConfig
232
+	Multiclient        MulticlientConfig
233
+	VHosts             VHostConfig
232
 }
234
 }
233
 
235
 
234
 // AccountRegistrationConfig controls account registration.
236
 // AccountRegistrationConfig controls account registration.
878
 		config.Server.capValues[caps.Multiline] = multilineCapValue
880
 		config.Server.capValues[caps.Multiline] = multilineCapValue
879
 	}
881
 	}
880
 
882
 
881
-	if !config.Accounts.Bouncer.Enabled {
882
-		config.Accounts.Bouncer.AlwaysOn = PersistentDisabled
883
-		config.Server.supportedCaps.Disable(caps.Bouncer)
884
-	} else if config.Accounts.Bouncer.AlwaysOn >= PersistentOptOut {
885
-		config.Accounts.Bouncer.AllowedByDefault = true
883
+	if !config.Accounts.Multiclient.Enabled {
884
+		config.Accounts.Multiclient.AlwaysOn = PersistentDisabled
885
+	} else if config.Accounts.Multiclient.AlwaysOn >= PersistentOptOut {
886
+		config.Accounts.Multiclient.AllowedByDefault = true
886
 	}
887
 	}
887
 
888
 
888
 	var newLogConfigs []logger.LoggingConfig
889
 	var newLogConfigs []logger.LoggingConfig
1148
 		removedCaps.Add(caps.SASL)
1149
 		removedCaps.Add(caps.SASL)
1149
 	}
1150
 	}
1150
 
1151
 
1151
-	if !oldConfig.Accounts.Bouncer.Enabled && config.Accounts.Bouncer.Enabled {
1152
-		addedCaps.Add(caps.Bouncer)
1153
-	} else if oldConfig.Accounts.Bouncer.Enabled && !config.Accounts.Bouncer.Enabled {
1154
-		removedCaps.Add(caps.Bouncer)
1155
-	}
1156
-
1157
 	if oldConfig.Limits.Multiline.MaxBytes != 0 && config.Limits.Multiline.MaxBytes == 0 {
1152
 	if oldConfig.Limits.Multiline.MaxBytes != 0 && config.Limits.Multiline.MaxBytes == 0 {
1158
 		removedCaps.Add(caps.Multiline)
1153
 		removedCaps.Add(caps.Multiline)
1159
 	} else if oldConfig.Limits.Multiline.MaxBytes == 0 && config.Limits.Multiline.MaxBytes != 0 {
1154
 	} else if oldConfig.Limits.Multiline.MaxBytes == 0 && config.Limits.Multiline.MaxBytes != 0 {

+ 2
- 2
irc/database.go Bestand weergeven

487
 type accountSettingsLegacyV7 struct {
487
 type accountSettingsLegacyV7 struct {
488
 	AutoreplayLines *int
488
 	AutoreplayLines *int
489
 	NickEnforcement NickEnforcementMethod
489
 	NickEnforcement NickEnforcementMethod
490
-	AllowBouncer    BouncerAllowedSetting
490
+	AllowBouncer    MulticlientAllowedSetting
491
 	AutoreplayJoins bool
491
 	AutoreplayJoins bool
492
 }
492
 }
493
 
493
 
494
 type accountSettingsLegacyV8 struct {
494
 type accountSettingsLegacyV8 struct {
495
 	AutoreplayLines *int
495
 	AutoreplayLines *int
496
 	NickEnforcement NickEnforcementMethod
496
 	NickEnforcement NickEnforcementMethod
497
-	AllowBouncer    BouncerAllowedSetting
497
+	AllowBouncer    MulticlientAllowedSetting
498
 	ReplayJoins     ReplayJoinsSetting
498
 	ReplayJoins     ReplayJoinsSetting
499
 }
499
 }
500
 
500
 

+ 2
- 2
irc/getters.go Bestand weergeven

287
 }
287
 }
288
 
288
 
289
 func (client *Client) Login(account ClientAccount) {
289
 func (client *Client) Login(account ClientAccount) {
290
-	alwaysOn := persistenceEnabled(client.server.Config().Accounts.Bouncer.AlwaysOn, account.Settings.AlwaysOn)
290
+	alwaysOn := persistenceEnabled(client.server.Config().Accounts.Multiclient.AlwaysOn, account.Settings.AlwaysOn)
291
 	client.stateMutex.Lock()
291
 	client.stateMutex.Lock()
292
 	defer client.stateMutex.Unlock()
292
 	defer client.stateMutex.Unlock()
293
 	client.account = account.NameCasefolded
293
 	client.account = account.NameCasefolded
329
 }
329
 }
330
 
330
 
331
 func (client *Client) SetAccountSettings(settings AccountSettings) {
331
 func (client *Client) SetAccountSettings(settings AccountSettings) {
332
-	alwaysOn := persistenceEnabled(client.server.Config().Accounts.Bouncer.AlwaysOn, settings.AlwaysOn)
332
+	alwaysOn := persistenceEnabled(client.server.Config().Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
333
 	client.stateMutex.Lock()
333
 	client.stateMutex.Lock()
334
 	client.accountSettings = settings
334
 	client.accountSettings = settings
335
 	if client.registered {
335
 	if client.registered {

+ 19
- 19
irc/nickserv.go Bestand weergeven

31
 }
31
 }
32
 
32
 
33
 func servCmdRequiresBouncerEnabled(config *Config) bool {
33
 func servCmdRequiresBouncerEnabled(config *Config) bool {
34
-	return config.Accounts.Bouncer.Enabled
34
+	return config.Accounts.Multiclient.Enabled
35
 }
35
 }
36
 
36
 
37
 const (
37
 const (
147
 			help: `Syntax: $bSESSIONS [nickname]$b
147
 			help: `Syntax: $bSESSIONS [nickname]$b
148
 
148
 
149
 SESSIONS lists information about the sessions currently attached, via
149
 SESSIONS lists information about the sessions currently attached, via
150
-the server's bouncer functionality, to your nickname. An administrator
150
+the server's multiclient functionality, to your nickname. An administrator
151
 can use this command to list another user's sessions.`,
151
 can use this command to list another user's sessions.`,
152
 			helpShort: `$bSESSIONS$b lists the sessions attached to a nickname.`,
152
 			helpShort: `$bSESSIONS$b lists the sessions attached to a nickname.`,
153
 			enabled:   servCmdRequiresBouncerEnabled,
153
 			enabled:   servCmdRequiresBouncerEnabled,
228
 3. 'strict'  [you must already be authenticated to use the nick]
228
 3. 'strict'  [you must already be authenticated to use the nick]
229
 4. 'default' [use the server default]`,
229
 4. 'default' [use the server default]`,
230
 
230
 
231
-				`$bBOUNCER$b
232
-If 'bouncer' is enabled and you are already logged in and using a nick, a
231
+				`$bMULTICLIENT$b
232
+If 'multiclient' is enabled and you are already logged in and using a nick, a
233
 second client of yours that authenticates with SASL and requests the same nick
233
 second client of yours that authenticates with SASL and requests the same nick
234
 is allowed to attach to the nick as well (this is comparable to the behavior
234
 is allowed to attach to the nick as well (this is comparable to the behavior
235
 of IRC "bouncers" like ZNC). Your options are 'on' (allow this behavior),
235
 of IRC "bouncers" like ZNC). Your options are 'on' (allow this behavior),
348
 		case ReplayJoinsNever:
348
 		case ReplayJoinsNever:
349
 			nsNotice(rb, client.t("You will not see JOINs and PARTs in /HISTORY output or in autoreplay"))
349
 			nsNotice(rb, client.t("You will not see JOINs and PARTs in /HISTORY output or in autoreplay"))
350
 		}
350
 		}
351
-	case "bouncer":
352
-		if !config.Accounts.Bouncer.Enabled {
351
+	case "multiclient":
352
+		if !config.Accounts.Multiclient.Enabled {
353
 			nsNotice(rb, client.t("This feature has been disabled by the server administrators"))
353
 			nsNotice(rb, client.t("This feature has been disabled by the server administrators"))
354
 		} else {
354
 		} else {
355
 			switch settings.AllowBouncer {
355
 			switch settings.AllowBouncer {
356
-			case BouncerAllowedServerDefault:
357
-				if config.Accounts.Bouncer.AllowedByDefault {
358
-					nsNotice(rb, client.t("Bouncer functionality is currently enabled for your account, but you can opt out"))
356
+			case MulticlientAllowedServerDefault:
357
+				if config.Accounts.Multiclient.AllowedByDefault {
358
+					nsNotice(rb, client.t("Multiclient functionality is currently enabled for your account, but you can opt out"))
359
 				} else {
359
 				} else {
360
-					nsNotice(rb, client.t("Bouncer functionality is currently disabled for your account, but you can opt in"))
360
+					nsNotice(rb, client.t("Multiclient functionality is currently disabled for your account, but you can opt in"))
361
 				}
361
 				}
362
-			case BouncerDisallowedByUser:
363
-				nsNotice(rb, client.t("Bouncer functionality is currently disabled for your account"))
364
-			case BouncerAllowedByUser:
365
-				nsNotice(rb, client.t("Bouncer functionality is currently enabled for your account"))
362
+			case MulticlientDisallowedByUser:
363
+				nsNotice(rb, client.t("Multiclient functionality is currently disabled for your account"))
364
+			case MulticlientAllowedByUser:
365
+				nsNotice(rb, client.t("Multiclient functionality is currently enabled for your account"))
366
 			}
366
 			}
367
 		}
367
 		}
368
 	case "always-on":
368
 	case "always-on":
440
 			out.AutoreplayLines = newValue
440
 			out.AutoreplayLines = newValue
441
 			return
441
 			return
442
 		}
442
 		}
443
-	case "bouncer":
444
-		var newValue BouncerAllowedSetting
443
+	case "multiclient":
444
+		var newValue MulticlientAllowedSetting
445
 		if strings.ToLower(params[1]) == "default" {
445
 		if strings.ToLower(params[1]) == "default" {
446
-			newValue = BouncerAllowedServerDefault
446
+			newValue = MulticlientAllowedServerDefault
447
 		} else {
447
 		} else {
448
 			var enabled bool
448
 			var enabled bool
449
 			enabled, err = utils.StringToBool(params[1])
449
 			enabled, err = utils.StringToBool(params[1])
450
 			if enabled {
450
 			if enabled {
451
-				newValue = BouncerAllowedByUser
451
+				newValue = MulticlientAllowedByUser
452
 			} else {
452
 			} else {
453
-				newValue = BouncerDisallowedByUser
453
+				newValue = MulticlientDisallowedByUser
454
 			}
454
 			}
455
 		}
455
 		}
456
 		if err == nil {
456
 		if err == nil {

+ 4
- 3
oragono.yaml Bestand weergeven

346
         # rename-prefix - this is the prefix to use when renaming clients (e.g. Guest-AB54U31)
346
         # rename-prefix - this is the prefix to use when renaming clients (e.g. Guest-AB54U31)
347
         rename-prefix: Guest-
347
         rename-prefix: Guest-
348
 
348
 
349
-    # bouncer controls whether oragono can act as a bouncer, i.e., allowing
350
-    # multiple connections to attach to the same client/nickname identity
351
-    bouncer:
349
+    # multiclient controls whether oragono allows multiple connections to
350
+    # attach to the same client/nickname identity; this is part of the
351
+    # functionality traditionally provided by a bouncer like ZNC
352
+    multiclient:
352
         # when disabled, each connection must use a separate nickname (as is the
353
         # when disabled, each connection must use a separate nickname (as is the
353
         # typical behavior of IRC servers). when enabled, a new connection that
354
         # typical behavior of IRC servers). when enabled, a new connection that
354
         # has authenticated with SASL can associate itself with an existing
355
         # has authenticated with SASL can associate itself with an existing

Laden…
Annuleren
Opslaan