tests: Add coparison operators to MailboxMetadata

This will be needed for the tests later on
cache: Remove mailboxes when they are, well, removed

Thanks to Caspar for the initial troubleshooting -- I've known about this bug
for several months, but haven't bothered to fix it properly. His analysis
pinpointed the root cause of the problem and made it easy to fix this.

BUG: 320830
REVIEW: 110896
IMAP: fix (E)SORT to work with raw search criteria

The code now mimics the searchHelper method. The correct fix would be to split
out searching and sorting into fully separate paths within the
ThreadingMsgListModel, but that's way into future.

BUG: 320952
REVIEW: 110911
IMAP: do not doubly-encode backslashes when sending mailbox names

I've noticed this in an unrelated bugreport (thanks to Nicolas Sirolli
<nmsirolli@gmail.com> in bug 320828).

The encodeImapFolderName shall only convert the Unicode data into a proper
modified-utf-7 thing, not escape the backslashes. This escaping is done by the
Parser when queueing commands. Looks like this bug must have been around for
ages, literally.

CCBUG: 320828
Remove functions and tests which are not used anymore
IMAP: remove cached threading information and UID mapping when the UIDVALIDITY etc changes

Previously, the code would remove various pieces of information from the cache,
but the threading information would inadvertently persist. Thanks to ronny_ on
IRC for his bug report.

REVIEW: 110913
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.

REVIEW: 110921
Refactoring
IMAP: speed up the search processing when filtering messages

The old algorithm was rather dumb -- finding a first element of a QHash is not
O(1), but O(n), leading to quadratic time complexity, and the excess memory
traffic doesn't help either. On my laptop, this change changes cuts runtime of
the newly added test to ~280ms from the original 15+ seconds.

REVIEW: 110925
Show big fat warning that smtp password will be saved on disk in clear text

BUG: 320617
REVIEW: 110904
Merge branch 'fix-backslashes-in-mailbox-names'

REVIEW: 110912
Merge branch 'fix-threading-on-uidvalidity-change'