ctcp: Turn into a generic CTCP function. Add VERSION handler.

Signed-off-by: Martin Stone <martin@d7415.co.uk>