Nick changes get handled properly by the server IRC client, user count stays hidden when the selected tab is not a channel

This commit is contained in:
khlieng 2015-02-07 00:16:51 +01:00
parent 0a47f2ae4a
commit e942924c15
5 changed files with 27 additions and 20 deletions

22
irc.go
View file

@ -55,17 +55,18 @@ type Message struct {
}
type IRC struct {
conn net.Conn
reader *bufio.Reader
out chan string
ready sync.WaitGroup
conn net.Conn
reader *bufio.Reader
out chan string
ready sync.WaitGroup
nick string
nickLock sync.Mutex
Messages chan *Message
Server string
Host string
TLS bool
TLSConfig *tls.Config
nick string
Username string
Realname string
}
@ -132,6 +133,10 @@ func (i *IRC) Pass(password string) {
func (i *IRC) Nick(nick string) {
i.write("NICK " + nick)
i.nickLock.Lock()
i.nick = nick
i.nickLock.Unlock()
}
func (i *IRC) User(username, realname string) {
@ -170,6 +175,13 @@ func (i *IRC) Quit() {
}()
}
func (i *IRC) GetNick() string {
i.nickLock.Lock()
defer i.nickLock.Unlock()
return i.nick
}
func (i *IRC) Write(data string) {
i.out <- data + "\r\n"
}