コード例 #1
0
        // Token: 0x06000928 RID: 2344 RVA: 0x0003E288 File Offset: 0x0003C488
        private static void HandleCalendarEvent(ExDateTime eventTime, MailboxData mailboxData, MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            CalendarChangeProcessor.< > c__DisplayClassc CS$ < > 8__locals1 = new CalendarChangeProcessor.< > c__DisplayClassc();
            CS$ < > 8__locals1.mailboxData = mailboxData;
            CS$ < > 8__locals1.mapiEvent   = mapiEvent;
            if (!NotificationFactories.Instance.IsReminderEnabled(CS$ < > 8__locals1.mailboxData.Settings))
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore cal event because reminder is disabled for user {0}, event: {1}", CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.mapiEvent);
                return;
            }
            CS$ < > 8__locals1.type = CalendarChangeProcessor.AnalyzeEvent(CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.mapiEvent, item);
            if (CS$ < > 8__locals1.type == CalendarNotificationType.Uninteresting)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore cal event due to uninteresting for user {0}, event: {1}", CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.mapiEvent);
                return;
            }
            CS$ < > 8__locals1.calItemId = ((item == null) ? StoreObjectId.FromProviderSpecificId(CS$ < > 8__locals1.mapiEvent.ItemEntryId) : item.Id.ObjectId);
            CalendarItem calendarItem = (CalendarItem)item;
            TimeSpan     t            = TimeSpan.FromDays(1.0);

            CS$ < > 8__locals1.calEvents = null;
            if (item != null)
            {
                TimeSpan t2 = TimeSpan.FromMinutes((double)calendarItem.Reminder.MinutesBeforeStart) + TimeSpan.FromTicks(1L);
                Interval <ExDateTime> interval = new Interval <ExDateTime>(eventTime, false, eventTime + t + t2, true);
                CS$ < > 8__locals1.calEvents = OccurrenceLoader.Load(eventTime, CS$ < > 8__locals1.mailboxData.Settings.TimeZone.ExTimeZone, itemStore, null, calendarItem, null, interval.Minimum, interval.Maximum);
            }
            else
            {
                CS$ < > 8__locals1.calEvents = new List <CalendarInfo>();
            }
            CS$ < > 8__locals1.eventsToBeRemoved = new List <CalendarInfo>();
            if (CalendarNotificationType.ChangedUpdate == CS$ < > 8__locals1.type)
            {
                CS$ < > 8__locals1.calEvents.RemoveAll(delegate(CalendarInfo calInfo)
                {
                    CalendarNotificationType calendarNotificationType = CalendarChangeProcessor.AnalyzeEvent(CS$ < > 8__locals1.mapiEvent, CS$ < > 8__locals1.mailboxData.DefaultCalendarFolderId, calInfo.AppointmentState, calInfo.ChangeHighlight, calInfo.ResponseType);
                    if (calendarNotificationType == CalendarNotificationType.Uninteresting)
                    {
                        return(true);
                    }
                    if (CalendarNotificationType.DeletedUpdate == calendarNotificationType)
                    {
                        CS$ < > 8__locals1.eventsToBeRemoved.Add(calInfo);
                        return(true);
                    }
                    return(false);
                });
            }
            using (ManualResetEvent customizedOperationFinished = new ManualResetEvent(false))
            {
                CalendarNotificationInitiator.PerformCustomizedOperationOnActionsList(delegate
                {
                    try
                    {
                        using (CS$ < > 8__locals1.mailboxData.CreateReadLock())
                        {
                            CalendarChangeProcessor.UpdateReminder(CS$ < > 8__locals1.type, CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.calItemId, CS$ < > 8__locals1.calEvents, CS$ < > 8__locals1.eventsToBeRemoved);
                        }
                    }
                    finally
                    {
                        customizedOperationFinished.Set();
                    }
                }, "HandleCalendarEvent");
コード例 #2
0
        // Token: 0x06000927 RID: 2343 RVA: 0x0003DEC0 File Offset: 0x0003C0C0
        private static void HandleMeetingEvent(ExDateTime eventTime, MailboxData mailboxData, MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            if (item == null || !NotificationFactories.Instance.IsInterestedInCalendarMeetingEvent(mailboxData.Settings))
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore event because update is disabled for user {0}, event: {1}", mailboxData, mapiEvent);
                return;
            }
            if (object.Equals(item.Id.ObjectId, mailboxData.DefaultDeletedItemsFolderId) || object.Equals(item.Id.ObjectId, mailboxData.DefaultJunkEmailFolderId))
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore event because item has been deleted for user {0}, event: {1}", mailboxData, mapiEvent);
                return;
            }
            MeetingMessage meetingMessage = item as MeetingMessage;

            if (meetingMessage == null)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Meeting event handler could do nothing because the item is not meeting message for user {0}, event: {1}", mailboxData, mapiEvent);
                return;
            }
            if (meetingMessage.IsDelegated() || meetingMessage.IsMailboxOwnerTheSender() || meetingMessage.IsOutOfDate())
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore event because mtg is delegated or out of data or is ornizer for user {0}, event: {1}", mailboxData, mapiEvent);
                return;
            }
            CalendarNotificationType calendarNotificationType = CalendarChangeProcessor.AnalyzeEvent(mapiEvent, meetingMessage);

            if (calendarNotificationType == CalendarNotificationType.Uninteresting)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore mtg event due to uninteresting for user {0}, event: {1}", mailboxData, mapiEvent);
                return;
            }
            List <CalendarInfo>   list             = null;
            Interval <ExDateTime> interval         = new Interval <ExDateTime>(eventTime, false, eventTime + TimeSpan.FromDays((double)mailboxData.Settings.Text.TextNotification.NextDays), true);
            CalendarItemBase      calendarItemBase = null;

            try
            {
                calendarItemBase = meetingMessage.GetCorrelatedItem();
                if (!meetingMessage.TryUpdateCalendarItem(ref calendarItemBase, false))
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore mtg event because TryUpdateCalendarItem failed for user {0}, event: {1}", mailboxData, mapiEvent);
                    return;
                }
                list = OccurrenceLoader.Load(eventTime, mailboxData.Settings.TimeZone.ExTimeZone, itemStore, meetingMessage as MeetingRequest, calendarItemBase, mailboxData.Settings.Text.TextNotification.CalendarNotificationSettings.UpdateSettings.Duration.NonWorkHoursExcluded ? mailboxData.Settings.Text.WorkingHours : null, interval.Minimum, interval.Maximum);
            }
            finally
            {
                if (calendarItemBase != null)
                {
                    calendarItemBase.Dispose();
                    calendarItemBase = null;
                }
            }
            int num = 0;

            foreach (CalendarInfo calendarInfo in list)
            {
                if (calendarInfo.IsInteresting(calendarNotificationType))
                {
                    CalendarNotificationInitiator.ScheduleAction(new UpdateEmitting(mailboxData, calendarInfo, calendarNotificationType), "HandleMeetingEvent");
                    num++;
                }
            }
            ExTraceGlobals.AssistantTracer.TraceDebug((long)typeof(CalendarChangeProcessor).GetHashCode(), "{0} updates has been sent according to mtg msg {1} for user {2}, type: {3}, event: {4}", new object[]
            {
                num,
                meetingMessage.Id.ObjectId,
                mailboxData,
                calendarNotificationType,
                mapiEvent
            });
        }