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

fix an edge case with /NS SASET user always-on true

If force-nick-equals-account is disabled, then this could cause
a client with a non-reserved (or grouped) nick to become always-on.
(This can't happen with `/NS SET always-on true` because we check in
advance.)
This commit is contained in:
Shivaram Lingamneni 2020-07-27 06:08:06 -04:00
parent d9cab88780
commit 470756cd3e

View File

@ -330,6 +330,8 @@ func (client *Client) SetAccountSettings(settings AccountSettings) {
alwaysOn := persistenceEnabled(client.server.Config().Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
client.stateMutex.Lock()
if client.registered {
// only allow the client to become always-on if their nick equals their account name
alwaysOn = alwaysOn && client.nick == client.accountName
autoreplayMissedDisabled = (client.accountSettings.AutoreplayMissed && !settings.AutoreplayMissed)
becameAlwaysOn = (!client.alwaysOn && alwaysOn)
client.alwaysOn = alwaysOn