relay: minor refactoring and prepare for more IRCv3 features