Add PreRegister hook

This allows, for example, for SASL.
Use concatenation instead of format()
Add OnSend hook
Send mode options to the OnModeChange hook