Fix parameters handling.
Move code.
Remove old code.
Add general purpose functions.
Add dovecot-sql related command.