mirror of https://github.com/fluffle/goirc
Make printing in recv/send optional
This commit is contained in:
parent
82cc80ca1a
commit
1a5b744150
|
@ -27,7 +27,9 @@ type Conn struct {
|
||||||
Err chan os.Error
|
Err chan os.Error
|
||||||
|
|
||||||
// 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)
|
||||||
|
@ -150,9 +152,11 @@ 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
|
||||||
func (conn *Conn) recv() {
|
func (conn *Conn) recv() {
|
||||||
|
@ -165,7 +169,9 @@ func (conn *Conn) recv() {
|
||||||
}
|
}
|
||||||
// chop off \r\n
|
// chop off \r\n
|
||||||
s = s[0 : len(s)-2]
|
s = s[0 : len(s)-2]
|
||||||
|
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