mirror of
				https://github.com/fluffle/goirc
				synced 2025-11-03 19:48:04 +00:00 
			
		
		
		
	Merge pull request #50 from bramp/add-time
Ensure the time field is populated on the pseudo line events, such as co...
This commit is contained in:
		
						commit
						0f3cbf87fe
					
				
					 2 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -246,7 +246,7 @@ func (conn *Conn) Connect() error {
 | 
			
		|||
	}
 | 
			
		||||
	conn.connected = true
 | 
			
		||||
	conn.postConnect(true)
 | 
			
		||||
	conn.dispatch(&Line{Cmd: REGISTER})
 | 
			
		||||
	conn.dispatch(&Line{Cmd: REGISTER, Time: time.Now()})
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -400,7 +400,7 @@ func (conn *Conn) shutdown() {
 | 
			
		|||
	conn.wg.Wait()
 | 
			
		||||
	// reinit datastructures ready for next connection
 | 
			
		||||
	conn.initialise()
 | 
			
		||||
	conn.dispatch(&Line{Cmd: DISCONNECTED})
 | 
			
		||||
	conn.dispatch(&Line{Cmd: DISCONNECTED, Time: time.Now()})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Dumps a load of information about the current state of the connection to a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@ package client
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// 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
 | 
			
		||||
func (conn *Conn) h_001(line *Line) {
 | 
			
		||||
	// 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)
 | 
			
		||||
	t := line.Args[len(line.Args)-1]
 | 
			
		||||
	if idx := strings.LastIndex(t, " "); idx != -1 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue