Implement nick mangling.

 - On invalid characters, non-alphanums are dropped (with the nick
   "f" used if this results in an empty nick.
 - On collisions, substring substitutions are first tried. If there
   are no substitutions, a "1" is appended to the nick.

In both cases, nicks are truncated (from the right) to 16 characters.

This does not generate an infinite sequence of unique nicks! The collision
resolution will start to loop, however there would need to be a LOT of
very boring nicks connected for this to be an issue, so I don't consider
it much of a problem.