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