Пример #1
0
        private void SendOrganizerRums(OrganizerRumInfo info, bool copyToSentItems, CalendarItemBase item, ref Dictionary <GlobalObjectId, List <Attendee> > sentRumsToCheck)
        {
            bool            flag = false;
            List <Attendee> list;

            if (sentRumsToCheck.ContainsKey(item.GlobalObjectId))
            {
                flag = true;
                list = sentRumsToCheck[item.GlobalObjectId];
                for (int i = info.AttendeeList.Count - 1; i > -1; i--)
                {
                    Attendee attendee = info.AttendeeList[i];
                    if (!attendee.IsSendable() || this.AttendeeListContainsParticipant(list, attendee.Participant, item.Session as MailboxSession))
                    {
                        info.AttendeeList.RemoveAt(i);
                    }
                }
            }
            else
            {
                list = new List <Attendee>(info.AttendeeList.Count);
            }
            if (info.AttendeeList.Count != 0)
            {
                if (info is UpdateRumInfo)
                {
                    UpdateRumInfo rumInfo = (UpdateRumInfo)info;
                    if (item.CalendarItemType == CalendarItemType.Occurrence)
                    {
                        item.SendForwardRum(rumInfo, copyToSentItems);
                    }
                    else
                    {
                        item.SendUpdateRums(rumInfo, copyToSentItems);
                    }
                }
                else
                {
                    if (!(info is CancellationRumInfo))
                    {
                        throw new NotSupportedException(info.GetType().ToString());
                    }
                    CancellationRumInfo rumInfo2 = (CancellationRumInfo)info;
                    item.SendCancellationRums(rumInfo2, copyToSentItems);
                }
                list.AddRange(info.AttendeeList);
                if (!flag)
                {
                    sentRumsToCheck.Add(item.GlobalObjectId, list);
                }
            }
            info.AttendeeList.Clear();
        }
Пример #2
0
        protected override void Merge(RumInfo infoToMerge)
        {
            if (infoToMerge is UpdateRumInfo)
            {
                base.Merge(infoToMerge);
                UpdateRumInfo updateRumInfo = (UpdateRumInfo)infoToMerge;
                this.InconsistencyFlagList = this.InconsistencyFlagList.Union(updateRumInfo.InconsistencyFlagList);
                return;
            }
            string message = string.Format("An update RUM can be merged only with another update RUM. RumInfo type is {0}", infoToMerge.GetType());

            throw new ArgumentException(message, "infoToMerge");
        }
Пример #3
0
        public MeetingInquiryAction Process(CalendarVersionStoreGateway cvsGateway)
        {
            this.CheckDisposed("Process");
            VersionedId id;

            MeetingInquiryMessage.ExistingCalendarItemError existingCalendarItemError;
            byte[] providerLevelItemId;
            using (CalendarFolder calendarFolder = CalendarFolder.Bind(this.MailboxSession, DefaultFolderType.Calendar))
            {
                existingCalendarItemError = this.CheckExistingCalendarItem(calendarFolder, out id);
                providerLevelItemId       = calendarFolder.Id.ObjectId.ProviderLevelItemId;
            }
            switch (existingCalendarItemError)
            {
            case MeetingInquiryMessage.ExistingCalendarItemError.None:
                return(this.TryRepairMissingItem(cvsGateway, providerLevelItemId));

            case MeetingInquiryMessage.ExistingCalendarItemError.MeetingAlreadyExists:
                return(MeetingInquiryAction.MeetingAlreadyExists);

            case MeetingInquiryMessage.ExistingCalendarItemError.OccurrenceInquiry:
                using (CalendarItem calendarItem = CalendarItem.Bind(base.Session, id))
                {
                    MeetingInquiryMessage.OccurrenceInquiryError occurrenceInquiryError = this.CheckOccurrence(calendarItem);
                    switch (occurrenceInquiryError)
                    {
                    case MeetingInquiryMessage.OccurrenceInquiryError.None:
                        return(this.TryRepairMissingItem(cvsGateway, providerLevelItemId));

                    case MeetingInquiryMessage.OccurrenceInquiryError.InvalidOccurrence:
                    {
                        UpdateRumInfo rumInfo = UpdateRumInfo.CreateMasterInstance(this.GetRumAttendees(calendarItem), CalendarInconsistencyFlag.RecurrenceBlob);
                        calendarItem.SendUpdateRums(rumInfo, false);
                        return(MeetingInquiryAction.SendUpdateForMaster);
                    }

                    case MeetingInquiryMessage.OccurrenceInquiryError.ExistingOccurrence:
                        return(MeetingInquiryAction.ExistingOccurrence);

                    default:
                        throw new InvalidOperationException(string.Format("An invalid error code is returned: {0}.", occurrenceInquiryError));
                    }
                }
                break;
            }
            throw new InvalidOperationException(string.Format("An invalid error code is returned: {0}.", existingCalendarItemError));
        }
        public void SendRumUpdate(ref CalendarItemBase originalCalendarItem)
        {
            if (originalCalendarItem == null)
            {
                return;
            }
            CalendarInconsistencyFlag inconsistencyFlag;

            if (this.MatchesOrganizerItem(ref originalCalendarItem, out inconsistencyFlag))
            {
                return;
            }
            List <BlobRecipient> mfnaddedAttendees  = this.GetMFNAddedAttendees();
            IAttendeeCollection  attendeeCollection = originalCalendarItem.AttendeeCollection;
            Participant          organizer          = originalCalendarItem.Organizer;
            List <Attendee>      list           = new List <Attendee>();
            MailboxSession       mailboxSession = base.MailboxSession;

            foreach (BlobRecipient blobRecipient in mfnaddedAttendees)
            {
                list.Add(originalCalendarItem.AttendeeCollection.Add(blobRecipient.Participant, AttendeeType.Required, null, null, false));
            }
            if (list.Count > 0)
            {
                UpdateRumInfo rumInfo;
                if (originalCalendarItem.GlobalObjectId.IsCleanGlobalObjectId)
                {
                    rumInfo = UpdateRumInfo.CreateMasterInstance(list, inconsistencyFlag);
                }
                else
                {
                    rumInfo = UpdateRumInfo.CreateOccurrenceInstance(originalCalendarItem.GlobalObjectId.Date, list, inconsistencyFlag);
                }
                originalCalendarItem.SendUpdateRums(rumInfo, false);
            }
        }
Пример #5
0
        private void DecorateGeneralUpdateRumBody(MessageItem message, string textToInject, UpdateRumInfo info)
        {
            KeyValuePair <string, List <string> > item            = new KeyValuePair <string, List <string> >(this.GetLocalizedString(ClientStrings.UpdateRumInconsistencyFlagsLabel, message), new List <string>());
            HashSet <CalendarInconsistencyGroup>  projectedGroups = new HashSet <CalendarInconsistencyGroup>();

            foreach (CalendarInconsistencyFlag flag in info.InconsistencyFlagList)
            {
                this.ProjectInconsistencyFlag(message, item.Value, projectedGroups, flag);
            }
            List <KeyValuePair <string, List <string> > > list;

            if (item.Value.Count == 0)
            {
                list = null;
            }
            else
            {
                list = new List <KeyValuePair <string, List <string> > >(1);
                list.Add(item);
            }
            this.DecorateRumBody(message, textToInject, this.GetLocalizedString(ClientStrings.UpdateRumDescription, message), list);
        }