factoring out connecting to an IRC server