tests: the loop which waits for data should be defined just once

There's a difference between the number of iterations required for reading and
writing, which is why the cServer is not modified by this patch.

v2: There was a bug. Both cEmpty and cClient check what the Trojita (as the IMAP
client) sends out. It takes a few iterations of the event loop for the data to
arrive on the socket, which is the reason why there's this repeated call to
processEvents. The number is always the same, because both instances are
checking the same situation -- we're waiting to see what the code under test
"wrote to the server".

The cServer is, however, different -- the loop is there to make sure that the
response is handled by the Parser, sent to the Model, and finally delivered to
some Task. Some of these operations require a roundtrip (or two?) through the
event loop. This number is, however, different than the
cClient/cEmpty/cClientRegExp because it a different code path.

These numbers were needed at least by OS/2; on other platforms, 4 iterations
were enough.

Thanks to Stephan Platz for his review.
tests: Add support for checking the client's output against a regular expression

v2: check that the pattern is not a multiline thing as that won't work with a
QRegExp, unfortunately.

v3: let the test fail with a proper error message when the Trojita-generated
data are wrong. Asserting here makes no sense whatsoever. Thanks to Stephan
Platz for his review.

Also adding some comments to better explain what's going on.
tests: handle non-determinism due to random QHash seeding in Qt5

Previously, a simple call to `QT_HASH_SEED=2 ./test_Composer_Submission` was
enough to hit a failure.

BUG: 338074
REVIEW: 119643
Replace Model::findMessageForItem with a custom role

Using the QAbstractModel interface simplifies replacing
the actual model used.
Refactor deproxifiedIndex to be independent of TreeItems

TreeItem is an implementation detail of the Imap::Mailbox::Model.
Usage of that detail outside the model should be avoided.

REVIEW: 119676