final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
List<MessageRange> ranges = new ArrayList<MessageRange>();
for (int i = 0; i < idSet.length; i++) {
MessageRange messageSet = messageRange(session.getSelected(), idSet[i], useUids);
if (messageSet != null) {
MessageRange normalizedMessageSet = normalizeMessageRange(session.getSelected(), messageSet);
MessageRange batchedMessageSet = MessageRange.range(normalizedMessageSet.getUidFrom(), normalizedMessageSet.getUidTo(), batchSize);
ranges.add(batchedMessageSet);
}
}
processMessageRanges(session, mailbox, ranges, fetch, useUids, mailboxSession, responder);