From f13d7066868a138567f23b0b14126725c10b84d3 Mon Sep 17 00:00:00 2001 From: tj Date: Fri, 6 Aug 2010 12:49:56 +0200 Subject: [PATCH 1/3] Correct splitting of event codes --- irc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc.go b/irc.go index 88ab7d7..981598e 100644 --- a/irc.go +++ b/irc.go @@ -46,7 +46,7 @@ func reader(irc *IRCConnection) { if len(args) > 1 { event.Message = args[1] } - args = strings.Split(args[0], " ", 0) + args = strings.Split(args[0], " ", -1) event.Code = strings.ToUpper(args[0]) if len(args) > 1 { event.Arguments = args[1:len(args)] From 2235f8b8ed5481c3957329cddd5f5a39102b0b90 Mon Sep 17 00:00:00 2001 From: tj Date: Fri, 6 Aug 2010 23:25:03 +0200 Subject: [PATCH 2/3] Fix edge case crash --- example/test.go | 2 +- irc.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/example/test.go b/example/test.go index 4759dbc..7022235 100644 --- a/example/test.go +++ b/example/test.go @@ -1,7 +1,7 @@ package main import ( - "irc" + irc "github.com/thoj/Go-IRC-Client-Library" "fmt" "os" ) diff --git a/irc.go b/irc.go index 981598e..1fb44da 100644 --- a/irc.go +++ b/irc.go @@ -58,6 +58,9 @@ func reader(irc *IRCConnection) { func writer(irc *IRCConnection) { for { b := []byte(<-irc.pwrite) + if b == nil { + return + } _, err := irc.socket.Write(b) if err != nil { fmt.Printf("%s\n", err) From bcec3b6f112e7ebb99ad21a6e46307f787b555a4 Mon Sep 17 00:00:00 2001 From: tj Date: Sun, 8 Aug 2010 23:10:54 +0200 Subject: [PATCH 3/3] Prefix nick instead of suffix if the nick is in use and over 8 characters long --- irc_callback.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/irc_callback.go b/irc_callback.go index d8d7d00..f3d6f98 100644 --- a/irc_callback.go +++ b/irc_callback.go @@ -91,7 +91,11 @@ func (irc *IRCConnection) setupCallbacks() { }) 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)) })