queueForIndexing(copy, null);
queueForIndexing(copy, false, null);
    public synchronized List<Pair<MailItem,MailItem>> imapCopy(OperationContext octxt, int[] itemIds, byte type, int folderId) throws IOException, ServiceException {        // this is an IMAP command, so we'd better be tracking IMAP changes by now...        beginTrackingImap(octxt);        for (int id : itemIds)            if (id <= 0)                throw MailItem.noSuchItem(id, type);        short volumeId = Volume.getCurrentMessageVolume().getId();        ImapCopyItem redoRecorder = new ImapCopyItem(mId, type, folderId, volumeId);        boolean success = false;        try {            beginTransaction("icopy", octxt, redoRecorder);            ImapCopyItem redoPlayer = (ImapCopyItem) mCurrentChange.getRedoPlayer();            Folder target = getFolderById(folderId);            // fetch the items to copy and make sure the caller is up-to-date on change IDs            MailItem[] items = getItemById(itemIds, type);            for (MailItem item : items)                checkItemChangeID(item);            // for IMAP's sake, let's try to keep the IDs vaguely contiguous            LinkedList<Integer> newIds = null, newImapIds = null;            if (redoPlayer == null) {                newIds = new LinkedList<Integer>();                for (int i = 0; i < itemIds.length; i++)                    newIds.add(getNextItemId(ID_AUTO_INCREMENT));                newImapIds = new LinkedList<Integer>();                for (int i = 0; i < itemIds.length; i++)                    newImapIds.add(getNextItemId(ID_AUTO_INCREMENT));            }            List<Pair<MailItem,MailItem>> result = new ArrayList<Pair<MailItem,MailItem>>();            for (MailItem item : items) {                int srcId = item.getId(), newId, newImapId;                if (redoPlayer == null) {                    newId = newIds.removeFirst();                    newImapId = newImapIds.removeFirst();                } else {                    newId = getNextItemId(redoPlayer.getDestId(srcId));                    newImapId = redoPlayer.getSrcImapId(srcId);                }                MailItem copy = item.icopy(target, newId, item.getVolumeId() == -1 ? -1 : volumeId, newImapId);                redoRecorder.setDestId(srcId, newId);                redoRecorder.setSrcImapId(srcId, newImapId);                    // if we're not sharing the index entry, we need to index the new item                if (copy.getIndexId() == copy.getId())                    queueForIndexing(copy, null);                result.add(new Pair<MailItem,MailItem>(item, copy));            }            success = true;            return result;        } finally {            endTransaction(success);        }    }