Remove duplicates on cache synchronization.

Authored by machniak on Feb 16 2017, 12:49 PM.


Remove duplicates on cache synchronization.

https://issues.kolab.org/show_bug.cgi?id=4067 and (Bifrost#TT20881)

It happens that IMAP folder may contain many objects with the same UID.
The precise reason for this is unknown, but it can be e.g. a faulty
client or an error between "create a new object instance" and "remove the
old one". It causes various issues when editing such objects.

With the change we assume that the most recent object (with max. IMAP UID)
is the one that should be used and all the older instances will be removed