if (invite.thisAcctIsOrganizer(appt.getMailbox().getAccount())) {
if (invite.thisAcctIsOrganizer(acct)) {
    public static Element encodeInvite(Element parent, ZimbraContext lc, Appointment apptOrNull, Invite invite, int fields, boolean includeReplies) {        boolean allFields = true;                if (fields != NOTIFY_FIELDS) {            allFields = false;            if (!needToOutput(fields, Change.MODIFIED_INVITE)) {                return parent;            }        }        Element e = parent.addElement(MailService.E_INVITE_COMPONENT);        e.addAttribute(MailService.A_APPT_COMPONENT_NUM, invite.getComponentNum());                e.addAttribute(MailService.A_APPT_RSVP, invite.getRsvp());                if (allFields) {            try {                e.addAttribute("x_uid", invite.getUid());                                Appointment appt = invite.getAppointment();                if (appt != null)                    e.addAttribute(MailService.A_APPT_ID, lc.formatItemId(appt));                                if (invite.thisAcctIsOrganizer(appt.getMailbox().getAccount())) {                    e.addAttribute(MailService.A_APPT_ISORG, true);                }                                Recurrence.IRecurrence recur = invite.getRecurrence();                if (recur != null) {                    Element recurElt = e.addElement(MailService.E_APPT_RECUR);                    recur.toXml(recurElt);                }            } catch(ServiceException ex) {                ex.printStackTrace();            }                        e.addAttribute(MailService.A_APPT_TYPE, invite.getType());                        e.addAttribute(MailService.A_APPT_STATUS, invite.getStatus());            e.addAttribute(MailService.A_APPT_FREEBUSY, invite.getFreeBusy());            e.addAttribute(MailService.A_APPT_FREEBUSY_ACTUAL, invite.getFreeBusyActual());                        if (includeReplies && apptOrNull != null) {                List /*Appointment.ReplyInfo */ fbas = apptOrNull.getReplyInfo(invite);                Element repliesElt = e.addElement(MailService.A_APPT_REPLIES);                for (Iterator iter = fbas.iterator(); iter.hasNext(); ) {                    Appointment.ReplyInfo repInfo = (Appointment.ReplyInfo) iter.next();                    Element curElt = repliesElt.addElement(MailService.E_APPT_REPLY);                    if (repInfo.mRecurId != null) {                        repInfo.mRecurId.toXml(curElt);                    }//                        PartStat ps = (PartStat)(repInfo.mAttendee.getParameters().getParameter(Parameter.PARTSTAT));                    if (repInfo.mAttendee.hasPartStat()) {                        String psStr = repInfo.mAttendee.getPartStat();                        curElt.addAttribute(MailService.A_APPT_PARTSTAT, psStr);                        String fbaStr = invite.partStatToFreeBusyActual(psStr);                        curElt.addAttribute(MailService.A_APPT_FREEBUSY_ACTUAL, fbaStr);                    }                    curElt.addAttribute("stamp", repInfo.mDtStamp);                    curElt.addAttribute("at", repInfo.mAttendee.getAddress());                }            }            e.addAttribute(MailService.A_APPT_TRANSPARENCY, invite.getTransparency());                        if (invite.getRecurId() != null) {                e.addAttribute(MailService.A_APPT_IS_EXCEPTION, true);            }                        if (invite.isAllDayEvent())                e.addAttribute(MailService.A_APPT_ALLDAY, true);                        if (invite.getStartTime() != null) {                Element startElt = e.addElement(MailService.E_APPT_START_TIME);                ParsedDateTime dtStart = invite.getStartTime();                startElt.addAttribute(MailService.A_APPT_DATETIME, dtStart.getDateTimePartString());                String tzName = dtStart.getTZName();                if (tzName != null) {                    startElt.addAttribute(MailService.A_APPT_TIMEZONE, tzName);                }            }                        ParsedDateTime dtEnd = invite.getEndTime();            if (dtEnd != null) {                Element endElt = e.addElement(MailService.E_APPT_END_TIME);                if (invite.isAllDayEvent()) {                    // See CalendarUtils.parseInviteElementCommon, where we parse DTEND                    // for a description of why we add -1d when sending to the client                    dtEnd = dtEnd.add(ParsedDuration.NEGATIVE_ONE_DAY);                }                endElt.addAttribute(MailService.A_APPT_DATETIME, dtEnd.getDateTimePartString());                String tzName = dtEnd.getTZName();                if (tzName != null) {                    endElt.addAttribute(MailService.A_APPT_TIMEZONE, tzName);                }            }                        ParsedDuration dur = invite.getDuration();            if (dur != null) {                dur.toXml(e);            }                        e.addAttribute(MailService.A_NAME, invite.getName());            e.addAttribute(MailService.A_APPT_LOCATION, invite.getLocation());                        // Organizer            ZOrganizer org = invite.getOrganizer();            if (org != null) {                Element orgElt = e.addUniqueElement(MailService.E_APPT_ORGANIZER);                                if (org.hasCn()) {                    orgElt.addAttribute(MailService.A_DISPLAY, org.getCn());                }                String str = org.getAddress();                orgElt.addAttribute(MailService.A_URL, str);            }                        // Attendee(s)            Collection /*Invite.ZAttendee*/ ats = invite.getAttendees();            for (Iterator atsIter = ats.iterator();atsIter.hasNext();) {                Element atElt = e.addElement(MailService.E_APPT_ATTENDEE);                                ZAttendee at = (ZAttendee)atsIter.next();                                // display name                 if (at.hasCn()) {                    atElt.addAttribute(MailService.A_DISPLAY, at.getCn());                }                // calendar user type                if (at.hasCUType()) {                	atElt.addAttribute(MailService.A_APPT_CUTYPE, at.getCUType());                }                // role                if (at.hasRole()) {                    atElt.addAttribute(MailService.A_APPT_ROLE, at.getRole());                }                                // participation status                if (at.hasPartStat()) {                    atElt.addAttribute(MailService.A_APPT_PARTSTAT, at.getPartStat());                }                                // uri                atElt.addAttribute(MailService.A_URL, at.getAddress());            }        }        return e;    }