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

mark dirty when a client first becomes always-on

This commit is contained in:
Shivaram Lingamneni 2020-03-02 01:53:02 -05:00
parent 3005e95c1f
commit d5f68215e1

View File

@ -321,13 +321,19 @@ func (client *Client) AccountSettings() (result AccountSettings) {
}
func (client *Client) SetAccountSettings(settings AccountSettings) {
// we mark dirty if the client is transitioning to always-on
markDirty := false
alwaysOn := persistenceEnabled(client.server.Config().Accounts.Multiclient.AlwaysOn, settings.AlwaysOn)
client.stateMutex.Lock()
client.accountSettings = settings
if client.registered {
markDirty = !client.alwaysOn && alwaysOn
client.alwaysOn = alwaysOn
}
client.stateMutex.Unlock()
if markDirty {
client.markDirty(IncludeAllAttrs)
}
}
func (client *Client) Languages() (languages []string) {