Make printing in recv/send optional

This commit is contained in:
raylu 2010-10-13 14:57:36 -04:00
parent 82cc80ca1a
commit 1a5b744150
1 changed files with 9 additions and 3 deletions

View File

@ -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,7 +152,9 @@ func (conn *Conn) send() {
break break
} }
conn.io.Flush() conn.io.Flush()
fmt.Println("-> " + line) if conn.debug {
fmt.Println("-> " + line)
}
} }
} }
@ -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]
fmt.Println("<- " + s) if conn.debug {
fmt.Println("<- " + s)
}
line := &Line{Raw: s} line := &Line{Raw: s}
if s[0] == ':' { if s[0] == ':' {