Improvements for handling of DB connection loss while Quassel is running

This PR includes several fixes for loss of DB connection while Quassel is running.  More details are in the commit messages.