From bcf581f63d18228ad881efbd0f802bc5b3d38ab8 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 26 Jul 2020 03:44:59 -0400 Subject: [PATCH 1/2] fix #1214 --- irc/accounts.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/irc/accounts.go b/irc/accounts.go index 3603ac87..26b8dbe7 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -891,20 +891,18 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er } if client != nil { am.Login(client, clientAccount) - } - _, 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 client.AlwaysOn() { + client.markDirty(IncludeRealname) } - if method == NickEnforcementStrict { + } + // we may need to do nick enforcement here: + _, method := am.EnforcementStatus(casefoldedAccount, skeleton) + 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) - } return nil } From d679d21ac031d5f12edc638ace5084e1b9150076 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 26 Jul 2020 04:10:28 -0400 Subject: [PATCH 2/2] fix #1216 --- irc/accounts.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/irc/accounts.go b/irc/accounts.go index 26b8dbe7..65a70bca 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -903,6 +903,23 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er am.server.RandomlyRename(currentClient) } } + // #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 }