husio/go-irc — pull request #4 by waynr (2014-02-04 01:37:42+00:00)
Title: Features/handler

Here's the work I've done on this library if you're interested.

The echobot example client still builds and works as expected. Although you may notice that in one of my commits I had changed the semantics from "Send" to "SendImmediate".

What's new is implementation of the "Handler" interface on the Client struct, a "Client.Serve" method that begins two loops: one loop to synchronously deliver messages from any source that writes to Client.MessageChan to the "Connection" object, another to handle reading messages and passing them to registered Handlers.

I also removed the "Client" interface since it didn't seem to add any additional functionality beyond the distinction between private and public members which felt too Java-y.

Anyway, I totally understand if you don't want to accept these changes and it doesn't really matter to me. I tried merging the two branches but there seem to be too many differences. This was really just a chance for me to practice writing something using Go's concurrency idioms.