diff --git a/irc/client.go b/irc/client.go index ac928d9d..560ef269 100644 --- a/irc/client.go +++ b/irc/client.go @@ -113,7 +113,12 @@ func (c *Client) readCommands() { m.SetClient(c) c.server.Command(m) } - c.ConnectionClosed() + + if c.registered { + c.ConnectionClosed() + } else { + c.Destroy() + } } func (client *Client) writeReplies() { diff --git a/irc/server.go b/irc/server.go index de110931..cfd54fc7 100644 --- a/irc/server.go +++ b/irc/server.go @@ -65,10 +65,6 @@ func (server *Server) receiveCommands() { client.Touch() command.HandleServer(server) - - if DEBUG_SERVER { - log.Printf("%s → %s %+v processed", command.Client(), server, command) - } } } @@ -311,9 +307,11 @@ func (m *QuitCommand) HandleServer(server *Server) { client.Reply(RplError(server, client)) client.Destroy() - reply := RplQuit(client, m.message) - for iclient := range iclients { - iclient.Reply(reply) + if len(iclients) > 0 { + reply := RplQuit(client, m.message) + for iclient := range iclients { + iclient.Reply(reply) + } } }