3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

Merge pull request #203 from slingamn/rereg

two nickname reservation fixes
This commit is contained in:
Daniel Oaks 2018-02-28 14:40:32 -08:00 committed by GitHub
commit 898fb41485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 8 deletions

View File

@ -354,9 +354,6 @@ func (am *AccountManager) LoadAccount(casefoldedAccount string) (result ClientAc
var raw rawClientAccount
am.server.store.View(func(tx *buntdb.Tx) error {
raw, err = am.loadRawAccount(tx, casefoldedAccount)
if err == buntdb.ErrNotFound {
err = errAccountDoesNotExist
}
return nil
})
if err != nil {

View File

@ -686,9 +686,8 @@ func (client *Client) destroy(beingResumed bool) {
}
// clean up self
if client.idletimer != nil {
client.idletimer.Stop()
}
client.idletimer.Stop()
client.nickTimer.Stop()
client.server.accounts.Logout(client)

View File

@ -127,6 +127,10 @@ func (it *IdleTimer) processTimeout() {
// Stop stops counting idle time.
func (it *IdleTimer) Stop() {
if it == nil {
return
}
it.Lock()
defer it.Unlock()
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() {
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))

View File

@ -146,8 +146,7 @@ accounts:
enabled: true
# length of time a user has to verify their account before it can be re-registered
# default is 120 hours, or 5 days
verify-timeout: "120h"
verify-timeout: "32h"
# callbacks to allow
enabled-callbacks: