Also add time to the Connected event.

This commit is contained in:
Andrew Brampton 2014-11-30 15:58:57 -08:00
parent 706c90baa3
commit d7116e2bd0
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ package client
import ( import (
"strings" "strings"
"time"
) )
// sets up the internal event handlers to do essential IRC protocol things // sets up the internal event handlers to do essential IRC protocol things
@ -42,7 +43,7 @@ func (conn *Conn) h_REGISTER(line *Line) {
// Handler to trigger a CONNECTED event on receipt of numeric 001 // Handler to trigger a CONNECTED event on receipt of numeric 001
func (conn *Conn) h_001(line *Line) { func (conn *Conn) h_001(line *Line) {
// we're connected! // we're connected!
conn.dispatch(&Line{Cmd: CONNECTED}) conn.dispatch(&Line{Cmd: CONNECTED, Time: time.Now()})
// and we're being given our hostname (from the server's perspective) // and we're being given our hostname (from the server's perspective)
t := line.Args[len(line.Args)-1] t := line.Args[len(line.Args)-1]
if idx := strings.LastIndex(t, " "); idx != -1 { if idx := strings.LastIndex(t, " "); idx != -1 {