rewritten to use python-irclib