//
// A client providing message sequence match data can reduce the scope
// as above. In the case where there have been no expunges, the server
// can ignore this data.
if (metaData.getHighestModSeq() > changedSince) {
SearchQuery searchQuery = new SearchQuery();
NumericRange[] nRanges = new NumericRange[ranges.size()];
Set<Long> vanishedUids = new HashSet<Long>();
for (int i = 0; i < ranges.size(); i++) {
MessageRange r = ranges.get(i);
NumericRange nr;
if (r.getType() == Type.ONE) {
nr = new NumericRange(r.getUidFrom());
} else {
nr = new NumericRange(r.getUidFrom(), r.getUidTo());
}
long from = nr.getLowValue();
long to = nr.getHighValue();
while(from <= to) {
vanishedUids.add(from++);
}
nRanges[i] = nr;
}
searchQuery.andCriteria(SearchQuery.uid(nRanges));
searchQuery.andCriteria(SearchQuery.modSeqGreaterThan(changedSince));
Iterator<Long> uids = mailbox.search(searchQuery, session);
while(uids.hasNext()) {
vanishedUids.remove(uids.next());
}
IdRange[] vanishedIdRanges = idRanges(MessageRange.toRanges(vanishedUids));