HomePhorge

Avoid using realMessageCount as it will start continuously resyncing the full…

Description

Avoid using realMessageCount as it will start continuously resyncing the full message box on any error at all.

After optimizing the item removal algorithm it performs sufficiently
for a 40k folder (~3s), that we can run it every time.
We now get a full listing on every sync, but using a search
command which is fast (because it only returns uid's).

We could optimize the case where nothing changed, but that would rely
on the itemCount again, so if that is off we wouldn't hit the
optimization anyways.

The next best proper optimization would be relying on QRESYNC to fetch
removed messages instead of the SEARCH command.

Details