mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-14 07:59:31 +01:00
rename 'bouncer' to 'multiclient'
This commit is contained in:
parent
03378da81b
commit
f5ca35ed72
@ -135,12 +135,6 @@ CAPDEFS = [
|
||||
url="https://ircv3.net/specs/extensions/userhost-in-names-3.2.html",
|
||||
standard="IRCv3",
|
||||
),
|
||||
CapDef(
|
||||
identifier="Bouncer",
|
||||
name="oragono.io/bnc",
|
||||
url="https://oragono.io/bnc",
|
||||
standard="Oragono-specific",
|
||||
),
|
||||
CapDef(
|
||||
identifier="ZNCSelfMessage",
|
||||
name="znc.in/self-message",
|
||||
|
@ -77,7 +77,7 @@ func (am *AccountManager) Initialize(server *Server) {
|
||||
}
|
||||
|
||||
func (am *AccountManager) createAlwaysOnClients(config *Config) {
|
||||
if config.Accounts.Bouncer.AlwaysOn == PersistentDisabled {
|
||||
if config.Accounts.Multiclient.AlwaysOn == PersistentDisabled {
|
||||
return
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ func (am *AccountManager) createAlwaysOnClients(config *Config) {
|
||||
for _, accountName := range accounts {
|
||||
account, err := am.LoadAccount(accountName)
|
||||
if err == nil && account.Verified &&
|
||||
persistenceEnabled(config.Accounts.Bouncer.AlwaysOn, account.Settings.AlwaysOn) {
|
||||
persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, account.Settings.AlwaysOn) {
|
||||
am.server.AddAlwaysOnClient(account, am.loadChannels(accountName), am.loadLastSignoff(accountName))
|
||||
}
|
||||
}
|
||||
@ -1676,12 +1676,12 @@ func (ac *AccountCredentials) RemoveCertfp(certfp string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
type BouncerAllowedSetting int
|
||||
type MulticlientAllowedSetting int
|
||||
|
||||
const (
|
||||
BouncerAllowedServerDefault BouncerAllowedSetting = iota
|
||||
BouncerDisallowedByUser
|
||||
BouncerAllowedByUser
|
||||
MulticlientAllowedServerDefault MulticlientAllowedSetting = iota
|
||||
MulticlientDisallowedByUser
|
||||
MulticlientAllowedByUser
|
||||
)
|
||||
|
||||
// controls whether/when clients without event-playback support see fake
|
||||
@ -1708,10 +1708,12 @@ func replayJoinsSettingFromString(str string) (result ReplayJoinsSetting, err er
|
||||
return
|
||||
}
|
||||
|
||||
// XXX: AllowBouncer cannot be renamed AllowMulticlient because it is stored in
|
||||
// persistent JSON blobs in the database
|
||||
type AccountSettings struct {
|
||||
AutoreplayLines *int
|
||||
NickEnforcement NickEnforcementMethod
|
||||
AllowBouncer BouncerAllowedSetting
|
||||
AllowBouncer MulticlientAllowedSetting
|
||||
ReplayJoins ReplayJoinsSetting
|
||||
AlwaysOn PersistentStatus
|
||||
AutoreplayMissed bool
|
||||
|
@ -7,7 +7,7 @@ package caps
|
||||
|
||||
const (
|
||||
// number of recognized capabilities:
|
||||
numCapabs = 27
|
||||
numCapabs = 26
|
||||
// length of the uint64 array that represents the bitset:
|
||||
bitsetLen = 1
|
||||
)
|
||||
@ -89,10 +89,6 @@ const (
|
||||
// https://ircv3.net/specs/extensions/multi-prefix-3.1.html
|
||||
MultiPrefix Capability = iota
|
||||
|
||||
// Bouncer is the Oragono-specific capability named "oragono.io/bnc":
|
||||
// https://oragono.io/bnc
|
||||
Bouncer Capability = iota
|
||||
|
||||
// Nope is the Oragono vendor capability named "oragono.io/nope":
|
||||
// https://oragono.io/nope
|
||||
Nope Capability = iota
|
||||
@ -144,7 +140,6 @@ var (
|
||||
"labeled-response",
|
||||
"message-tags",
|
||||
"multi-prefix",
|
||||
"oragono.io/bnc",
|
||||
"oragono.io/nope",
|
||||
"sasl",
|
||||
"server-time",
|
||||
|
@ -142,25 +142,23 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
||||
client.stateMutex.RUnlock()
|
||||
|
||||
// recompute this (client.alwaysOn is not set for unregistered clients):
|
||||
alwaysOn := account != "" && persistenceEnabled(config.Accounts.Bouncer.AlwaysOn, settings.AlwaysOn)
|
||||
alwaysOn := account != "" && persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
|
||||
|
||||
if alwaysOn && registered {
|
||||
return "", errCantChangeNick
|
||||
}
|
||||
|
||||
var bouncerAllowed bool
|
||||
if config.Accounts.Bouncer.Enabled {
|
||||
if config.Accounts.Multiclient.Enabled {
|
||||
if alwaysOn {
|
||||
// ignore the pre-reg nick, force a reattach
|
||||
newNick = accountName
|
||||
newcfnick = account
|
||||
bouncerAllowed = true
|
||||
} else if session != nil && session.capabilities.Has(caps.Bouncer) {
|
||||
bouncerAllowed = true
|
||||
} else {
|
||||
if config.Accounts.Bouncer.AllowedByDefault && settings.AllowBouncer != BouncerDisallowedByUser {
|
||||
if config.Accounts.Multiclient.AllowedByDefault && settings.AllowBouncer != MulticlientDisallowedByUser {
|
||||
bouncerAllowed = true
|
||||
} else if settings.AllowBouncer == BouncerAllowedByUser {
|
||||
} else if settings.AllowBouncer == MulticlientAllowedByUser {
|
||||
bouncerAllowed = true
|
||||
}
|
||||
}
|
||||
|
@ -207,6 +207,12 @@ func historyEnabled(serverSetting PersistentStatus, localSetting HistoryStatus)
|
||||
}
|
||||
}
|
||||
|
||||
type MulticlientConfig struct {
|
||||
Enabled bool
|
||||
AllowedByDefault bool `yaml:"allowed-by-default"`
|
||||
AlwaysOn PersistentStatus `yaml:"always-on"`
|
||||
}
|
||||
|
||||
type AccountConfig struct {
|
||||
Registration AccountRegistrationConfig
|
||||
AuthenticationEnabled bool `yaml:"authentication-enabled"`
|
||||
@ -223,11 +229,7 @@ type AccountConfig struct {
|
||||
} `yaml:"login-throttling"`
|
||||
SkipServerPassword bool `yaml:"skip-server-password"`
|
||||
NickReservation NickReservationConfig `yaml:"nick-reservation"`
|
||||
Bouncer struct {
|
||||
Enabled bool
|
||||
AllowedByDefault bool `yaml:"allowed-by-default"`
|
||||
AlwaysOn PersistentStatus `yaml:"always-on"`
|
||||
}
|
||||
Multiclient MulticlientConfig
|
||||
VHosts VHostConfig
|
||||
}
|
||||
|
||||
@ -878,11 +880,10 @@ func LoadConfig(filename string) (config *Config, err error) {
|
||||
config.Server.capValues[caps.Multiline] = multilineCapValue
|
||||
}
|
||||
|
||||
if !config.Accounts.Bouncer.Enabled {
|
||||
config.Accounts.Bouncer.AlwaysOn = PersistentDisabled
|
||||
config.Server.supportedCaps.Disable(caps.Bouncer)
|
||||
} else if config.Accounts.Bouncer.AlwaysOn >= PersistentOptOut {
|
||||
config.Accounts.Bouncer.AllowedByDefault = true
|
||||
if !config.Accounts.Multiclient.Enabled {
|
||||
config.Accounts.Multiclient.AlwaysOn = PersistentDisabled
|
||||
} else if config.Accounts.Multiclient.AlwaysOn >= PersistentOptOut {
|
||||
config.Accounts.Multiclient.AllowedByDefault = true
|
||||
}
|
||||
|
||||
var newLogConfigs []logger.LoggingConfig
|
||||
@ -1148,12 +1149,6 @@ func (config *Config) Diff(oldConfig *Config) (addedCaps, removedCaps *caps.Set)
|
||||
removedCaps.Add(caps.SASL)
|
||||
}
|
||||
|
||||
if !oldConfig.Accounts.Bouncer.Enabled && config.Accounts.Bouncer.Enabled {
|
||||
addedCaps.Add(caps.Bouncer)
|
||||
} else if oldConfig.Accounts.Bouncer.Enabled && !config.Accounts.Bouncer.Enabled {
|
||||
removedCaps.Add(caps.Bouncer)
|
||||
}
|
||||
|
||||
if oldConfig.Limits.Multiline.MaxBytes != 0 && config.Limits.Multiline.MaxBytes == 0 {
|
||||
removedCaps.Add(caps.Multiline)
|
||||
} else if oldConfig.Limits.Multiline.MaxBytes == 0 && config.Limits.Multiline.MaxBytes != 0 {
|
||||
|
@ -487,14 +487,14 @@ func schemaChangeV6ToV7(config *Config, tx *buntdb.Tx) error {
|
||||
type accountSettingsLegacyV7 struct {
|
||||
AutoreplayLines *int
|
||||
NickEnforcement NickEnforcementMethod
|
||||
AllowBouncer BouncerAllowedSetting
|
||||
AllowBouncer MulticlientAllowedSetting
|
||||
AutoreplayJoins bool
|
||||
}
|
||||
|
||||
type accountSettingsLegacyV8 struct {
|
||||
AutoreplayLines *int
|
||||
NickEnforcement NickEnforcementMethod
|
||||
AllowBouncer BouncerAllowedSetting
|
||||
AllowBouncer MulticlientAllowedSetting
|
||||
ReplayJoins ReplayJoinsSetting
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ func (client *Client) AccountName() string {
|
||||
}
|
||||
|
||||
func (client *Client) Login(account ClientAccount) {
|
||||
alwaysOn := persistenceEnabled(client.server.Config().Accounts.Bouncer.AlwaysOn, account.Settings.AlwaysOn)
|
||||
alwaysOn := persistenceEnabled(client.server.Config().Accounts.Multiclient.AlwaysOn, account.Settings.AlwaysOn)
|
||||
client.stateMutex.Lock()
|
||||
defer client.stateMutex.Unlock()
|
||||
client.account = account.NameCasefolded
|
||||
@ -329,7 +329,7 @@ func (client *Client) AccountSettings() (result AccountSettings) {
|
||||
}
|
||||
|
||||
func (client *Client) SetAccountSettings(settings AccountSettings) {
|
||||
alwaysOn := persistenceEnabled(client.server.Config().Accounts.Bouncer.AlwaysOn, settings.AlwaysOn)
|
||||
alwaysOn := persistenceEnabled(client.server.Config().Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
|
||||
client.stateMutex.Lock()
|
||||
client.accountSettings = settings
|
||||
if client.registered {
|
||||
|
@ -31,7 +31,7 @@ func servCmdRequiresNickRes(config *Config) bool {
|
||||
}
|
||||
|
||||
func servCmdRequiresBouncerEnabled(config *Config) bool {
|
||||
return config.Accounts.Bouncer.Enabled
|
||||
return config.Accounts.Multiclient.Enabled
|
||||
}
|
||||
|
||||
const (
|
||||
@ -147,7 +147,7 @@ an administrator can set use this command to set up user accounts.`,
|
||||
help: `Syntax: $bSESSIONS [nickname]$b
|
||||
|
||||
SESSIONS lists information about the sessions currently attached, via
|
||||
the server's bouncer functionality, to your nickname. An administrator
|
||||
the server's multiclient functionality, to your nickname. An administrator
|
||||
can use this command to list another user's sessions.`,
|
||||
helpShort: `$bSESSIONS$b lists the sessions attached to a nickname.`,
|
||||
enabled: servCmdRequiresBouncerEnabled,
|
||||
@ -228,8 +228,8 @@ nicknames. Your options are:
|
||||
3. 'strict' [you must already be authenticated to use the nick]
|
||||
4. 'default' [use the server default]`,
|
||||
|
||||
`$bBOUNCER$b
|
||||
If 'bouncer' is enabled and you are already logged in and using a nick, a
|
||||
`$bMULTICLIENT$b
|
||||
If 'multiclient' is enabled and you are already logged in and using a nick, a
|
||||
second client of yours that authenticates with SASL and requests the same nick
|
||||
is allowed to attach to the nick as well (this is comparable to the behavior
|
||||
of IRC "bouncers" like ZNC). Your options are 'on' (allow this behavior),
|
||||
@ -348,21 +348,21 @@ func displaySetting(settingName string, settings AccountSettings, client *Client
|
||||
case ReplayJoinsNever:
|
||||
nsNotice(rb, client.t("You will not see JOINs and PARTs in /HISTORY output or in autoreplay"))
|
||||
}
|
||||
case "bouncer":
|
||||
if !config.Accounts.Bouncer.Enabled {
|
||||
case "multiclient":
|
||||
if !config.Accounts.Multiclient.Enabled {
|
||||
nsNotice(rb, client.t("This feature has been disabled by the server administrators"))
|
||||
} else {
|
||||
switch settings.AllowBouncer {
|
||||
case BouncerAllowedServerDefault:
|
||||
if config.Accounts.Bouncer.AllowedByDefault {
|
||||
nsNotice(rb, client.t("Bouncer functionality is currently enabled for your account, but you can opt out"))
|
||||
case MulticlientAllowedServerDefault:
|
||||
if config.Accounts.Multiclient.AllowedByDefault {
|
||||
nsNotice(rb, client.t("Multiclient functionality is currently enabled for your account, but you can opt out"))
|
||||
} else {
|
||||
nsNotice(rb, client.t("Bouncer functionality is currently disabled for your account, but you can opt in"))
|
||||
nsNotice(rb, client.t("Multiclient functionality is currently disabled for your account, but you can opt in"))
|
||||
}
|
||||
case BouncerDisallowedByUser:
|
||||
nsNotice(rb, client.t("Bouncer functionality is currently disabled for your account"))
|
||||
case BouncerAllowedByUser:
|
||||
nsNotice(rb, client.t("Bouncer functionality is currently enabled for your account"))
|
||||
case MulticlientDisallowedByUser:
|
||||
nsNotice(rb, client.t("Multiclient functionality is currently disabled for your account"))
|
||||
case MulticlientAllowedByUser:
|
||||
nsNotice(rb, client.t("Multiclient functionality is currently enabled for your account"))
|
||||
}
|
||||
}
|
||||
case "always-on":
|
||||
@ -440,17 +440,17 @@ func nsSetHandler(server *Server, client *Client, command string, params []strin
|
||||
out.AutoreplayLines = newValue
|
||||
return
|
||||
}
|
||||
case "bouncer":
|
||||
var newValue BouncerAllowedSetting
|
||||
case "multiclient":
|
||||
var newValue MulticlientAllowedSetting
|
||||
if strings.ToLower(params[1]) == "default" {
|
||||
newValue = BouncerAllowedServerDefault
|
||||
newValue = MulticlientAllowedServerDefault
|
||||
} else {
|
||||
var enabled bool
|
||||
enabled, err = utils.StringToBool(params[1])
|
||||
if enabled {
|
||||
newValue = BouncerAllowedByUser
|
||||
newValue = MulticlientAllowedByUser
|
||||
} else {
|
||||
newValue = BouncerDisallowedByUser
|
||||
newValue = MulticlientDisallowedByUser
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
|
@ -346,9 +346,10 @@ accounts:
|
||||
# rename-prefix - this is the prefix to use when renaming clients (e.g. Guest-AB54U31)
|
||||
rename-prefix: Guest-
|
||||
|
||||
# bouncer controls whether oragono can act as a bouncer, i.e., allowing
|
||||
# multiple connections to attach to the same client/nickname identity
|
||||
bouncer:
|
||||
# multiclient controls whether oragono allows multiple connections to
|
||||
# attach to the same client/nickname identity; this is part of the
|
||||
# functionality traditionally provided by a bouncer like ZNC
|
||||
multiclient:
|
||||
# when disabled, each connection must use a separate nickname (as is the
|
||||
# typical behavior of IRC servers). when enabled, a new connection that
|
||||
# has authenticated with SASL can associate itself with an existing
|
||||
|
Loading…
Reference in New Issue
Block a user