Merge branch 'master' of git@github.com:thoj/Go-IRC-Client-Library

This commit is contained in:
Thomas Jäger 2010-09-23 18:56:15 +02:00
commit 3d0ffc5d06
3 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"irc" irc "github.com/thoj/Go-IRC-Client-Library"
"fmt" "fmt"
"os" "os"
) )

5
irc.go
View File

@ -48,7 +48,7 @@ func reader(irc *IRCConnection) {
if len(args) > 1 { if len(args) > 1 {
event.Message = args[1] event.Message = args[1]
} }
args = strings.Split(args[0], " ", 0) args = strings.Split(args[0], " ", -1)
event.Code = strings.ToUpper(args[0]) event.Code = strings.ToUpper(args[0])
if len(args) > 1 { if len(args) > 1 {
event.Arguments = args[1:len(args)] event.Arguments = args[1:len(args)]
@ -61,6 +61,9 @@ func reader(irc *IRCConnection) {
func writer(irc *IRCConnection) { func writer(irc *IRCConnection) {
for !error { for !error {
b := []byte(<-irc.pwrite) b := []byte(<-irc.pwrite)
if b == nil {
return
}
_, err := irc.socket.Write(b) _, err := irc.socket.Write(b)
if err != nil { if err != nil {
fmt.Printf("%s\n", err) fmt.Printf("%s\n", err)

View File

@ -91,7 +91,11 @@ func (irc *IRCConnection) setupCallbacks() {
}) })
irc.AddCallback("433", func(e *IRCEvent) { irc.AddCallback("433", func(e *IRCEvent) {
irc.nick = irc.nick + "_" if len(irc.nick) > 8 {
irc.nick = "_" + irc.nick;
} else {
irc.nick = irc.nick + "_"
}
irc.SendRaw(fmt.Sprintf("NICK %s", irc.nick)) irc.SendRaw(fmt.Sprintf("NICK %s", irc.nick))
}) })