コード例 #1
0
 // Token: 0x060009C7 RID: 2503 RVA: 0x00040F44 File Offset: 0x0003F144
 internal void UpdateSettingUnderSystemMailbox(UserSettings settings, SystemMailbox systemMailbox)
 {
     foreach (NotificationFactoryBase notificationFactoryBase in this.factories)
     {
         notificationFactoryBase.UpdateSettingUnderSystemMailbox(settings, systemMailbox);
     }
 }
コード例 #2
0
        // Token: 0x060009E7 RID: 2535 RVA: 0x00041734 File Offset: 0x0003F934
        private void HandleSettingsEvent(MailboxSession session)
        {
            UserSettings  userSettings  = Utils.LoadUserSettingsFromMailboxSession(session);
            SystemMailbox systemMailbox = this.GetSystemMailbox();

            if (systemMailbox != null)
            {
                NotificationFactories.Instance.UpdateSettingUnderSystemMailbox(userSettings, systemMailbox);
            }
            SettingsChangeListener.Instance.RaiseSettingsChangedEvent(userSettings, new InfoFromUserMailboxSession(session));
            if (userSettings.Voice != null && userSettings.Voice.Enabled)
            {
                ExTraceGlobals.UserSettingsTracer.TraceDebug <string, string>((long)this.GetHashCode(), "{0} Voice notification is enabled on user {1}", ExDateTime.Now.ToLongTimeString(), userSettings.LegacyDN);
            }
            else
            {
                ExTraceGlobals.UserSettingsTracer.TraceDebug <string, string>((long)this.GetHashCode(), "{0} Voice notification is disabled on user {1}", ExDateTime.Now.ToLongTimeString(), userSettings.LegacyDN);
            }
            if (userSettings.Text != null && userSettings.Text.Enabled)
            {
                ExTraceGlobals.UserSettingsTracer.TraceDebug <string, string>((long)this.GetHashCode(), "{0} Text notification is enabled on user {1}", ExDateTime.Now.ToLongTimeString(), userSettings.LegacyDN);
                return;
            }
            ExTraceGlobals.UserSettingsTracer.TraceDebug <string, string>((long)this.GetHashCode(), "{0} Text notification is disabled on user {1}", ExDateTime.Now.ToLongTimeString(), userSettings.LegacyDN);
        }
コード例 #3
0
 // Token: 0x060008FB RID: 2299 RVA: 0x0003CDFC File Offset: 0x0003AFFC
 internal void ReloadSystemMailbox(long cookie, SystemMailbox systemMailbox)
 {
     if (!systemMailbox.MoveCalendarNotificationSettingsToSettingsFolder())
     {
         ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "SystemMailbox is invalid, the calendar notification settings may be lost");
     }
     systemMailbox.SetValid();
 }
コード例 #4
0
        // Token: 0x06000A14 RID: 2580 RVA: 0x00042548 File Offset: 0x00040748
        internal void Update(Guid externalDirectoryOrganizationId, string mailboxOwnerLegacyDN, string settings, StoreObjectId settingsFolderId)
        {
            VersionedId versionedId = null;
            string      text        = SystemMailbox.FormatItemSubject(externalDirectoryOrganizationId, mailboxOwnerLegacyDN);
            QueryFilter seekFilter  = new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.Subject, text);

            lock (this.systemMailboxMutex)
            {
                if (!this.isDisposed)
                {
                    this.ConnectSystemMailboxSession();
                    try
                    {
                        using (Folder folder = Folder.Bind(this.systemMailboxSession, settingsFolderId))
                        {
                            using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, SystemMailbox.sortBySubject, SystemMailbox.updatingUserSettingsProperties))
                            {
                                IStorePropertyBag[] propertyBags;
                                if (queryResult.SeekToCondition(SeekReference.OriginBeginning, seekFilter) && queryResult.SeekToCondition(SeekReference.OriginCurrent, SystemMailbox.SettingsItemClassFilter) && 0 < (propertyBags = queryResult.GetPropertyBags(1)).Length)
                                {
                                    versionedId = (VersionedId)propertyBags[0].TryGetProperty(ItemSchema.Id);
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(settings))
                        {
                            if (versionedId != null)
                            {
                                this.systemMailboxSession.Delete(DeleteItemFlags.SoftDelete, new StoreId[]
                                {
                                    versionedId
                                });
                                SystemMailbox.Tracer.TraceDebug <string, StoreObjectId>((long)this.GetHashCode(), "Notification disabled {0} under folder {1}", text, settingsFolderId);
                            }
                        }
                        else
                        {
                            using (Item item = (versionedId != null) ? MessageItem.Bind(this.systemMailboxSession, versionedId) : MessageItem.Create(this.systemMailboxSession, settingsFolderId))
                            {
                                if (versionedId == null)
                                {
                                    item.ClassName           = "IPM.Configuration.UserCalendarNotification";
                                    item[ItemSchema.Subject] = text;
                                }
                                item[ItemSchema.TextBody] = settings;
                                item.Save(SaveMode.ResolveConflicts);
                                SystemMailbox.Tracer.TraceDebug <string, StoreObjectId>((long)this.GetHashCode(), "Notification settings of user {0} have been saved under folder {1}", text, settingsFolderId);
                            }
                        }
                    }
                    finally
                    {
                        this.DisconnectSystemMailboxSession();
                    }
                }
            }
        }
コード例 #5
0
        // Token: 0x060009D3 RID: 2515 RVA: 0x00041018 File Offset: 0x0003F218
        internal void UpdateSettingUnderSystemMailbox(UserSettings settings, SystemMailbox systemMailbox)
        {
            string settings2 = string.Empty;
            bool   flag      = this.IsFeatureEnabled(settings);

            if (flag)
            {
                settings2 = this.BuildSettingsItemBody(settings);
            }
            systemMailbox.Update(settings.ExternalDirectoryOrganizationId, settings.LegacyDN, settings2, this.GetSettingFolderId(systemMailbox));
        }
コード例 #6
0
        // Token: 0x06000A0C RID: 2572 RVA: 0x00042080 File Offset: 0x00040280
        internal static SystemMailbox GetInstance(DatabaseInfo databaseInfo)
        {
            SystemMailbox.Tracer.TraceDebug <Guid>((long)typeof(SystemMailbox).GetHashCode(), "Entering SystemMailbox.GetInstance for database {0}", databaseInfo.Guid);
            SystemMailbox systemMailbox;

            if (!SystemMailbox.instanceDictionary.TryGetValue(databaseInfo.Guid, out systemMailbox))
            {
                systemMailbox = new SystemMailbox(databaseInfo);
                systemMailbox.InitializeSettingsFolderId();
                if (!SystemMailbox.instanceDictionary.TryAdd(databaseInfo.Guid, systemMailbox))
                {
                    SystemMailbox.Tracer.TraceDebug <Guid>((long)typeof(SystemMailbox).GetHashCode(), "Disposing created system mailbox for database {0}, using existing one", databaseInfo.Guid);
                    systemMailbox.Dispose();
                    systemMailbox = SystemMailbox.instanceDictionary[databaseInfo.Guid];
                }
            }
            return(systemMailbox);
        }
コード例 #7
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);
 }
コード例 #8
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);
 }
コード例 #9
0
 // Token: 0x060009E4 RID: 2532 RVA: 0x00041508 File Offset: 0x0003F708
 public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
 {
     if (ObjectType.MAPI_MESSAGE == mapiEvent.ItemType && item == null)
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string>((long)this.GetHashCode(), "Event is MAPI_MESSAGE but item is null, message class is {0}", mapiEvent.ObjectClass);
         return;
     }
     if (!itemStore.Capabilities.CanHaveUserConfigurationManager)
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string>((long)this.GetHashCode(), "Mailbox sesstion does not have UserConfigurationManager capability. Possibly an alternate mailbox, {0}.", itemStore.MailboxOwnerLegacyDN);
         return;
     }
     if (this.IsMailboxDeletedOrDisconnected(mapiEvent))
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Processing Disabling event for mailbox {0} on database {1}", itemStore.MailboxOwnerLegacyDN, itemStore.MdbGuid);
         UserSettings  settings      = new UserSettings(itemStore);
         SystemMailbox systemMailbox = this.GetSystemMailbox();
         if (systemMailbox != null)
         {
             NotificationFactories.Instance.UpdateSettingUnderSystemMailbox(settings, systemMailbox);
         }
         SettingsChangeListener.Instance.RaiseSettingsChangedEvent(settings, new InfoFromUserMailboxSession(itemStore));
         return;
     }
     if (this.IsMailboxCreatedOrConnected(mapiEvent))
     {
         ExTraceGlobals.UserSettingsTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "Processing Enabling event for mailbox {0} on database {1}", itemStore.MailboxOwnerLegacyDN, itemStore.MdbGuid);
         using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(itemStore))
         {
             TextMessagingAccount account = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(itemStore.MailboxOwner.ObjectId);
             IRecipientSession    tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.IgnoreInvalid, itemStore.GetADSessionSettings(), 194, "HandleEvent", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\CalendarNotification\\SettingsChangeProcessor.cs");
             ADRecipient          adrecipient = tenantOrRootOrgRecipientSession.Read(itemStore.MailboxOwner.ObjectId);
             if (adrecipient != null)
             {
                 TextMessagingHelper.UpdateAndSaveTextMessgaingStateOnAdUser(account, adrecipient, tenantOrRootOrgRecipientSession);
             }
         }
     }
     this.HandleSettingsEvent(itemStore);
 }
コード例 #10
0
 // Token: 0x06000A23 RID: 2595 RVA: 0x00042DB4 File Offset: 0x00040FB4
 protected override StoreObjectId GetSettingFolderId(SystemMailbox systemMailbox)
 {
     return(systemMailbox.TextSettingsFolderId);
 }
コード例 #11
0
 // Token: 0x060009C8 RID: 2504 RVA: 0x00040F74 File Offset: 0x0003F174
 internal void GetAllUsersSettingsFromSystemMailbox(Dictionary <string, UserSettings> settingsDictionary, SystemMailbox systemMailbox, MailboxSession systemMailboxSession)
 {
     foreach (NotificationFactoryBase notificationFactoryBase in this.factories)
     {
         notificationFactoryBase.GetAllUsersSettingsFromSystemMailbox(settingsDictionary, systemMailbox, systemMailboxSession);
     }
 }
コード例 #12
0
 // Token: 0x06000A0F RID: 2575 RVA: 0x00042191 File Offset: 0x00040391
 internal static string FormatItemSubject(Guid tenantGuid, string mailboxOwnerLegacyDN)
 {
     return(SystemMailbox.FormatExternalDirectoryOrganizationId(tenantGuid) + mailboxOwnerLegacyDN);
 }
コード例 #13
0
        // Token: 0x060009D4 RID: 2516 RVA: 0x00041058 File Offset: 0x0003F258
        internal void GetAllUsersSettingsFromSystemMailbox(Dictionary <string, UserSettings> settingsDictionary, SystemMailbox systemMailbox, MailboxSession systemMailboxSession)
        {
            StoreObjectId settingFolderId = this.GetSettingFolderId(systemMailbox);

            using (Folder folder = Folder.Bind(systemMailboxSession, settingFolderId))
            {
                using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, SystemMailbox.SortByItemClass, SystemMailbox.RetrievingUserSettingsProperties))
                {
                    if (queryResult.SeekToCondition(SeekReference.OriginBeginning, SystemMailbox.SettingsItemClassFilter))
                    {
                        bool flag = false;
                        for (;;)
                        {
                            IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(10000);
                            if (propertyBags.Length <= 0)
                            {
                                break;
                            }
                            foreach (IStorePropertyBag storePropertyBag in propertyBags)
                            {
                                if (!string.Equals(storePropertyBag.TryGetProperty(StoreObjectSchema.ItemClass) as string, "IPM.Configuration.UserCalendarNotification", StringComparison.OrdinalIgnoreCase))
                                {
                                    flag = true;
                                    ExTraceGlobals.SystemMailboxTracer.TraceDebug((long)this.GetHashCode(), "traversed To different item class");
                                    break;
                                }
                                string text = storePropertyBag.TryGetProperty(ItemSchema.Subject) as string;
                                if (string.Compare(text, "CalendarNotificationSettingsFolderValid") == 0)
                                {
                                    ExTraceGlobals.SystemMailboxTracer.TraceDebug((long)this.GetHashCode(), "Find settigns folder valid flag");
                                }
                                else if (string.IsNullOrEmpty(text))
                                {
                                    ExTraceGlobals.SystemMailboxTracer.TraceDebug((long)this.GetHashCode(), "Empty subject found, skipping.");
                                }
                                else if (text.Length < SystemMailbox.TenantGuidStringLength)
                                {
                                    ExTraceGlobals.SystemMailboxTracer.TraceDebug <string>((long)this.GetHashCode(), "Subject value too small, skipped. Value {0}", text);
                                }
                                else
                                {
                                    string text2 = text.Substring(0, SystemMailbox.TenantGuidStringLength);
                                    Guid   externalDirectoryOrganizationId;
                                    if (!Guid.TryParse(text2, out externalDirectoryOrganizationId))
                                    {
                                        ExTraceGlobals.SystemMailboxTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid guid found in subject, skipped. Value {0}", text2);
                                    }
                                    else
                                    {
                                        string text3 = text.Substring(SystemMailbox.TenantGuidStringLength);
                                        if (string.IsNullOrEmpty(text3))
                                        {
                                            ExTraceGlobals.SystemMailboxTracer.TraceDebug((long)this.GetHashCode(), "Empty legacyDN found, skipped.");
                                        }
                                        else
                                        {
                                            string text4 = storePropertyBag.TryGetProperty(ItemSchema.TextBody) as string;
                                            if (string.IsNullOrEmpty(text4))
                                            {
                                                ExTraceGlobals.SystemMailboxTracer.TraceDebug <string>((long)this.GetHashCode(), "Setting body is corrupted for user {0}", text3);
                                            }
                                            else
                                            {
                                                UserSettings userSettings;
                                                if (!settingsDictionary.TryGetValue(text3, out userSettings))
                                                {
                                                    userSettings = new UserSettings(text3, externalDirectoryOrganizationId);
                                                    settingsDictionary[text3] = userSettings;
                                                }
                                                this.UpdateSettingsFromSettingsItemBody(userSettings, text4);
                                            }
                                        }
                                    }
                                }
                            }
                            if (flag)
                            {
                                goto IL_21C;
                            }
                        }
                        ExTraceGlobals.SystemMailboxTracer.TraceDebug((long)this.GetHashCode(), "PropertyBags length <= 0");
                    }
                    IL_21C :;
                }
            }
        }
コード例 #14
0
 // Token: 0x060009D5 RID: 2517
 protected abstract StoreObjectId GetSettingFolderId(SystemMailbox systemMailbox);
コード例 #15
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;
                        }
                    }
                }
            }
        }