Esempio n. 1
0
 // Token: 0x06000916 RID: 2326 RVA: 0x0003D3DC File Offset: 0x0003B5DC
 protected override void OnPerforming(long cookie)
 {
     using (base.Context.CreateReadLock())
     {
         if (base.ShouldContinue(cookie))
         {
             if (NotificationFactories.Instance.IsSummaryEnabled(base.Context.Settings))
             {
                 ExDateTime exDateTime  = base.ExpectedTime.Date + base.Context.Settings.Text.TextNotification.CalendarNotificationSettings.SummarySettings.NotifyingTimeInDay.TimeOfDay;
                 ExDateTime exDateTime2 = exDateTime + TimeSpan.FromDays(base.Context.Settings.Text.TextNotification.CalendarNotificationSettings.SummarySettings.Duration.Interval);
                 try
                 {
                     using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(ExchangePrincipal.FromLocalServerMailboxGuid(base.Context.Settings.GetADSettings(), base.Context.DatabaseGuid, base.Context.MailboxGuid), CultureInfo.InvariantCulture, "Client=TBA;Action=ReloadReminders"))
                     {
                         if (base.ShouldContinue(cookie))
                         {
                             IList <CalendarInfo> list = SummaryLoader.Load(base.ExpectedTime, base.Context.Settings.TimeZone.ExTimeZone, mailboxSession, base.Context.DefaultCalendarFolderId, null, exDateTime, exDateTime2);
                             if (0 < list.Count && base.ShouldContinue(cookie))
                             {
                                 new TextNotificationFactory.TextMessagingEmitter(base.Context).Emit(mailboxSession, CalendarNotificationType.Summary, list);
                             }
                         }
                     }
                 }
                 finally
                 {
                     if (base.ShouldContinue(cookie))
                     {
                         CalendarNotificationInitiator.ScheduleAction(new SummaryGenerating(exDateTime, exDateTime2, base.Context), base.GetType().Name);
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
        // Token: 0x0600097A RID: 2426 RVA: 0x0003F83C File Offset: 0x0003DA3C
        public static void ExcludeDatabase(Guid databaseGuid)
        {
            HashSet <Guid> hashSet = null;

            lock (CalendarNotificationInitiator.mailboxGroups)
            {
                if (CalendarNotificationInitiator.mailboxGroups.ContainsKey(databaseGuid))
                {
                    hashSet = CalendarNotificationInitiator.mailboxGroups[databaseGuid];
                    CalendarNotificationInitiator.mailboxGroups.Remove(databaseGuid);
                }
            }
            if (hashSet == null)
            {
                return;
            }
            foreach (Guid mailboxGuid in hashSet)
            {
                MailboxData fromCache = MailboxData.GetFromCache(mailboxGuid);
                if (fromCache != null)
                {
                    using (fromCache.CreateWriteLock())
                    {
                        fromCache.Settings.Text  = null;
                        fromCache.Settings.Voice = null;
                        using (fromCache.Actions.SyncObj.CreateWriteLock())
                        {
                            CalendarNotificationInitiator.StopAll(fromCache);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 // Token: 0x0600097B RID: 2427 RVA: 0x0003F950 File Offset: 0x0003DB50
 public static void InitiateEmittingReminder(ExDateTime now, MailboxData mailboxData)
 {
     if (NotificationFactories.Instance.IsReminderEnabled(mailboxData.Settings))
     {
         CalendarNotificationInitiator.ScheduleAction(new ReminderReloading(now, mailboxData), "InitiateEmittingReminder");
     }
 }
        // Token: 0x060008F5 RID: 2293 RVA: 0x0003C82C File Offset: 0x0003AA2C
        protected override void OnPerforming(long cookie)
        {
            bool           flag     = false;
            ThreadPriority priority = Thread.CurrentThread.Priority;

            try
            {
                Thread.CurrentThread.Priority = ThreadPriority.Lowest;
                if (base.ShouldContinue(cookie))
                {
                    this.InitializeUserSettings(cookie);
                    if (base.ShouldContinue(cookie))
                    {
                        this.SyncTextMessagingStates(cookie);
                        flag = true;
                    }
                }
            }
            catch (TransientMailboxException)
            {
                ExTraceGlobals.AssistantTracer.TraceError((long)this.GetHashCode(), "TransientMailboxException in Initiating.OnPerforming()");
            }
            finally
            {
                if (!flag && !base.ShouldContinue(cookie))
                {
                    CalendarNotificationInitiator.ScheduleAction(new Initiating(base.ExpectedTime + Initiating.RetryInterval, base.Context), "retrying to initiate database");
                }
                Thread.CurrentThread.Priority = priority;
            }
        }
 // Token: 0x06000913 RID: 2323 RVA: 0x0003D118 File Offset: 0x0003B318
 protected override void OnPerforming(long cookie)
 {
     using (base.Context.CreateReadLock())
     {
         if (!base.ShouldContinue(cookie))
         {
             ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because of cookie");
         }
         else if (!NotificationFactories.Instance.IsReminderEnabled(base.Context.Settings))
         {
             ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because user hasn't enabled reminder");
         }
         else
         {
             ExDateTime expectedTime  = base.ExpectedTime;
             ExDateTime exDateTime    = expectedTime + TimeSpan.FromDays(1.0);
             ExDateTime expectedTime2 = exDateTime;
             string     name          = base.GetType().Name;
             try
             {
                 ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Start Reminder Reloading at {0}, {1}", expectedTime.ToShortDateString(), expectedTime.ToLongTimeString());
                 ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLocalServerMailboxGuid(base.Context.Settings.GetADSettings(), base.Context.DatabaseGuid, base.Context.MailboxGuid);
                 using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=ReloadReminders"))
                 {
                     if (!base.ShouldContinue(cookie))
                     {
                         ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because of cookie");
                     }
                     else
                     {
                         foreach (CalendarInfo calendarInfo in ReminderLoader.Load(base.ExpectedTime, base.Context.Settings.TimeZone.ExTimeZone, mailboxSession, base.Context.DefaultCalendarFolderId, null, expectedTime, exDateTime))
                         {
                             if (!base.ShouldContinue(cookie))
                             {
                                 ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because of cookie");
                                 break;
                             }
                             expectedTime2 = calendarInfo.ReminderTime + TimeSpan.FromTicks(1L);
                             ReminderEmitting action;
                             if (NotificationFactories.Instance.TryCreateReminderEmitting(calendarInfo, base.Context, out action))
                             {
                                 CalendarNotificationInitiator.ScheduleAction(action, name);
                             }
                         }
                     }
                 }
             }
             finally
             {
                 if (base.ShouldContinue(cookie))
                 {
                     ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "The next reminder reloading is scheduled at {0}, {1}", expectedTime2.ToShortDateString(), expectedTime2.ToLongTimeString());
                     CalendarNotificationInitiator.ScheduleAction(new ReminderReloading(expectedTime2, base.Context), name);
                 }
             }
         }
     }
 }
Esempio n. 6
0
 // Token: 0x06000986 RID: 2438 RVA: 0x0003FE0D File Offset: 0x0003E00D
 private static void SettingsChangedEventHandler(object sender, UserSettings settings, InfoFromUserMailboxSession info)
 {
     if (NotificationFactories.Instance.IsNotificationEnabled(settings))
     {
         CalendarNotificationInitiator.NotificationStillEnabled(settings, info);
         return;
     }
     CalendarNotificationInitiator.DisableUser(settings, info.MailboxGuid);
 }
Esempio n. 7
0
 // Token: 0x06000980 RID: 2432 RVA: 0x0003FC34 File Offset: 0x0003DE34
 public static void StopAll(MailboxData mailboxData)
 {
     CalendarNotificationInitiator.PerformCustomizedOperationOnActionsList(delegate
     {
         mailboxData.Actions.ForEach(delegate(CalendarNotificationAction action)
         {
             CalendarNotificationInitiator.CompleteAction(action, "StopAll");
         });
     }, "StopAll");
 }
Esempio n. 8
0
        // Token: 0x06000988 RID: 2440 RVA: 0x0003FF74 File Offset: 0x0003E174
        private static void UpdateCacheAndInitiateEmittings(ref MailboxData mailboxData, ExDateTime userNow)
        {
            MailboxData mailboxData2 = MailboxData.UpdateCache(ref mailboxData);

            using (mailboxData2.CreateReadLock())
            {
                using (mailboxData2.Actions.SyncObj.CreateWriteLock())
                {
                    CalendarNotificationInitiator.InitiateEmittingReminder(userNow, mailboxData2);
                    CalendarNotificationInitiator.InitiateEmittingSummary(userNow, mailboxData2);
                }
            }
        }
Esempio n. 9
0
 // Token: 0x0600097F RID: 2431 RVA: 0x0003FBC0 File Offset: 0x0003DDC0
 public static void StopEmittingUpdate(MailboxData mailboxData)
 {
     CalendarNotificationInitiator.PerformCustomizedOperationOnActionsList(delegate
     {
         mailboxData.Actions.ForEach(delegate(CalendarNotificationAction action)
         {
             if (typeof(UpdateEmitting) == action.GetType())
             {
                 CalendarNotificationInitiator.CompleteAction(action, "StopEmittingUpdate");
             }
         });
     }, "StopEmittingUpdate");
 }
Esempio n. 10
0
 // Token: 0x06000987 RID: 2439 RVA: 0x0003FE34 File Offset: 0x0003E034
 private static void NotificationStillEnabled(UserSettings settings, InfoFromUserMailboxSession info)
 {
     try
     {
         ExDateTime  userNow     = settings.TimeZone.ExTimeZone.ConvertDateTime(ExDateTime.Now);
         MailboxData mailboxData = MailboxData.CreateFromUserSettings(settings, info);
         if (mailboxData != null)
         {
             try
             {
                 MailboxData fromCache = MailboxData.GetFromCache(mailboxData.MailboxGuid);
                 if (fromCache == null)
                 {
                     CalendarNotificationInitiator.EnableUser(ref mailboxData, userNow);
                     return;
                 }
                 if (Utils.AreInterestedFieldsEqual(mailboxData.Settings, fromCache.Settings))
                 {
                     return;
                 }
                 using (fromCache.CreateReadLock())
                 {
                     using (fromCache.Actions.SyncObj.CreateWriteLock())
                     {
                         CalendarNotificationInitiator.StopEmittingReminder(fromCache);
                         CalendarNotificationInitiator.StopEmittingSummary(fromCache);
                     }
                 }
                 CalendarNotificationInitiator.UpdateCacheAndInitiateEmittings(ref mailboxData, userNow);
             }
             finally
             {
                 if (mailboxData != null)
                 {
                     mailboxData.Dispose();
                     mailboxData = null;
                 }
             }
         }
         ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)typeof(CalendarNotificationInitiator).GetHashCode(), "notif changed, user: {0}", settings.LegacyDN);
     }
     catch (Exception ex)
     {
         if (!CalendarNotificationAssistant.TryHandleException((long)typeof(CalendarNotificationInitiator).GetHashCode(), "handling changing", settings.LegacyDN, ex))
         {
             throw;
         }
     }
 }
 // Token: 0x06000923 RID: 2339 RVA: 0x0003DA68 File Offset: 0x0003BC68
 private static void UpdateReminderAccordingToDeletedUpdate(MailboxData mailboxData, StoreObjectId calItemId, StoreObjectId calItemOccId)
 {
     mailboxData.Actions.ForEach(delegate(CalendarNotificationAction action)
     {
         if (typeof(ReminderEmitting) != action.GetType())
         {
             return;
         }
         CalendarInfo calendarInfo = ((ReminderEmitting)action).CalendarInfo;
         if (!object.Equals(calItemId, calendarInfo.CalendarItemIdentity) || !object.Equals(calItemOccId, calendarInfo.CalendarItemOccurrenceIdentity))
         {
             return;
         }
         CalendarNotificationInitiator.CompleteAction(action, "UpdateReminderAccordingToDeletedUpdate");
     });
 }
Esempio n. 12
0
        // Token: 0x0600097C RID: 2428 RVA: 0x0003F978 File Offset: 0x0003DB78
        public static void InitiateEmittingSummary(ExDateTime now, MailboxData mailboxData)
        {
            if (!NotificationFactories.Instance.IsSummaryEnabled(mailboxData.Settings))
            {
                return;
            }
            ExDateTime exDateTime = now.Date + mailboxData.Settings.Text.TextNotification.DailyAgendaNotificationSendTime;
            ExDateTime startTime  = now;

            if (exDateTime < now)
            {
                startTime   = exDateTime;
                exDateTime += TimeSpan.FromDays((double)mailboxData.Settings.Text.TextNotification.NextDays);
            }
            CalendarNotificationInitiator.ScheduleAction(new SummaryGenerating(startTime, exDateTime, mailboxData), "InitiateEmittingSummary");
        }
Esempio n. 13
0
 // Token: 0x0600097E RID: 2430 RVA: 0x0003FB1C File Offset: 0x0003DD1C
 public static void StopEmittingSummary(MailboxData mailboxData)
 {
     if (!NotificationFactories.Instance.IsSummaryEnabled(mailboxData.Settings))
     {
         return;
     }
     CalendarNotificationInitiator.PerformCustomizedOperationOnActionsList(delegate
     {
         mailboxData.Actions.ForEach(delegate(CalendarNotificationAction action)
         {
             if (typeof(SummaryGenerating) == action.GetType())
             {
                 CalendarNotificationInitiator.CompleteAction(action, "StopEmittingSummary");
             }
         });
     }, "StopEmittingSummary");
 }
Esempio n. 14
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;
                }
            }
        }
Esempio n. 15
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");
 }
Esempio n. 16
0
 // Token: 0x06000984 RID: 2436 RVA: 0x0003FD5C File Offset: 0x0003DF5C
 public void Stop(DatabaseInfo databaseInfo)
 {
     lock (CalendarNotificationInitiator.initiatedDatabaseGuids)
     {
         if (CalendarNotificationInitiator.initiatedDatabaseGuids.ContainsKey(databaseInfo.Guid))
         {
             CalendarNotificationInitiator.initiatedDatabaseGuids.Remove(databaseInfo.Guid);
         }
     }
     CalendarNotificationInitiator.pendingInitiatings.ForEach(delegate(Initiating action)
     {
         if (action.Context.Guid == databaseInfo.Guid)
         {
             CalendarNotificationInitiator.CompleteAction(action, "stoping database");
         }
     });
     CalendarNotificationInitiator.ExcludeDatabase(databaseInfo.Guid);
     SystemMailbox.RemoveInstance(databaseInfo);
 }
Esempio n. 17
0
        // Token: 0x06000983 RID: 2435 RVA: 0x0003FC84 File Offset: 0x0003DE84
        public void Initiate(DatabaseInfo databaseInfo)
        {
            if (CalendarNotificationInitiator.stateOfSettingsChangeListener == 0 && Interlocked.CompareExchange(ref CalendarNotificationInitiator.stateOfSettingsChangeListener, 1, 0) == 0)
            {
                SettingsChangeListener.Instance.UserSettingsChanged += CalendarNotificationInitiator.SettingsChangedEventHandler;
            }
            bool flag = false;

            lock (CalendarNotificationInitiator.initiatedDatabaseGuids)
            {
                if (!CalendarNotificationInitiator.initiatedDatabaseGuids.ContainsKey(databaseInfo.Guid))
                {
                    CalendarNotificationInitiator.initiatedDatabaseGuids[databaseInfo.Guid] = databaseInfo;
                    flag = true;
                }
            }
            if (flag)
            {
                CalendarNotificationInitiator.ScheduleAction(new Initiating(ExDateTime.Now, databaseInfo), "initiating database");
            }
        }
Esempio n. 18
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: 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);
                    }
                }
            }
        }
Esempio n. 20
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;
                        }
                    }
                }
            }
        }
Esempio n. 21
0
 // Token: 0x060008F6 RID: 2294 RVA: 0x0003C8F0 File Offset: 0x0003AAF0
 protected sealed override void OnPerformed(long cookie)
 {
     CalendarNotificationInitiator.CompleteAction(this, base.GetType().Name);
 }
Esempio n. 22
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: 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
            });
        }