diff --git a/Makefile b/Makefile index 909fd80..086ef3a 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,6 @@ -GOFILES = irc.go irc_struct.go +include $(GOROOT)/src/Make.$(GOARCH) -all: $(GOARCH) - -clean: clean_$(GOARCH) - rm test - -386: - 8g $(GOFILES) - 8g test.go - 8l -o test test.8 - -amd64: - 6g $(GOFILES) - 6g test.go - 6l -o test test.6 - -arm: - 5g $(GOFILES) - 5g test.go - 5l -o test test.5 - -clean_amd64: - rm *.6 - -clean_386: - rm *.8 - -clean_arm: - rm *.5 +TARG=irc +GOFILES=irc.go irc_struct.go +include $(GOROOT)/src/Make.pkg diff --git a/README b/README deleted file mode 100644 index 4eb032e..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -Event based irc client library. Dosen't do much yet. diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..904f659 --- /dev/null +++ b/README.markdown @@ -0,0 +1,15 @@ +Description +---------- + +Event based irc client library. + +Install +---------- + $ git clone git@github.com:thoj/Go-IRC-Client-Library.git + $ cd Go-IRC-Client-Library + $ make + $ make install + +Example +---------- +See example/test.go diff --git a/example/Makefile b/example/Makefile new file mode 100644 index 0000000..cdf104c --- /dev/null +++ b/example/Makefile @@ -0,0 +1,26 @@ +all: $(GOARCH) + +clean: clean_$(GOARCH) + rm test + +386: + 8g test.go + 8l -o test test.8 + +amd64: + 6g test.go + 6l -o test test.6 + +arm: + 5g test.go + 5l -o test test.5 + +clean_amd64: + rm *.6 + +clean_386: + rm *.8 + +clean_arm: + rm *.5 + diff --git a/test.go b/example/test.go similarity index 98% rename from test.go rename to example/test.go index faa6402..6857ce7 100644 --- a/test.go +++ b/example/test.go @@ -1,7 +1,7 @@ package main import ( - "./irc"; + "irc"; "fmt"; "os"; ) diff --git a/irc.go b/irc.go index cdd0265..28b7897 100644 --- a/irc.go +++ b/irc.go @@ -19,8 +19,8 @@ func reader(irc *IRCConnection) { for { msg, err := br.ReadString('\n'); if err != nil { + fmt.Printf("%s\n", err); irc.perror <- err; - return; } irc.pread <- msg; } @@ -31,7 +31,8 @@ func writer(irc *IRCConnection) { b := strings.Bytes(<-irc.pwrite); _, err := irc.socket.Write(b); if err != nil { - irc.perror <- err + fmt.Printf("%s\n", err); + irc.perror <- err; } } } @@ -149,8 +150,6 @@ func (irc *IRCConnection) handle_command(msg string) *IRCEvent { e.Code = IRC_PING; e.Message = matches[2]; e.Error = os.ErrorString(matches[2]); - ; - irc.perror <- e.Error; } return e; } @@ -179,6 +178,7 @@ func handler(irc *IRCConnection) { irc.EventChan <- e; case error := <-irc.perror: + fmt.Printf("Piped error: %s\n", error); ee := new(IRCEvent); ee.Error = error; ee.Code = ERROR; @@ -209,7 +209,7 @@ func IRC(server string, nick string, user string, events chan *IRCEvent) (*IRCCo irc.registered = false; irc.pread = make(chan string, 100); irc.pwrite = make(chan string, 100); - irc.perror = make(chan os.Error); + irc.perror = make(chan os.Error, 10); irc.EventChan = events; irc.nick = nick; irc.user = user;