refactor and tidy up irc controller.
fix irc protocol parser bug, and add unit test.