From 34b3299d4153536344ea210ff4e7d9be9624485b Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Tue, 2 Nov 2010 21:47:05 +0000 Subject: [PATCH] Bring in Ray Lu's Debug patches. --- irc/connection.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/irc/connection.go b/irc/connection.go index 7a69d80..4b05f57 100644 --- a/irc/connection.go +++ b/irc/connection.go @@ -17,6 +17,7 @@ type Conn struct { // Connection Hostname and Nickname Host string Me *Nick + Network string // I/O stuff to server sock net.Conn @@ -34,6 +35,8 @@ type Conn struct { // Set this to true to disable flood protection and false to re-enable Flood bool + Debug bool + // Event handler mapping events map[string][]func(*Conn, *Line) @@ -163,7 +166,9 @@ func (conn *Conn) send() { break } conn.io.Flush() - fmt.Println("-> " + line) + if conn.Debug { + fmt.Println("-> " + line) + } } } @@ -177,7 +182,9 @@ func (conn *Conn) recv() { break } s = strings.Trim(s, "\r\n") - fmt.Println("<- " + s) + if conn.Debug { + fmt.Println("<- " + s) + } line := &Line{Raw: s} if s[0] == ':' {