mirror of https://github.com/fluffle/goirc
Merge in some other niceties from raylu.
This commit is contained in:
parent
04db2e2c8d
commit
f829eeab9b
|
@ -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)]
|
||||||
|
|
Loading…
Reference in New Issue