Improve nick change handling

This commit is contained in:
Ken-Håvard Lieng 2017-04-11 06:04:59 +02:00
parent 0a6d8bfb20
commit e84f2dd993
4 changed files with 22 additions and 8 deletions

View file

@ -64,6 +64,12 @@ func (c *Client) GetNick() string {
return c.nick
}
func (c *Client) setNick(nick string) {
c.lock.Lock()
c.nick = nick
c.lock.Unlock()
}
func (c *Client) Connected() bool {
c.lock.Lock()
defer c.lock.Unlock()
@ -73,10 +79,6 @@ func (c *Client) Connected() bool {
func (c *Client) Nick(nick string) {
c.Write("NICK " + nick)
c.lock.Lock()
c.nick = nick
c.lock.Unlock()
}
func (c *Client) Oper(name, password string) {