String ctype = getContentType(mp); boolean isMultipart = ctype.startsWith(MULTIPART_PREFIX);
String ctype = Mime.getContentType(mp); boolean isMultipart = ctype.startsWith(Mime.CT_MULTIPART_PREFIX);
    public synchronized final boolean accept(MimePart mp) throws MessagingException {        boolean modified = false, multiModified = false;        MimeMultipart multi = null;        if (mp instanceof MimeMessage)            modified |= visitMessage((MimeMessage) mp, VisitPhase.VISIT_BEGIN);        String ctype = getContentType(mp);        boolean isMultipart = ctype.startsWith(MULTIPART_PREFIX);        boolean isMessage = !isMultipart && ctype.equals(Mime.CT_MESSAGE_RFC822);        Object content = null;        if (isMultipart) {            try {                content = Mime.getMultipartContent(mp, ctype);            } catch (Exception e) {                ZimbraLog.extensions.warn("could not fetch multipart content; skipping", e);            }            if (content instanceof MimeMultipart) {                multi = (MimeMultipart) content;                if (visitMultipart(multi, VisitPhase.VISIT_BEGIN))                    modified = multiModified = true;                try {                    for (int i = 0; i < multi.getCount(); i++) {                        BodyPart bp = multi.getBodyPart(i);                        if (bp instanceof MimeBodyPart) {                            if (accept((MimeBodyPart) bp))                                modified = multiModified = true;                        } else                            ZimbraLog.extensions.info("unexpected BodyPart subclass: " + bp.getClass().getName());                    }                } catch (MessagingException e) {                    ZimbraLog.extensions.warn("could not fetch body subpart; skipping remainder", e);                }                if (visitMultipart(multi, VisitPhase.VISIT_END))                    modified = multiModified = true;                if (multiModified)                    mp.setContent(multi);            }        } else if (isMessage) {            try {                content = Mime.getMessageContent(mp);            } catch (Exception e) {                ZimbraLog.extensions.warn("could not fetch attached message content; skipping", e);            }            if (content instanceof MimeMessage)                modified |= accept((MimeMessage) content);        } else if (mp instanceof MimeBodyPart) {            modified |= visitBodyPart((MimeBodyPart) mp);        } else if (!(mp instanceof MimeMessage)) {            ZimbraLog.extensions.info("unexpected MimePart subclass: " + mp.getClass().getName() + " (ctype='" + ctype + "')");        }        if (mp instanceof MimeMessage) {            MimeMessage mm = (MimeMessage) mp;            modified |= visitMessage(mm, VisitPhase.VISIT_END);            // commit changes to the message            if (modified)                mm.saveChanges();        }        return modified;    }