Cleanup: DRY when sanitizing the mailbox names before passing them to the SQL layer

This massaging is still needed due to qsqlite translating a null QString into
NIL; by now, this requirement is documented and its use is made consistent.

Thanks to ronny_ for pointing out that the old way was very ugly.