use cl.Receive() instead of sv.sendReply() in registration

This commit is contained in:
Andreas Neue 2016-07-27 15:46:16 +02:00
parent 8abd193f75
commit e5e497c2c4
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ func (sv *Server) dispatcher() {
case cl := <-sv.addq: case cl := <-sv.addq:
clid := strings.ToLower(cl.Name()) clid := strings.ToLower(cl.Name())
if _, exists := sv.clients[clid]; exists { if _, exists := sv.clients[clid]; exists {
sv.sendReply(cl.Name(), ERR_NICKNAMEINUSE, "", "Nickname is already in use") cl.Receive(irc.M("", ERR_NICKNAMEINUSE, cl.Name(), "Nickname is already in use"))
go func() { go func() {
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
cl.Register(false) cl.Register(false)
@ -157,7 +157,7 @@ func (sv *Server) dispatcher() {
continue continue
} }
if !sv.authCallback(cl.Name(), cl.Password()) { if !sv.authCallback(cl.Name(), cl.Password()) {
sv.sendReply(cl.Name(), ERR_PASSWDMISMATCH, "", "Password incorrect") cl.Receive(irc.M("", ERR_PASSWDMISMATCH, cl.Name(), "Password incorrect"))
go func() { go func() {
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
cl.Register(false) cl.Register(false)