protected void respondVanished(MailboxSession session,MessageManager mailbox,List<MessageRange> ranges,long changedSince,MetaData metaData,Responder responder) throws MailboxException {
  if (metaData.getHighestModSeq() > changedSince) {
    SearchQuery searchQuery=new SearchQuery();
    SearchQuery.UidRange[] nRanges=new SearchQuery.UidRange[ranges.size()];
    Set<MessageUid> vanishedUids=new HashSet<MessageUid>();
    for (int i=0; i < ranges.size(); i++) {
      MessageRange r=ranges.get(i);
      SearchQuery.UidRange nr;
      if (r.getType() == Type.ONE) {
        nr=new SearchQuery.UidRange(r.getUidFrom());
      }
 else {
        nr=new SearchQuery.UidRange(r.getUidFrom(),r.getUidTo());
      }
      MessageUid from=nr.getLowValue();
      MessageUid to=nr.getHighValue();
      while (from.compareTo(to) <= 0) {
        vanishedUids.add(from);
        from=from.next();
      }
      nRanges[i]=nr;
    }
    searchQuery.andCriteria(SearchQuery.uid(nRanges));
    searchQuery.andCriteria(SearchQuery.modSeqGreaterThan(changedSince));
    Iterator<MessageUid> uids=mailbox.search(searchQuery,session);
    while (uids.hasNext()) {
      vanishedUids.remove(uids.next());
    }
    UidRange[] vanishedIdRanges=uidRanges(MessageRange.toRanges(vanishedUids));
    responder.respond(new VanishedResponse(vanishedIdRanges,true));
  }
}

protected void respondVanished ( MailboxSession session , MessageManager mailbox , List < MessageRange > ranges , long changedSince , MetaData metaData , Responder responder ) throws MailboxException { if ( metaData . getHighestModSeq ( ) > changedSince ) { SearchQuery searchQuery = new SearchQuery ( ) ; SearchQuery . UidRange [ ] nRanges = new SearchQuery . UidRange [ ranges . size ( ) ] ; Set < MessageUid > vanishedUids = new HashSet < MessageUid > ( ) ; for ( int i = 0 ; i < ranges . size ( ) ; i ++ ) { MessageRange r = ranges . get ( i ) ; SearchQuery . UidRange nr ; if ( r . getType ( ) == Type . ONE ) { nr = new SearchQuery . UidRange ( r . getUidFrom ( ) ) ; } else { nr = new SearchQuery . UidRange ( r . getUidFrom ( ) , r . getUidTo ( ) ) ; } MessageUid from = nr . getLowValue ( ) ; MessageUid to = nr . getHighValue ( ) ; while ( from . compareTo ( to ) <= 0 ) { vanishedUids . add ( from ) ; from = from . next ( ) ; } nRanges [ i ] = nr ; } searchQuery . andCriteria ( SearchQuery . uid ( nRanges ) ) ; searchQuery . andCriteria ( SearchQuery . modSeqGreaterThan ( changedSince ) ) ; Iterator < MessageUid > uids = mailbox . search ( searchQuery , session ) ; while ( uids . hasNext ( ) ) { vanishedUids . remove ( uids . next ( ) ) ; } UidRange [ ] vanishedIdRanges = uidRanges ( MessageRange . toRanges ( vanishedUids ) ) ; responder . respond ( new VanishedResponse ( vanishedIdRanges , true ) ) ; } }
send vanished responses if needed .
