Fail IRC is a Ruby (1.9+) library that implements and abstracts a Server and a Client. Both are implemented in an event driven, concurrent and modular way. You can easily write modules that can do pretty much anything, in fact the standard protocols are implemented as modules.
the sources are available at http://www.github.com/meh/failirc