// Token: 0x06000966 RID: 2406 RVA: 0x0003F5C4 File Offset: 0x0003D7C4
 protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
 {
     try
     {
         bool flag = false;
         if (this.calendarProcessor.IsEventInteresting(mapiEvent))
         {
             this.calendarProcessor.HandleEvent(mapiEvent, itemStore, item);
             flag = true;
         }
         else if (this.settingProcessor.IsEventInteresting(mapiEvent))
         {
             this.settingProcessor.HandleEvent(mapiEvent, itemStore, item);
             flag = true;
         }
         else if (this.deliveryStatusProcessor.IsEventInteresting(mapiEvent))
         {
             this.deliveryStatusProcessor.HandleEvent(mapiEvent, itemStore, item);
             flag = true;
         }
         if (flag)
         {
             CalNotifsCounters.NumberOfInterestingMailboxEvents.Increment();
         }
     }
     catch (Exception ex)
     {
         if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "HandleAssistantEvent", itemStore.MailboxOwner.ToString(), ex))
         {
             throw;
         }
     }
 }
        // Token: 0x060008EE RID: 2286 RVA: 0x0003C734 File Offset: 0x0003A934
        private void OnTimer(object state)
        {
            long cookie = (long)state;

            if (!this.ShouldContinue(cookie))
            {
                return;
            }
            try
            {
                try
                {
                    this.OnPerforming(cookie);
                }
                finally
                {
                    this.Performed = true;
                    this.OnPerformed(cookie);
                }
            }
            catch (Exception ex)
            {
                if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "performing timer call back", this.SourceDescription ?? "unknown", ex))
                {
                    throw;
                }
            }
        }
Ejemplo n.º 3
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;
         }
     }
 }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
0
 // Token: 0x060009E8 RID: 2536 RVA: 0x00041844 File Offset: 0x0003FA44
 private SystemMailbox GetSystemMailbox()
 {
     if (this.systemMailbox == null)
     {
         try
         {
             ExTraceGlobals.UserSettingsTracer.TraceDebug <string>((long)this.GetHashCode(), "Getting system mailbox instance for database '{0}'", this.databaseInfo.DisplayName);
             this.systemMailbox = SystemMailbox.GetInstance(this.databaseInfo);
         }
         catch (Exception ex)
         {
             ExTraceGlobals.UserSettingsTracer.TraceDebug <string, Exception>((long)this.GetHashCode(), "Error getting system mailbox instance for database '{0}': {1}", this.databaseInfo.DisplayName, ex);
             if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "Retrieving system mailbox for SettingsChangeProcessor", this.databaseInfo.DisplayName, ex))
             {
                 throw;
             }
         }
     }
     return(this.systemMailbox);
 }
Ejemplo n.º 6
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;
         }
     }
 }
Ejemplo n.º 7
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;
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
        // Token: 0x060008FA RID: 2298 RVA: 0x0003CBC0 File Offset: 0x0003ADC0
        internal void UpdateAllUserSettings(IRecipientSession recipientSession, long cookie, Initiating.ActOnUserSettingsDelegate updateUserSettings, Predicate <ADRawEntry> validate)
        {
            QueryFilter filter = new AndFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.Database, new ADObjectId(base.Context.Guid)),
                new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox)
            });
            ADPagedReader <ADRawEntry> adpagedReader = recipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, filter, null, 0, new PropertyDefinition[]
            {
                ADObjectSchema.Id,
                ADRecipientSchema.TextMessagingState,
                IADMailStorageSchema.ExchangeGuid
            });

            using (IEnumerator <ADRawEntry> enumerator = adpagedReader.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ADRawEntry recipient = enumerator.Current;
                    if (!base.ShouldContinue(cookie))
                    {
                        break;
                    }
                    if (validate == null || validate(recipient))
                    {
                        if (this.mailboxTable == null)
                        {
                            this.mailboxTable = base.Context.GetMailboxTable(ClientType.EventBased, new PropertyTagPropertyDefinition[0]);
                        }
                        if (!this.mailboxTable.Exists((MailboxInformation mbxInfo) => mbxInfo.MailboxGuid == (Guid)recipient[IADMailStorageSchema.ExchangeGuid]))
                        {
                            ADUser aduser = recipientSession.FindADUserByObjectId((ADObjectId)recipient[ADObjectSchema.Id]);
                            if (aduser != null)
                            {
                                ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(aduser, null);
                                MailboxSession    mailboxSession    = null;
                                try
                                {
                                    mailboxSession = base.Context.GetMailbox(exchangePrincipal, ClientType.EventBased, "UpdateAllUserSettings");
                                    if (!base.ShouldContinue(cookie))
                                    {
                                        break;
                                    }
                                    updateUserSettings(mailboxSession, recipientSession, aduser);
                                }
                                catch (NotSupportedException arg)
                                {
                                    ExTraceGlobals.AssistantTracer.TraceError <string, NotSupportedException>((long)this.GetHashCode(), "Exception is caught during syncing text messaging settings to AD user object for {0}: {1}", exchangePrincipal.LegacyDn, arg);
                                }
                                catch (Exception ex)
                                {
                                    if (!CalendarNotificationAssistant.TryHandleException((long)this.GetHashCode(), "Update all user's settings", exchangePrincipal.LegacyDn, ex))
                                    {
                                        throw;
                                    }
                                }
                                finally
                                {
                                    if (mailboxSession != null)
                                    {
                                        mailboxSession.Dispose();
                                        mailboxSession = null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }