Add a CTCP event interface, fix bugs.