mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-14 07:59:31 +01:00
fix handling of nil session in reattach code
This commit is contained in:
parent
08ebfb1676
commit
278e4acf57
@ -238,7 +238,10 @@ func (am *AccountManager) BouncerAllowed(account string, session *Session) bool
|
|||||||
if !config.Accounts.Bouncer.Enabled {
|
if !config.Accounts.Bouncer.Enabled {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return config.Accounts.Bouncer.AllowedByDefault || session.capabilities.Has(caps.Bouncer)
|
if config.Accounts.Bouncer.AllowedByDefault {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return session != nil && session.capabilities.Has(caps.Bouncer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Looks up the enforcement method stored in the database for an account
|
// Looks up the enforcement method stored in the database for an account
|
||||||
|
@ -152,7 +152,7 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
|||||||
|
|
||||||
currentClient := clients.byNick[newcfnick]
|
currentClient := clients.byNick[newcfnick]
|
||||||
// the client may just be changing case
|
// the client may just be changing case
|
||||||
if currentClient != nil && currentClient != client {
|
if currentClient != nil && currentClient != client && session != nil {
|
||||||
// these conditions forbid reattaching to an existing session:
|
// these conditions forbid reattaching to an existing session:
|
||||||
if client.Registered() || !bouncerAllowed || account == "" || account != currentClient.Account() || client.isTor != currentClient.isTor || client.HasMode(modes.TLS) != currentClient.HasMode(modes.TLS) {
|
if client.Registered() || !bouncerAllowed || account == "" || account != currentClient.Account() || client.isTor != currentClient.isTor || client.HasMode(modes.TLS) != currentClient.HasMode(modes.TLS) {
|
||||||
return errNicknameInUse
|
return errNicknameInUse
|
||||||
|
Loading…
Reference in New Issue
Block a user