public static Element encodeMessageSummary(Element parent, ZimbraSoapContext lc, Message msg, OutputParticipants output, int fields) { Element e = encodeMessageCommon(parent, lc, msg, fields); e.addAttribute(MailService.A_ID, lc.formatItemId(msg));  if (!needToOutput(fields, Change.MODIFIED_CONTENT)) return e;  EmailElementCache eecache = new EmailElementCache(); boolean addRecips  = msg.isFromMe() && (output == OutputParticipants.PUT_RECIPIENTS || output == OutputParticipants.PUT_BOTH); boolean addSenders = output == OutputParticipants.PUT_BOTH || !addRecips; if (addRecips) try { addEmails(e, eecache, InternetAddress.parseHeader(msg.getRecipients(), false), EmailElementCache.EMAIL_TYPE_TO); } catch (AddressException e1) { } if (addSenders) eecache.makeEmail(e, msg.getSender(), EmailElementCache.EMAIL_TYPE_FROM, null);  e.addAttribute(MailService.E_SUBJECT, StringUtil.stripControlCharacters(msg.getSubject()), Element.DISP_CONTENT);   String fragment = msg.getFragment(); if (!fragment.equals("")) e.addAttribute(MailService.E_FRAG, fragment, Element.DISP_CONTENT);  if (msg.isInvite()) try { encodeInvitesForMessage(e, lc, msg, fields); } catch (ServiceException ex) { mLog.debug("Caught exception while encoding Invites for msg " + msg.getId(), ex); }  return e;
public static Element encodeMessageSummary(Element parent, ZimbraSoapContext lc, Message msg, OutputParticipants output) { return encodeMessageSummary(parent, lc, msg, output, NOTIFY_FIELDS);
    public static Element encodeMessageSummary(Element parent, ZimbraSoapContext lc, Message msg, OutputParticipants output, int fields) {        Element e = encodeMessageCommon(parent, lc, msg, fields);        e.addAttribute(MailService.A_ID, lc.formatItemId(msg));        if (!needToOutput(fields, Change.MODIFIED_CONTENT))            return e;        EmailElementCache eecache = new EmailElementCache();        boolean addRecips  = msg.isFromMe() && (output == OutputParticipants.PUT_RECIPIENTS || output == OutputParticipants.PUT_BOTH);        boolean addSenders = output == OutputParticipants.PUT_BOTH || !addRecips;        if (addRecips)            try {                addEmails(e, eecache, InternetAddress.parseHeader(msg.getRecipients(), false), EmailElementCache.EMAIL_TYPE_TO);            } catch (AddressException e1) { }            if (addSenders)                eecache.makeEmail(e, msg.getSender(), EmailElementCache.EMAIL_TYPE_FROM, null);            e.addAttribute(MailService.E_SUBJECT, StringUtil.stripControlCharacters(msg.getSubject()), Element.DISP_CONTENT);            // fragment has already been sanitized...            String fragment = msg.getFragment();            if (!fragment.equals(""))                e.addAttribute(MailService.E_FRAG, fragment, Element.DISP_CONTENT);            if (msg.isInvite())                 try {                    encodeInvitesForMessage(e, lc, msg, fields);                } catch (ServiceException ex) {                    mLog.debug("Caught exception while encoding Invites for msg " + msg.getId(), ex);                }                return e;    }