add the first part of RFC5162 support (quick resync)

sogo needs this and I want sogo to work.

there's more to come... in Dave Cridland's words, 5162 has many moving
parts:

the parts where Select executes a Fetch are not done. it's actually
optional, so the client has to issue Fetch anyway. a splendid example of
pointless complexity.

Select retrieves the deleted messages, but does not yet issue vanished
(earlier).

fetch (vanished) is not done.
set Message::threadId() correctly when caching at injection

Message::threadId() isn't used much, only for the gmail compatibility
blah, so it's safe to say that noone will run into this bug. but I fix it
all the same.