mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-29 07:29:31 +01:00
commit
b68b28e189
@ -1185,9 +1185,11 @@ func (client *Client) destroy(session *Session) {
|
|||||||
|
|
||||||
// should we destroy the whole client this time?
|
// should we destroy the whole client this time?
|
||||||
// BRB is not respected if this is a destroy of the whole client (i.e., session == nil)
|
// BRB is not respected if this is a destroy of the whole client (i.e., session == nil)
|
||||||
brbEligible := session != nil && (brbState == BrbEnabled || alwaysOn)
|
brbEligible := session != nil && brbState == BrbEnabled
|
||||||
alreadyDestroyed := client.destroyed
|
shouldDestroy := !client.destroyed && remainingSessions == 0 && !brbEligible && !alwaysOn
|
||||||
shouldDestroy := !alreadyDestroyed && remainingSessions == 0 && !brbEligible
|
// decrement stats on a true destroy, or for the removal of the last connected session
|
||||||
|
// of an always-on client
|
||||||
|
shouldDecrement := shouldDestroy || (alwaysOn && len(sessionsToDestroy) != 0 && len(client.sessions) == 0)
|
||||||
if shouldDestroy {
|
if shouldDestroy {
|
||||||
// if it's our job to destroy it, don't let anyone else try
|
// if it's our job to destroy it, don't let anyone else try
|
||||||
client.destroyed = true
|
client.destroyed = true
|
||||||
@ -1237,7 +1239,7 @@ func (client *Client) destroy(session *Session) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decrement stats if we have no more sessions, even if the client will not be destroyed
|
// decrement stats if we have no more sessions, even if the client will not be destroyed
|
||||||
if shouldDestroy || (!alreadyDestroyed && remainingSessions == 0) {
|
if shouldDecrement {
|
||||||
invisible := client.HasMode(modes.Invisible)
|
invisible := client.HasMode(modes.Invisible)
|
||||||
operator := client.HasMode(modes.LocalOperator) || client.HasMode(modes.Operator)
|
operator := client.HasMode(modes.LocalOperator) || client.HasMode(modes.Operator)
|
||||||
client.server.stats.Remove(registered, invisible, operator)
|
client.server.stats.Remove(registered, invisible, operator)
|
||||||
|
@ -179,8 +179,8 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
|
|||||||
return "", errNicknameInUse
|
return "", errNicknameInUse
|
||||||
}
|
}
|
||||||
if numSessions == 1 {
|
if numSessions == 1 {
|
||||||
invisible := client.HasMode(modes.Invisible)
|
invisible := currentClient.HasMode(modes.Invisible)
|
||||||
operator := client.HasMode(modes.Operator) || client.HasMode(modes.LocalOperator)
|
operator := currentClient.HasMode(modes.Operator) || currentClient.HasMode(modes.LocalOperator)
|
||||||
client.server.stats.AddRegistered(invisible, operator)
|
client.server.stats.AddRegistered(invisible, operator)
|
||||||
}
|
}
|
||||||
session.autoreplayMissedSince = lastSeen
|
session.autoreplayMissedSince = lastSeen
|
||||||
|
Loading…
Reference in New Issue
Block a user