示例#1
0
        // Token: 0x0600098A RID: 2442 RVA: 0x000400D0 File Offset: 0x0003E2D0
        private static void EnableUser(ref MailboxData mailboxData, ExDateTime userNow)
        {
            string legacyDN = mailboxData.Settings.LegacyDN;

            try
            {
                CalendarNotificationInitiator.CountInMailbox(mailboxData.DatabaseGuid, mailboxData.MailboxGuid);
                CalendarNotificationInitiator.UpdateCacheAndInitiateEmittings(ref mailboxData, userNow);
                ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)typeof(CalendarNotificationInitiator).GetHashCode(), "notif enabled, user: {0}", legacyDN);
            }
            catch (Exception ex)
            {
                if (!CalendarNotificationAssistant.TryHandleException((long)typeof(CalendarNotificationInitiator).GetHashCode(), "handling enabling", legacyDN, ex))
                {
                    throw;
                }
            }
        }
        // Token: 0x0600091E RID: 2334 RVA: 0x0003D7E8 File Offset: 0x0003B9E8
        private static CalendarNotificationType AnalyzeEvent(MailboxData mailboxData, MapiEvent mapiEvent, StoreObject item)
        {
            StoreObjectId defaultCalendarFolderId = mailboxData.DefaultCalendarFolderId;

            if (item == null)
            {
                return(CalendarNotificationType.DeletedUpdate);
            }
            AppointmentStateFlags     valueOrDefault            = item.GetValueOrDefault <AppointmentStateFlags>(CalendarItemBaseSchema.AppointmentState);
            ChangeHighlightProperties changeHighlightProperties = item.GetValueOrDefault <ChangeHighlightProperties>(CalendarItemBaseSchema.ChangeHighlight);
            CalendarItemType          valueOrDefault2           = item.GetValueOrDefault <CalendarItemType>(CalendarItemBaseSchema.CalendarItemType, CalendarItemType.Single);
            ResponseType valueOrDefault3 = item.GetValueOrDefault <ResponseType>(CalendarItemBaseSchema.ResponseType, ResponseType.None);

            if (changeHighlightProperties == ChangeHighlightProperties.None && valueOrDefault2 != CalendarItemType.Single)
            {
                changeHighlightProperties = (ChangeHighlightProperties)(-1);
            }
            return(CalendarChangeProcessor.AnalyzeEvent(mapiEvent, defaultCalendarFolderId, valueOrDefault, changeHighlightProperties, valueOrDefault3));
        }
        // Token: 0x060009C9 RID: 2505 RVA: 0x00040FA4 File Offset: 0x0003F1A4
        internal bool TryCreateReminderEmitting(CalendarInfo CalendarInfo, MailboxData mailboxData, out ReminderEmitting reminderEmitting)
        {
            reminderEmitting = null;
            List <ICalendarNotificationEmitter> list = new List <ICalendarNotificationEmitter>();

            foreach (NotificationFactoryBase notificationFactoryBase in this.factories)
            {
                ICalendarNotificationEmitter item;
                if (notificationFactoryBase.TryCreateEmitter(CalendarInfo, mailboxData, out item))
                {
                    list.Add(item);
                }
            }
            if (list.Count > 0)
            {
                reminderEmitting = new ReminderEmitting(CalendarInfo.ReminderTime, mailboxData, CalendarInfo, list);
            }
            return(reminderEmitting != null);
        }
示例#4
0
 // Token: 0x0600097D RID: 2429 RVA: 0x0003FA78 File Offset: 0x0003DC78
 public static void StopEmittingReminder(MailboxData mailboxData)
 {
     if (!NotificationFactories.Instance.IsReminderEnabled(mailboxData.Settings))
     {
         return;
     }
     CalendarNotificationInitiator.PerformCustomizedOperationOnActionsList(delegate
     {
         mailboxData.Actions.ForEach(delegate(CalendarNotificationAction action)
         {
             Type type = action.GetType();
             if (typeof(ReminderEmitting) != type && typeof(ReminderReloading) != type)
             {
                 return;
             }
             CalendarNotificationInitiator.CompleteAction(action, "StopEmittingReminder");
         });
     }, "StopEmittingReminder");
 }
        // Token: 0x060009A4 RID: 2468 RVA: 0x00040A08 File Offset: 0x0003EC08
        public static MailboxData CreateFromUserSettings(UserSettings settings)
        {
            MailboxData result;

            try
            {
                MailboxData       mailboxData  = null;
                ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLegacyDN(settings.GetADSettings(), settings.LegacyDN);
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=GetInitialState"))
                {
                    mailboxData = new MailboxData(mailboxSession);
                }
                mailboxData.Settings = settings;
                result = mailboxData;
            }
            catch (AdUserNotFoundException arg)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <string, AdUserNotFoundException>((long)typeof(MailboxData).GetHashCode(), "cannot find AD user: {0}", settings.LegacyDN, arg);
                result = null;
            }
            return(result);
        }
        // Token: 0x06000925 RID: 2341 RVA: 0x0003DD58 File Offset: 0x0003BF58
        private static void UpdateReminder(CalendarNotificationType type, MailboxData mailboxData, StoreObjectId calItemId, IList <CalendarInfo> calEvents, IList <CalendarInfo> eventsToBeRemoved)
        {
            switch (type)
            {
            case CalendarNotificationType.NewUpdate:
            case CalendarNotificationType.ChangedUpdate:
                if (0 < calEvents.Count || 0 < eventsToBeRemoved.Count)
                {
                    CalendarChangeProcessor.UpdateReminderAccordingToChangedUpdate(mailboxData, calEvents, eventsToBeRemoved);
                    return;
                }
                CalendarChangeProcessor.UpdateReminderAccordingToDeletedUpdate(mailboxData, calItemId);
                return;

            case CalendarNotificationType.DeletedUpdate:
                CalendarChangeProcessor.UpdateReminderAccordingToDeletedUpdate(mailboxData, calItemId);
                return;

            default:
                throw new InvalidOperationException("unsupported CalendarNotificationType");
            }
        }
示例#7
0
 // Token: 0x06000989 RID: 2441 RVA: 0x0003FFE4 File Offset: 0x0003E1E4
 private static void DisableUser(UserSettings settings, Guid mailboxGuid)
 {
     try
     {
         MailboxData mailboxData = MailboxData.CreateFromUserSettings(settings);
         if (mailboxData != null)
         {
             try
             {
                 MailboxData mailboxData2 = MailboxData.UpdateCache(ref mailboxData);
                 using (mailboxData2.CreateReadLock())
                 {
                     using (mailboxData2.Actions.SyncObj.CreateWriteLock())
                     {
                         CalendarNotificationInitiator.StopAll(mailboxData2);
                     }
                 }
             }
             finally
             {
                 if (mailboxData != null)
                 {
                     mailboxData.Dispose();
                     mailboxData = null;
                 }
             }
         }
         ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)typeof(CalendarNotificationInitiator).GetHashCode(), "notif disabled, user: {0}", settings.LegacyDN);
     }
     catch (Exception ex)
     {
         if (!CalendarNotificationAssistant.TryHandleException((long)typeof(CalendarNotificationInitiator).GetHashCode(), "handling diabling", settings.LegacyDN, ex))
         {
             throw;
         }
     }
 }
        // Token: 0x06000926 RID: 2342 RVA: 0x0003DDB4 File Offset: 0x0003BFB4
        internal void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            MailboxData fromCache = MailboxData.GetFromCache(mapiEvent.MailboxGuid);

            if (fromCache == null)
            {
                return;
            }
            using (fromCache.CreateReadLock())
            {
                ExDateTime eventTime = new ExDateTime(fromCache.Settings.TimeZone.ExTimeZone, mapiEvent.CreateTime);
                try
                {
                    if (ObjectClass.IsMeetingMessage(mapiEvent.ObjectClass))
                    {
                        CalendarChangeProcessor.HandleMeetingEvent(eventTime, fromCache, mapiEvent, itemStore, item);
                    }
                    else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(mapiEvent.ObjectClass))
                    {
                        CalendarChangeProcessor.HandleCalendarEvent(eventTime, fromCache, mapiEvent, itemStore, item);
                    }
                    else
                    {
                        ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent>((long)this.GetHashCode(), "why runs to here?! unhandled event for user {0}, event: {1}", itemStore.MailboxOwner, mapiEvent);
                    }
                }
                catch (ConnectionFailedTransientException arg)
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent, ConnectionFailedTransientException>((long)this.GetHashCode(), "Exception is caught for user {0} when processing event: {1}\n{2}", itemStore.MailboxOwner, mapiEvent, arg);
                }
                catch (AdUserNotFoundException arg2)
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent, AdUserNotFoundException>((long)this.GetHashCode(), "Exception is caught for user {0} when processing event: {1}\n{2}", itemStore.MailboxOwner, mapiEvent, arg2);
                }
            }
        }
示例#9
0
 // Token: 0x06000982 RID: 2434 RVA: 0x0003FC73 File Offset: 0x0003DE73
 public static void ResetEmittingSummary(ExDateTime now, MailboxData mailboxData)
 {
     CalendarNotificationInitiator.StopEmittingSummary(mailboxData);
     CalendarNotificationInitiator.InitiateEmittingSummary(now, mailboxData);
 }
 // Token: 0x06000A28 RID: 2600 RVA: 0x00042F38 File Offset: 0x00041138
 public TextMessagingEmitter(MailboxData mailboxData)
 {
     this.MailboxData = mailboxData;
 }
示例#11
0
 // Token: 0x06000906 RID: 2310 RVA: 0x0003CF3D File Offset: 0x0003B13D
 public ReminderEmitting(ExDateTime expectedTime, MailboxData mailboxData, CalendarInfo calInfo) : base(expectedTime, mailboxData)
 {
     this.CalendarInfo = calInfo;
     this.Emitters     = new List <ICalendarNotificationEmitter>();
     this.Emitters.Add(new TextNotificationFactory.TextMessagingEmitter(mailboxData));
 }
示例#12
0
 // Token: 0x06000905 RID: 2309 RVA: 0x0003CF24 File Offset: 0x0003B124
 public ReminderEmitting(ExDateTime expectedTime, MailboxData mailboxData, CalendarInfo calInfo, List <ICalendarNotificationEmitter> emitters) : base(expectedTime, mailboxData)
 {
     this.CalendarInfo = calInfo;
     this.Emitters     = emitters;
 }
示例#13
0
 // Token: 0x06000915 RID: 2325 RVA: 0x0003D3B4 File Offset: 0x0003B5B4
 public SummaryGenerating(ExDateTime startTime, ExDateTime expectedTime, MailboxData mailboxData) : base(expectedTime, mailboxData)
 {
     base.ExpectedTime = SummaryGenerating.GetDayLightTransitionAdjustedTime(startTime, expectedTime, mailboxData.Settings.TimeZone.ExTimeZone);
 }
 // Token: 0x06000912 RID: 2322 RVA: 0x0003D10C File Offset: 0x0003B30C
 public ReminderReloading(ExDateTime expectedTime, MailboxData mailboxData) : base(expectedTime, mailboxData)
 {
 }
 // Token: 0x060009CC RID: 2508
 internal abstract bool TryCreateEmitter(CalendarInfo calendarInfo, MailboxData mailboxData, out ICalendarNotificationEmitter emitter);
        // 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");
        // 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
            });
        }
        // Token: 0x06000924 RID: 2340 RVA: 0x0003DBB0 File Offset: 0x0003BDB0
        private static void UpdateReminderAccordingToChangedUpdate(MailboxData mailboxData, IList <CalendarInfo> calEvents, IList <CalendarInfo> eventsToBeRemoved)
        {
            List <CalendarInfo> eventsToBeAdded        = new List <CalendarInfo>(calEvents);
            ExDateTime          nextReminderReloadTime = ExDateTime.MinValue;

            mailboxData.Actions.ForEach(delegate(CalendarNotificationAction action)
            {
                if (typeof(ReminderReloading) == action.GetType())
                {
                    nextReminderReloadTime = action.ExpectedTime;
                    return;
                }
                if (typeof(ReminderEmitting) != action.GetType())
                {
                    return;
                }
                CalendarInfo calendarInfo2 = ((ReminderEmitting)action).CalendarInfo;
                IList <CalendarInfo> list  = null;
                CalendarInfo calendarInfo3 = null;
                if (CalendarChangeProcessor.TryGetMatched(eventsToBeRemoved, calendarInfo2.CalendarItemIdentity, calendarInfo2.CalendarItemOccurrenceIdentity, true, out list, out calendarInfo3) && calendarInfo3 != null)
                {
                    CalendarNotificationInitiator.CompleteAction(action, "UpdateReminderAccordingToChangedUpdate");
                }
                list          = null;
                calendarInfo3 = null;
                if (CalendarChangeProcessor.TryGetMatched(eventsToBeAdded, calendarInfo2.CalendarItemIdentity, calendarInfo2.CalendarItemOccurrenceIdentity, true, out list, out calendarInfo3))
                {
                    eventsToBeAdded.Remove(calendarInfo3);
                    ReminderEmitting action3;
                    if (!calendarInfo3.ReminderIsSet || !calendarInfo3.IsInteresting(CalendarNotificationType.ChangedUpdate) || calendarInfo3.ReminderTime < calendarInfo3.CreationRequestTime || !NotificationFactories.Instance.TryCreateReminderEmitting(calendarInfo3, action.Context, out action3))
                    {
                        CalendarNotificationInitiator.CompleteAction(action, "UpdateReminderAccordingToChangedUpdate");
                        return;
                    }
                    CalendarNotificationInitiator.UpdateAction(action, action3, "UpdateReminderAccordingToChangedUpdate");
                }
            });
            foreach (CalendarInfo calendarInfo in eventsToBeAdded)
            {
                if (calendarInfo.ReminderIsSet)
                {
                    if (calendarInfo.ReminderTime < calendarInfo.CreationRequestTime)
                    {
                        ExTraceGlobals.AssistantTracer.TraceDebug((long)typeof(CalendarChangeProcessor).GetHashCode(), "Reminder is out of date, subj: {0}, usr: {1}, event_t: {2}, rmd_t: {3}, s_t: {4}, e_t: {5}", new object[]
                        {
                            calendarInfo.NormalizedSubject,
                            mailboxData.Settings.LegacyDN,
                            calendarInfo.CreationRequestTime,
                            calendarInfo.ReminderTime,
                            calendarInfo.StartTime,
                            calendarInfo.EndTime
                        });
                    }
                    else if (nextReminderReloadTime == ExDateTime.MinValue || calendarInfo.ReminderTime <= nextReminderReloadTime)
                    {
                        ReminderEmitting action2;
                        if (NotificationFactories.Instance.TryCreateReminderEmitting(calendarInfo, mailboxData, out action2))
                        {
                            CalendarNotificationInitiator.ScheduleAction(action2, "UpdateReminderAccordingToChangedUpdate");
                        }
                    }
                    else
                    {
                        ExTraceGlobals.AssistantTracer.TraceDebug <ExDateTime, ExDateTime>((long)typeof(CalendarChangeProcessor).GetHashCode(), "We didn't process this event because reminderTime {0} is greater nextReminderReloadTime {1}. ", calendarInfo.ReminderTime, nextReminderReloadTime);
                    }
                }
            }
        }
        // Token: 0x06000A3A RID: 2618 RVA: 0x0004380C File Offset: 0x00041A0C
        public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            if (MailboxData.GetFromCache(mapiEvent.MailboxGuid) == null)
            {
                using (MailboxData.CachedStateWriter cachedStateWriter = new MailboxData.CachedStateWriter(mapiEvent.MailboxGuid))
                {
                    if (cachedStateWriter.Get() == null)
                    {
                        MailboxData mailboxData = new MailboxData(itemStore);
                        cachedStateWriter.Set(mailboxData);
                    }
                }
            }
            MessageItem messageItem = item as MessageItem;

            if (messageItem == null)
            {
                return;
            }
            int?valueAsNullable = messageItem.GetValueAsNullable <int>(ItemSchema.InternetMessageIdHash);

            if (valueAsNullable == null)
            {
                return;
            }
            string valueOrDefault = messageItem.GetValueOrDefault <string>(ItemSchema.InternetMessageId, null);

            if (string.IsNullOrEmpty(valueOrDefault))
            {
                return;
            }
            int?valueAsNullable2 = messageItem.GetValueAsNullable <int>(MessageItemSchema.TextMessageDeliveryStatus);

            if (valueAsNullable2 == null)
            {
                return;
            }
            List <IStorePropertyBag> list = new List <IStorePropertyBag>(1);

            using (Folder folder = Folder.Bind(itemStore, DefaultFolderType.SentItems))
            {
                using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, new SortBy[]
                {
                    new SortBy(ItemSchema.InternetMessageIdHash, SortOrder.Ascending)
                }, new PropertyDefinition[]
                {
                    ItemSchema.InternetMessageIdHash,
                    ItemSchema.Id,
                    ItemSchema.InternetMessageId,
                    MessageItemSchema.TextMessageDeliveryStatus
                }))
                {
                    if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.InternetMessageIdHash, valueAsNullable)))
                    {
                        return;
                    }
                    bool flag = false;
                    while (!flag)
                    {
                        IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(1);
                        if (propertyBags == null || 0 >= propertyBags.Length)
                        {
                            break;
                        }
                        for (int i = 0; i < propertyBags.Length; i++)
                        {
                            int?num = propertyBags[i].TryGetProperty(ItemSchema.InternetMessageIdHash) as int?;
                            if (num == null)
                            {
                                break;
                            }
                            if (num.Value != valueAsNullable)
                            {
                                flag = true;
                                break;
                            }
                            string a = propertyBags[i].TryGetProperty(ItemSchema.InternetMessageId) as string;
                            if (string.Equals(a, valueOrDefault))
                            {
                                list.Add(propertyBags[i]);
                            }
                        }
                    }
                }
            }
            foreach (IStorePropertyBag storePropertyBag in list)
            {
                int?num2 = storePropertyBag.TryGetProperty(MessageItemSchema.TextMessageDeliveryStatus) as int?;
                if (num2 == null || !(num2 >= valueAsNullable2))
                {
                    VersionedId versionedId = storePropertyBag.TryGetProperty(ItemSchema.Id) as VersionedId;
                    if (versionedId != null && versionedId.ObjectId != null)
                    {
                        using (MessageItem messageItem2 = MessageItem.Bind(itemStore, versionedId.ObjectId))
                        {
                            messageItem2.OpenAsReadWrite();
                            messageItem2.SetProperties(TextMessageDeliveryStatusProcessor.propertyDeliveryStatus, new object[]
                            {
                                valueAsNullable2
                            });
                            messageItem2.Save(SaveMode.ResolveConflicts);
                        }
                    }
                }
            }
        }
 // Token: 0x060009BC RID: 2492 RVA: 0x00040D94 File Offset: 0x0003EF94
 public void Set(MailboxData mailboxData)
 {
     this.cachedState.State[8] = mailboxData;
 }
 // Token: 0x0600090D RID: 2317 RVA: 0x0003D028 File Offset: 0x0003B228
 public UpdateEmitting(MailboxData mailboxData, CalendarInfo calInfo, CalendarNotificationType type) : base(ExDateTime.Now, mailboxData, calInfo)
 {
     this.Type = type;
 }
示例#22
0
        // Token: 0x060008F8 RID: 2296 RVA: 0x0003C90C File Offset: 0x0003AB0C
        private void InitializeUserSettings(long cookie)
        {
            SystemMailbox instance = SystemMailbox.GetInstance(base.Context);

            if (!instance.IsValid())
            {
                this.ReloadSystemMailbox(cookie, instance);
            }
            Dictionary <string, UserSettings> allCalendarNotificationUsers = SystemMailbox.GetInstance(base.Context).GetAllCalendarNotificationUsers();

            foreach (KeyValuePair <string, UserSettings> keyValuePair in allCalendarNotificationUsers)
            {
                UserSettings value = keyValuePair.Value;
                if (!base.ShouldContinue(cookie))
                {
                    break;
                }
                if (value.Voice != null || value.Text != null)
                {
                    MailboxData mailboxData = null;
                    try
                    {
                        mailboxData = MailboxData.CreateFromUserSettings(value);
                        if (mailboxData != null)
                        {
                            if (!base.ShouldContinue(cookie))
                            {
                                break;
                            }
                            CalendarNotificationInitiator.CountInMailbox(mailboxData.DatabaseGuid, mailboxData.MailboxGuid);
                            ExDateTime  now          = value.TimeZone.ExTimeZone.ConvertDateTime(base.ExpectedTime);
                            MailboxData mailboxData2 = null;
                            using (mailboxData.CreateReadLock())
                            {
                                mailboxData2 = MailboxData.UpdateCache(ref mailboxData);
                            }
                            using (mailboxData2.CreateReadLock())
                            {
                                using (mailboxData2.Actions.SyncObj.CreateWriteLock())
                                {
                                    CalendarNotificationInitiator.InitiateEmittingReminder(now, mailboxData2);
                                    CalendarNotificationInitiator.InitiateEmittingSummary(now, mailboxData2);
                                }
                            }
                            ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "notif initialized, user: {0}", value.LegacyDN);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "initiating", value.LegacyDN, ex))
                        {
                            throw;
                        }
                    }
                    finally
                    {
                        if (mailboxData != null)
                        {
                            mailboxData.Dispose();
                            mailboxData = null;
                        }
                    }
                }
            }
        }