Merge in some other niceties from raylu.

This commit is contained in:
Alex Bramley 2010-11-03 23:46:58 +00:00
parent 04db2e2c8d
commit f829eeab9b
1 changed files with 7 additions and 3 deletions

View File

@ -133,10 +133,14 @@ func (conn *Conn) Connect(host string, ssl bool, pass ...string) os.Error {
} }
// dispatch a nicely formatted os.Error to the error channel // dispatch a nicely formatted os.Error to the error channel
func (conn *Conn) error(s string, a ...interface{}) { conn.Err <- os.NewError(fmt.Sprintf(s, a)) } func (conn *Conn) error(s string, a ...interface{}) {
conn.Err <- os.NewError(fmt.Sprintf(s, a...))
}
// copied from http.client for great justice // copied from http.client for great justice
func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") } func hasPort(s string) bool {
return strings.LastIndex(s, ":") > strings.LastIndex(s, "]")
}
// dispatch input from channel as \r\n terminated line to peer // dispatch input from channel as \r\n terminated line to peer
// flood controlled using hybrid's algorithm if conn.Flood is true // flood controlled using hybrid's algorithm if conn.Flood is true
@ -216,7 +220,7 @@ func (conn *Conn) recv() {
if len(args) > 1 { if len(args) > 1 {
line.Text = args[1] line.Text = args[1]
} }
args = strings.Split(args[0], " ", -1) args = strings.Fields(args[0])
line.Cmd = strings.ToUpper(args[0]) line.Cmd = strings.ToUpper(args[0])
if len(args) > 1 { if len(args) > 1 {
line.Args = args[1:len(args)] line.Args = args[1:len(args)]