mirror of https://github.com/fluffle/goirc
Bring in Ray Lu's Debug patches.
This commit is contained in:
parent
9b9197f5f6
commit
34b3299d41
|
@ -17,6 +17,7 @@ type Conn struct {
|
||||||
// Connection Hostname and Nickname
|
// Connection Hostname and Nickname
|
||||||
Host string
|
Host string
|
||||||
Me *Nick
|
Me *Nick
|
||||||
|
Network string
|
||||||
|
|
||||||
// I/O stuff to server
|
// I/O stuff to server
|
||||||
sock net.Conn
|
sock net.Conn
|
||||||
|
@ -34,6 +35,8 @@ type Conn struct {
|
||||||
// Set this to true to disable flood protection and false to re-enable
|
// Set this to true to disable flood protection and false to re-enable
|
||||||
Flood bool
|
Flood bool
|
||||||
|
|
||||||
|
Debug bool
|
||||||
|
|
||||||
// Event handler mapping
|
// Event handler mapping
|
||||||
events map[string][]func(*Conn, *Line)
|
events map[string][]func(*Conn, *Line)
|
||||||
|
|
||||||
|
@ -163,8 +166,10 @@ func (conn *Conn) send() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
conn.io.Flush()
|
conn.io.Flush()
|
||||||
|
if conn.Debug {
|
||||||
fmt.Println("-> " + line)
|
fmt.Println("-> " + line)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// receive one \r\n terminated line from peer, parse and dispatch it
|
// receive one \r\n terminated line from peer, parse and dispatch it
|
||||||
|
@ -177,7 +182,9 @@ func (conn *Conn) recv() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
s = strings.Trim(s, "\r\n")
|
s = strings.Trim(s, "\r\n")
|
||||||
|
if conn.Debug {
|
||||||
fmt.Println("<- " + s)
|
fmt.Println("<- " + s)
|
||||||
|
}
|
||||||
|
|
||||||
line := &Line{Raw: s}
|
line := &Line{Raw: s}
|
||||||
if s[0] == ':' {
|
if s[0] == ':' {
|
||||||
|
|
Loading…
Reference in New Issue