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

Merge pull request #1215 from slingamn/issue1214_saregister

fix #1214
This commit is contained in:
Shivaram Lingamneni 2020-07-26 01:31:00 -07:00 committed by GitHub
commit effad1453c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -891,19 +891,34 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er
}
if client != nil {
am.Login(client, clientAccount)
if client.AlwaysOn() {
client.markDirty(IncludeRealname)
}
}
// we may need to do nick enforcement here:
_, method := am.EnforcementStatus(casefoldedAccount, skeleton)
if method != NickEnforcementNone {
currentClient := am.server.clients.Get(casefoldedAccount)
if currentClient == nil || currentClient == client || currentClient.Account() == casefoldedAccount {
return nil
}
if method == NickEnforcementStrict {
currentClient := am.server.clients.Get(casefoldedAccount)
if currentClient != nil && currentClient != client && currentClient.Account() != casefoldedAccount {
am.server.RandomlyRename(currentClient)
}
}
if client.AlwaysOn() {
client.markDirty(IncludeRealname)
// #1216: we may have created an always-on client
if client == nil {
config := am.server.Config()
if persistenceEnabled(config.Accounts.Multiclient.AlwaysOn, PersistentUnspecified) {
accountData, err := am.LoadAccount(account)
if err != nil {
return err
}
am.server.AddAlwaysOnClient(
accountData,
nil,
nil,
config.Accounts.defaultUserModes,
"",
)
}
}
return nil
}