diff options
Diffstat (limited to 'vendor/github.com/thoj/go-ircevent/irc_callback.go')
-rw-r--r-- | vendor/github.com/thoj/go-ircevent/irc_callback.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vendor/github.com/thoj/go-ircevent/irc_callback.go b/vendor/github.com/thoj/go-ircevent/irc_callback.go index b5622367..d389f731 100644 --- a/vendor/github.com/thoj/go-ircevent/irc_callback.go +++ b/vendor/github.com/thoj/go-ircevent/irc_callback.go @@ -136,9 +136,8 @@ func (irc *Connection) RunCallbacks(event *Event) { func (irc *Connection) setupCallbacks() { irc.events = make(map[string]map[int]func(*Event)) - //Handle error events. This has to be called in a new thred to allow - //readLoop to exit - irc.AddCallback("ERROR", func(e *Event) { go irc.Disconnect() }) + //Handle error events. + irc.AddCallback("ERROR", func(e *Event) { irc.Disconnect() }) //Handle ping events irc.AddCallback("PING", func(e *Event) { irc.SendRaw("PONG :" + e.Message()) }) @@ -201,7 +200,7 @@ func (irc *Connection) setupCallbacks() { ns, _ := strconv.ParseInt(e.Message(), 10, 64) delta := time.Duration(time.Now().UnixNano() - ns) if irc.Debug { - irc.Log.Printf("Lag: %vs\n", delta) + irc.Log.Printf("Lag: %.3f s\n", delta.Seconds()) } }) @@ -216,6 +215,8 @@ func (irc *Connection) setupCallbacks() { // 1: RPL_WELCOME "Welcome to the Internet Relay Network <nick>!<user>@<host>" // Set irc.nickcurrent to the actually used nick in this connection. irc.AddCallback("001", func(e *Event) { + irc.Lock() irc.nickcurrent = e.Arguments[0] + irc.Unlock() }) } |