mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
ensure the nick timeout mechanism is cleaned up on client quit
This commit is contained in:
parent
a5897baa2b
commit
945dec9964
@ -686,9 +686,8 @@ func (client *Client) destroy(beingResumed bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clean up self
|
// clean up self
|
||||||
if client.idletimer != nil {
|
client.idletimer.Stop()
|
||||||
client.idletimer.Stop()
|
client.nickTimer.Stop()
|
||||||
}
|
|
||||||
|
|
||||||
client.server.accounts.Logout(client)
|
client.server.accounts.Logout(client)
|
||||||
|
|
||||||
|
@ -127,6 +127,10 @@ func (it *IdleTimer) processTimeout() {
|
|||||||
|
|
||||||
// Stop stops counting idle time.
|
// Stop stops counting idle time.
|
||||||
func (it *IdleTimer) Stop() {
|
func (it *IdleTimer) Stop() {
|
||||||
|
if it == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
it.Lock()
|
it.Lock()
|
||||||
defer it.Unlock()
|
defer it.Unlock()
|
||||||
it.state = TimerDead
|
it.state = TimerDead
|
||||||
@ -232,6 +236,20 @@ func (nt *NickTimer) Touch() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop stops counting time and cleans up the timer
|
||||||
|
func (nt *NickTimer) Stop() {
|
||||||
|
if nt == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
nt.Lock()
|
||||||
|
defer nt.Unlock()
|
||||||
|
if nt.timer != nil {
|
||||||
|
nt.timer.Stop()
|
||||||
|
nt.timer = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (nt *NickTimer) sendWarning() {
|
func (nt *NickTimer) sendWarning() {
|
||||||
baseNotice := "Nickname is reserved; you must change it or authenticate to NickServ within %v"
|
baseNotice := "Nickname is reserved; you must change it or authenticate to NickServ within %v"
|
||||||
nt.client.Notice(fmt.Sprintf(nt.client.t(baseNotice), nt.timeout))
|
nt.client.Notice(fmt.Sprintf(nt.client.t(baseNotice), nt.timeout))
|
||||||
|
Loading…
Reference in New Issue
Block a user