Exemple #1
0
        // Token: 0x060002DB RID: 731 RVA: 0x00011F20 File Offset: 0x00010120
        private ContentSetting GetDestinationPolicy(ProvisionedFolder destProvisionedFolder, string itemClass)
        {
            ContentSetting applyingPolicy = ElcPolicySettings.GetApplyingPolicy(destProvisionedFolder.ElcPolicies, itemClass, destProvisionedFolder.ItemClassToPolicyMapping);

            if (applyingPolicy == null || !ElcPolicySettings.ArePolicyPropertiesValid(applyingPolicy, TraceContext.Get(), this.mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()))
            {
                return(null);
            }
            return(applyingPolicy);
        }
 // Token: 0x06000423 RID: 1059 RVA: 0x0001D818 File Offset: 0x0001BA18
 private bool GetStoreData()
 {
     if (this.configItem == null)
     {
         this.EnsureUserConfigurationIsValid();
     }
     try
     {
         this.storeTagDictionary = MrmFaiFormatter.Deserialize(this.configItem, base.MailboxSession.MailboxOwner, out this.deletedTags, out this.fullCrawlRequired);
         if (this.IsArchiveMailUser)
         {
             foreach (StoreTagData storeTagData in this.storeTagDictionary.Values)
             {
                 bool flag = ElcMailboxHelper.IsArchiveTag(storeTagData, false);
                 if (storeTagData.Tag.Type == ElcFolderType.All && !flag)
                 {
                     foreach (ContentSetting contentSetting in storeTagData.ContentSettings.Values)
                     {
                         if (contentSetting.MessageClass.Equals(ElcMessageClass.AllMailboxContent, StringComparison.CurrentCultureIgnoreCase))
                         {
                             this.defaultAdTag = storeTagData.Tag.RetentionId;
                             break;
                         }
                         if (contentSetting.MessageClass.Equals(ElcMessageClass.VoiceMail, StringComparison.CurrentCultureIgnoreCase))
                         {
                             this.defaultVmAdTag = storeTagData.Tag.RetentionId;
                             break;
                         }
                     }
                 }
             }
             this.defaultContentSettingList = new List <ElcPolicySettings>();
             if (!this.defaultAdTag.Equals(Guid.Empty))
             {
                 foreach (ContentSetting elcContentSetting in this.storeTagDictionary[this.defaultAdTag].ContentSettings.Values)
                 {
                     ElcPolicySettings.ParseContentSettings(this.defaultContentSettingList, elcContentSetting);
                 }
             }
             if (!this.defaultVmAdTag.Equals(Guid.Empty))
             {
                 foreach (ContentSetting elcContentSetting2 in this.storeTagDictionary[this.defaultVmAdTag].ContentSettings.Values)
                 {
                     ElcPolicySettings.ParseContentSettings(this.defaultContentSettingList, elcContentSetting2);
                 }
             }
         }
     }
     catch (ObjectNotFoundException arg)
     {
         ElcUserInformation.Tracer.TraceDebug <ObjectNotFoundException>((long)this.GetHashCode(), "Deserialize of MRM FAI message failed because it could not be found. Exception: {0}", arg);
         return(false);
     }
     return(true);
 }
Exemple #3
0
 // Token: 0x060002D1 RID: 721 RVA: 0x00011000 File Offset: 0x0000F200
 internal bool IsPolicyValid(ProvisionedFolder provisionedFolder, ContentSetting policy, string itemClass, MailboxDataForFolders mailboxData)
 {
     if (!ElcPolicySettings.ArePolicyPropertiesValid(policy, TraceContext.Get(), this.mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()))
     {
         return(false);
     }
     FolderProcessor.CircularPolicyType circularPolicyType = this.LookForCircularPolicies(provisionedFolder, policy, itemClass, mailboxData);
     if (circularPolicyType == FolderProcessor.CircularPolicyType.BadCycle)
     {
         throw new SkipException(Strings.descCycleInPolicies(this.mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), policy.Name));
     }
     return(true);
 }
        // Token: 0x060002F6 RID: 758 RVA: 0x00012AE4 File Offset: 0x00010CE4
        private void SetDestPolicyType(StoreObjectId destFolderId, string itemClass)
        {
            ContentSetting    contentSetting = null;
            ProvisionedFolder folderFromId   = this.mailboxData.FolderProcessor.GetFolderFromId(destFolderId);

            if (folderFromId != null)
            {
                contentSetting = ElcPolicySettings.GetApplyingPolicy(folderFromId.ElcPolicies, itemClass, folderFromId.ItemClassToPolicyMapping);
            }
            if (contentSetting != null && contentSetting.RetentionEnabled && contentSetting.TriggerForRetention == RetentionDateType.WhenMoved && contentSetting.AgeLimitForRetention != null && contentSetting.AgeLimitForRetention.Value.TotalDays > 0.0)
            {
                this.setDateWhileMoving = true;
            }
        }
 // Token: 0x06000366 RID: 870 RVA: 0x00017BCC File Offset: 0x00015DCC
 internal ProvisionedFolder(StoreObjectId folderId, string displayName, string fullFolderPath, string containerClass, bool isProvisionedFolder, ContentSetting[] elcContentSettings, Guid elcFolderGuid, bool inheritedPolicy)
 {
     this.folderId            = folderId;
     this.displayName         = displayName;
     this.fullFolderPath      = fullFolderPath;
     this.containerClass      = containerClass;
     this.isProvisionedFolder = isProvisionedFolder;
     this.elcFolderGuid       = elcFolderGuid;
     this.inheritedPolicy     = inheritedPolicy;
     if (elcContentSettings != null)
     {
         this.elcPolicies = new List <ElcPolicySettings>();
         foreach (ContentSetting elcContentSetting in elcContentSettings)
         {
             ElcPolicySettings.ParseContentSettings(this.elcPolicies, elcContentSetting);
         }
         this.elcPolicies.Sort(delegate(ElcPolicySettings first, ElcPolicySettings second)
         {
             if (first == second)
             {
                 return(0);
             }
             string text = first.MessageClass.TrimEnd(new char[]
             {
                 '*'
             });
             string text2 = second.MessageClass.TrimEnd(new char[]
             {
                 '*'
             });
             if (text.Length > text2.Length)
             {
                 return(-1);
             }
             if (text.Length < text2.Length)
             {
                 return(1);
             }
             if (first.MessageClass.EndsWith("*"))
             {
                 return(1);
             }
             if (second.MessageClass.EndsWith("*"))
             {
                 return(-1);
             }
             return(0);
         });
     }
 }
        // Token: 0x06000421 RID: 1057 RVA: 0x0001D6B8 File Offset: 0x0001B8B8
        private ContentSetting GetContentSettingForMsgClassBasedOnTag(Guid updatedTagGuid, string messageClass)
        {
            ContentSetting result = null;

            if (updatedTagGuid.Equals(this.defaultAdTag))
            {
                result = ElcPolicySettings.GetApplyingPolicy(this.defaultContentSettingList, messageClass, this.tagAndClassToPolicyMapping, this.defaultAdTag.ToString() + messageClass);
            }
            else if (updatedTagGuid.Equals(this.defaultVmAdTag))
            {
                result = ElcPolicySettings.GetApplyingPolicy(this.defaultContentSettingList, messageClass, this.tagAndClassToPolicyMapping, this.defaultVmAdTag.ToString() + messageClass);
            }
            else if (updatedTagGuid.Equals(this.defaultArchiveAdTag))
            {
                result = ElcPolicySettings.GetApplyingPolicy(this.defaultArchiveContentSettingList, messageClass, this.tagAndClassToPolicyMapping, this.defaultArchiveAdTag.ToString() + messageClass);
            }
            return(result);
        }
Exemple #7
0
        // Token: 0x0600048D RID: 1165 RVA: 0x0002067C File Offset: 0x0001E87C
        internal void Update()
        {
            bool processEhaMigratedMessages = base.MailboxDataForTags.ElcUserInformation.ProcessEhaMigratedMessages;

            using (IEnumerator <List <object[]> > allItemsIterator = this.GetAllItemsIterator())
            {
                while (allItemsIterator != null && allItemsIterator.MoveNext())
                {
                    List <object[]> list             = allItemsIterator.Current;
                    VersionedId     versionedId      = null;
                    Guid            empty            = Guid.Empty;
                    Guid            empty2           = Guid.Empty;
                    DateTime        updatedStartDate = DateTime.MaxValue;
                    Guid            updatedTagGuid   = Guid.Empty;
                    foreach (object[] array in list)
                    {
                        versionedId = (array[this.propertyIndexHolder.IdIndex] as VersionedId);
                        if (versionedId == null)
                        {
                            PropertySynchronizerBase.Tracer.TraceError <ItemPropertySynchronizer>((long)this.GetHashCode(), "{0}: We could not get id of this item.", this);
                        }
                        else
                        {
                            if (processEhaMigratedMessages)
                            {
                                object obj = array[this.propertyIndexHolder.EHAMigrationExpiryDateIndex];
                                if (obj != null && obj is ExDateTime)
                                {
                                    PropertySynchronizerBase.Tracer.TraceError <ItemPropertySynchronizer, object>((long)this.GetHashCode(), "{0}: We dont tag eha migration messages, this message is stamped with migration expiration date from eha. Expiration date is {1}", this, obj);
                                    continue;
                                }
                            }
                            base.PropertiesToBeDeleted.Clear();
                            base.PropertiesToBeUpdated.Clear();
                            bool tagChanged = false;
                            this.taggedByDefaultExpiryTag   = false;
                            this.taggedByPersonalArchiveTag = false;
                            this.taggedByPersonalExpiryTag  = false;
                            this.taggedBySystemExpiryTag    = false;
                            this.taggedByUncertainExpiryTag = false;
                            string text = array[this.propertyIndexHolder.ItemClassIndex] as string;
                            text = ((text == null) ? string.Empty : ElcPolicySettings.GetEffectiveItemClass(text).ToLower());
                            if (TagAssistantHelper.IsRetainableItem(text) && !this.ShouldSkipItem(array) && !this.IsRuleMessageItem(text))
                            {
                                try
                                {
                                    empty            = Guid.Empty;
                                    empty2           = Guid.Empty;
                                    updatedStartDate = DateTime.MaxValue;
                                    updatedTagGuid   = this.UpdateTagProperties(out tagChanged, out empty, text, array);
                                    bool tagChanged2 = this.UpdateArchiveTag(array, out empty2);
                                    if (!updatedTagGuid.Equals(Guid.Empty) || !empty2.Equals(Guid.Empty))
                                    {
                                        PropertySynchronizerBase.Tracer.TraceDebug <ItemPropertySynchronizer>((long)this.GetHashCode(), "{0}: Need to set StartDate since no tag is present.", this);
                                        updatedStartDate = this.UpdateStartDateEtc(versionedId, text, array);
                                    }
                                    this.UpdateContentSettingProperties(tagChanged, updatedTagGuid, updatedStartDate, text, array);
                                    this.UpdateRetentionFlags(empty, tagChanged, updatedTagGuid, empty2, array);
                                    this.UpdateArchiveContentSettingProperties(tagChanged2, array, text, empty2, updatedStartDate);
                                    this.CommitChangesAlready(versionedId);
                                }
                                catch (ArgumentOutOfRangeException arg)
                                {
                                    PropertySynchronizerBase.Tracer.TraceDebug <ItemPropertySynchronizer, string, ArgumentOutOfRangeException>((long)this.GetHashCode(), "{0} Corrupted Data. Skip current item {1}. Exception: {2}", this, versionedId.ObjectId.ToHexEntryId(), arg);
                                }
                            }
                        }
                    }
                }
            }
        }
 // Token: 0x06000303 RID: 771 RVA: 0x00012F24 File Offset: 0x00011124
 internal override void Invoke(ProvisionedFolder provisionedFolder, List <object[]> items, PropertyIndexHolder propertyIndexHolder)
 {
     AutoCopyEnforcer.TracerPfd.TracePfd <int, Folder>((long)this.GetHashCode(), "PFD IWE {0} {1} AutoCopyEnforcer Invoked", 18711, provisionedFolder.Folder);
     using (Folder folder = Folder.Bind(base.MailboxData.MailboxSession, this.SendFolderId))
     {
         foreach (object[] array in items)
         {
             if (array[propertyIndexHolder.IdIndex] is VersionedId)
             {
                 VersionedId versionedId = (VersionedId)array[propertyIndexHolder.IdIndex];
                 provisionedFolder.CurrentItems = new VersionedId[]
                 {
                     versionedId
                 };
                 object obj = array[propertyIndexHolder.AutoCopiedIndex];
                 if (obj is byte[])
                 {
                     AutoCopyEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: ignoring item '{1}' because it has been copied already.", TraceContext.Get(), versionedId);
                 }
                 else
                 {
                     string text = array[propertyIndexHolder.ItemClassIndex] as string;
                     text = ((text == null) ? string.Empty : text.ToLower());
                     ContentSetting applyingPolicy = ElcPolicySettings.GetApplyingPolicy(provisionedFolder.ElcPolicies, text, provisionedFolder.ItemClassToPolicyMapping);
                     if (applyingPolicy != null && applyingPolicy.JournalingEnabled)
                     {
                         ItemAuditLogData itemAuditLogData = null;
                         if (base.MailboxData.ElcAuditLog.AutocopyLoggingEnabled)
                         {
                             itemAuditLogData = new ItemAuditLogData(array, propertyIndexHolder, new FolderAuditLogData(provisionedFolder, base.MailboxData, ELCAction.Journaling.ToString(), this.GetOfficialFileParticipant(applyingPolicy).EmailAddress));
                         }
                         ItemData      itemData = new ItemData(versionedId, (array[propertyIndexHolder.ReceivedTimeIndex] is ExDateTime) ? ((DateTime)((ExDateTime)array[propertyIndexHolder.ReceivedTimeIndex])) : DateTime.MinValue, itemAuditLogData, (int)array[propertyIndexHolder.SizeIndex]);
                         StoreObjectId storeObjectId;
                         bool          flag = this.SendItemAsAttachement(applyingPolicy, itemData, out storeObjectId);
                         if (flag)
                         {
                             this.MarkItemAsCopied(itemData, provisionedFolder);
                             ELCPerfmon.TotalItemsAutoCopied.Increment();
                         }
                         else
                         {
                             Exception       ex = null;
                             OperationResult operationResult = OperationResult.Succeeded;
                             try
                             {
                                 operationResult = folder.DeleteObjects(DeleteItemFlags.HardDelete, new StoreObjectId[]
                                 {
                                     storeObjectId
                                 }).OperationResult;
                             }
                             catch (Exception ex2)
                             {
                                 operationResult = OperationResult.Failed;
                                 ex = ex2;
                             }
                             if (operationResult != OperationResult.Succeeded)
                             {
                                 AutoCopyEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Failed to delete the journal message '{1}'. Exception: '{2}'.", TraceContext.Get(), storeObjectId.ToString(), (ex == null) ? "" : ex.Message);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
        // Token: 0x0600037C RID: 892 RVA: 0x000180B4 File Offset: 0x000162B4
        internal override void Invoke(ProvisionedFolder provisionedFolder, List <object[]> items, PropertyIndexHolder propertyIndexHolder)
        {
            FolderExpirationExecutor folderExpirationExecutor = new FolderExpirationExecutor(provisionedFolder, base.MailboxData, base.Assistant);

            ExpirationEnforcer.Tracer.TraceDebug <object, string, int>((long)this.GetHashCode(), "{0}: Number of items found in folder '{1}' is {2}.", TraceContext.Get(), provisionedFolder.DisplayName, items.Count);
            DefaultFolderType folderType = DefaultFolderType.None;

            if (provisionedFolder.FolderId.Equals(base.MailboxData.MailboxSession.GetDefaultFolderId(DefaultFolderType.DeletedItems)))
            {
                folderType = DefaultFolderType.DeletedItems;
            }
            else if (provisionedFolder.ContainerClass != null && ObjectClass.IsCalendarFolder(provisionedFolder.ContainerClass))
            {
                folderType = DefaultFolderType.Calendar;
            }
            else if (provisionedFolder.ContainerClass != null && ObjectClass.IsTaskFolder(provisionedFolder.ContainerClass))
            {
                folderType = DefaultFolderType.Tasks;
            }
            ItemStartDateCalculator itemStartDateCalculator = new ItemStartDateCalculator(propertyIndexHolder, provisionedFolder.Folder.DisplayName, folderType, base.MailboxData.MailboxSession, ExpirationEnforcer.Tracer);
            FolderAuditLogData      folderAuditLogData      = null;

            if (base.MailboxData.ElcAuditLog.ExpirationLoggingEnabled)
            {
                folderAuditLogData = new FolderAuditLogData(provisionedFolder, base.MailboxData, ELCAction.Retention.ToString());
            }
            foreach (object[] array in items)
            {
                VersionedId versionedId = array[propertyIndexHolder.IdIndex] as VersionedId;
                string      text        = array[propertyIndexHolder.ItemClassIndex] as string;
                if (versionedId == null)
                {
                    ExpirationEnforcer.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Current item in folder {1} is null. Skipping it.", TraceContext.Get(), provisionedFolder.DisplayName);
                }
                else
                {
                    provisionedFolder.CurrentItems = new VersionedId[]
                    {
                        versionedId
                    };
                    text = ((text == null) ? string.Empty : text.ToLower());
                    ContentSetting contentSetting = null;
                    contentSetting = ElcPolicySettings.GetApplyingPolicy(provisionedFolder.ElcPolicies, text, provisionedFolder.ItemClassToPolicyMapping);
                    if (contentSetting == null)
                    {
                        ExpirationEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Policy for item class {1} in folder {2} is null. Skipping item.", TraceContext.Get(), text, provisionedFolder.DisplayName);
                    }
                    else if (!base.MailboxData.FolderProcessor.IsPolicyValid(provisionedFolder, contentSetting, text, base.MailboxData))
                    {
                        ExpirationEnforcer.Tracer.TraceDebug <object, string, string>((long)this.GetHashCode(), "{0}: Removing policy {1} from the list in folder {2} because it is invalid.", TraceContext.Get(), contentSetting.Name, provisionedFolder.DisplayName);
                        provisionedFolder.RemovePolicy(contentSetting);
                    }
                    else
                    {
                        double totalDays = contentSetting.AgeLimitForRetention.Value.TotalDays;
                        int    num;
                        if (contentSetting.TriggerForRetention == RetentionDateType.WhenMoved)
                        {
                            ExpirationEnforcer.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Applying policy. Policy '{1}' expires based on move date.", TraceContext.Get(), contentSetting.Name);
                            CompositeProperty compositeProperty = null;
                            if (ElcMailboxHelper.Exists(array[propertyIndexHolder.MoveDateIndex]))
                            {
                                try
                                {
                                    compositeProperty = CompositeProperty.Parse((byte[])array[propertyIndexHolder.MoveDateIndex]);
                                }
                                catch (ArgumentException ex)
                                {
                                    ExpirationEnforcer.Tracer.TraceError((long)this.GetHashCode(), "{0}: Could not parse move date property of item. Folder: {1} ItemClass: {2} Exception: {3}.", new object[]
                                    {
                                        TraceContext.Get(),
                                        provisionedFolder.DisplayName,
                                        text,
                                        ex
                                    });
                                    base.MailboxData.ThrowIfErrorsOverLimit();
                                }
                            }
                            if (compositeProperty == null)
                            {
                                string arg = "Stamped Move date is null.";
                                ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId, string>((long)this.GetHashCode(), "{0}: Move date needs to be stamped on item {1}. {2}", TraceContext.Get(), versionedId, arg);
                                folderExpirationExecutor.AddToMoveDateStampingList(new ItemData(versionedId, (int)array[propertyIndexHolder.SizeIndex]));
                                continue;
                            }
                            ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Calculating age of item {1} based on move date", TraceContext.Get(), versionedId);
                            num = (int)base.MailboxData.Now.Subtract(compositeProperty.Date.Value).TotalDays;
                        }
                        else
                        {
                            DateTime startDate = itemStartDateCalculator.GetStartDate(versionedId, text, array);
                            if (startDate == DateTime.MinValue)
                            {
                                num = 0;
                            }
                            else
                            {
                                num = (int)base.MailboxData.UtcNow.Subtract(startDate).TotalDays;
                            }
                        }
                        try
                        {
                            if ((double)num >= totalDays)
                            {
                                if (contentSetting.RetentionAction == RetentionActionType.MarkAsPastRetentionLimit && array[propertyIndexHolder.ExpiryTimeIndex] != null && !(array[propertyIndexHolder.ExpiryTimeIndex] is PropertyError))
                                {
                                    ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Item {1} is already tagged with expiry time, hence will not tag again.", TraceContext.Get(), versionedId);
                                }
                                else
                                {
                                    ExpirationEnforcer.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Adding item {1} to list to be expired.", TraceContext.Get(), versionedId);
                                    ItemAuditLogData itemAuditLogData = null;
                                    if (base.MailboxData.ElcAuditLog.ExpirationLoggingEnabled)
                                    {
                                        folderAuditLogData.ExpirationAction = contentSetting.RetentionAction.ToString();
                                        itemAuditLogData = new ItemAuditLogData(array, propertyIndexHolder, folderAuditLogData);
                                    }
                                    ItemData itemData = new ItemData(versionedId, (array[propertyIndexHolder.ReceivedTimeIndex] is ExDateTime) ? ((DateTime)((ExDateTime)array[propertyIndexHolder.ReceivedTimeIndex])) : DateTime.MinValue, itemAuditLogData, (int)array[propertyIndexHolder.SizeIndex]);
                                    folderExpirationExecutor.AddToReportAndDoomedList(array, propertyIndexHolder, contentSetting, itemData, text, this.allPolicyTags);
                                }
                            }
                        }
                        catch (InvalidExpiryDestinationException ex2)
                        {
                            ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Removing policy '{1}', that applies to folder '{2}' from list of policies to process. Exception: {3}", new object[]
                            {
                                TraceContext.Get(),
                                contentSetting.Name,
                                contentSetting.ManagedFolderName,
                                ex2
                            });
                            provisionedFolder.RemovePolicy(contentSetting);
                        }
                        catch (SkipFolderException ex3)
                        {
                            ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Policy '{1}', that applies to folder '{2}' will be skipped for the current folder. Exception: {3}", new object[]
                            {
                                TraceContext.Get(),
                                contentSetting.Name,
                                contentSetting.ManagedFolderName,
                                ex3
                            });
                            return;
                        }
                    }
                }
            }
            ExpirationEnforcer.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Done identifying items for expiration. Proceed to expire.", new object[]
            {
                TraceContext.Get()
            });
            ExpirationEnforcer.TracerPfd.TracePfd <int, object>((long)this.GetHashCode(), "PFD IWE {0} {1}: Done identifying items for expiration. Calling ExpirationExecutor to expire.", 26903, TraceContext.Get());
            folderExpirationExecutor.ExecuteTheDoomed();
        }
        // Token: 0x06000419 RID: 1049 RVA: 0x0001D084 File Offset: 0x0001B284
        internal void GetDefaultTagInAD()
        {
            this.defaultAdTag   = Guid.Empty;
            this.defaultVmAdTag = Guid.Empty;
            Guid key  = Guid.Empty;
            Guid key2 = Guid.Empty;

            foreach (AdTagData adTagData in this.tagsInUserPolicy.Values)
            {
                if (adTagData.Tag.Type == ElcFolderType.All)
                {
                    if (ElcMailboxHelper.IsArchiveTag(adTagData, true))
                    {
                        ElcUserInformation.Tracer.TraceDebug <ElcUserTagInformation, string>((long)this.GetHashCode(), "{0}: Default move to archive tag found: {1}", this, adTagData.Tag.Name);
                        this.defaultArchiveAdTag         = adTagData.Tag.RetentionId;
                        this.defaultArchiveTagObjectGuid = adTagData.Tag.Guid;
                        this.archivingEnabled            = true;
                        continue;
                    }
                    if (ElcMailboxHelper.IsArchiveTag(adTagData, false))
                    {
                        continue;
                    }
                    ElcUserInformation.Tracer.TraceDebug <ElcUserTagInformation, string>((long)this.GetHashCode(), "{0}: Default tag found: {1}", this, adTagData.Tag.Name);
                    using (SortedDictionary <Guid, ContentSetting> .ValueCollection.Enumerator enumerator2 = adTagData.ContentSettings.Values.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            ContentSetting contentSetting = enumerator2.Current;
                            if (contentSetting.MessageClass.Equals(ElcMessageClass.AllMailboxContent, StringComparison.CurrentCultureIgnoreCase))
                            {
                                this.defaultAdTag = adTagData.Tag.RetentionId;
                                key = adTagData.Tag.Guid;
                                this.compactDefaultPolicy = null;
                                break;
                            }
                            if (contentSetting.MessageClass.Equals(ElcMessageClass.VoiceMail, StringComparison.CurrentCultureIgnoreCase))
                            {
                                this.defaultVmAdTag = adTagData.Tag.RetentionId;
                                key2 = adTagData.Tag.Guid;
                                this.compactDefaultPolicy = null;
                                break;
                            }
                        }
                        continue;
                    }
                }
                if (adTagData.Tag.Type != ElcFolderType.RecoverableItems && ElcMailboxHelper.IsArchiveTag(adTagData, true))
                {
                    ElcUserInformation.Tracer.TraceDebug <ElcUserTagInformation, string>((long)this.GetHashCode(), "{0}: Enabled Archive tag found: {1}", this, adTagData.Tag.Name);
                    this.archivingEnabled = true;
                }
            }
            this.defaultContentSettingList = new List <ElcPolicySettings>();
            if (!this.defaultAdTag.Equals(Guid.Empty))
            {
                foreach (ContentSetting elcContentSetting in this.tagsInUserPolicy[key].ContentSettings.Values)
                {
                    ElcPolicySettings.ParseContentSettings(this.defaultContentSettingList, elcContentSetting);
                }
            }
            if (!this.defaultVmAdTag.Equals(Guid.Empty))
            {
                foreach (ContentSetting elcContentSetting2 in this.tagsInUserPolicy[key2].ContentSettings.Values)
                {
                    ElcPolicySettings.ParseContentSettings(this.defaultContentSettingList, elcContentSetting2);
                }
            }
            if (!this.defaultArchiveAdTag.Equals(Guid.Empty))
            {
                this.storeDefaultArchiveTagDictionary = new Dictionary <Guid, StoreTagData>();
                this.storeDefaultArchiveTagDictionary[this.defaultArchiveAdTag] = new StoreTagData(this.tagsInUserPolicy[this.defaultArchiveTagObjectGuid]);
                this.defaultArchiveContentSettingList = new List <ElcPolicySettings>();
                foreach (ContentSetting elcContentSetting3 in this.tagsInUserPolicy[this.defaultArchiveTagObjectGuid].ContentSettings.Values)
                {
                    ElcPolicySettings.ParseContentSettings(this.defaultArchiveContentSettingList, elcContentSetting3);
                }
            }
        }
Exemple #11
0
        // Token: 0x060004E5 RID: 1253 RVA: 0x000252C0 File Offset: 0x000234C0
        internal void LoadStoreTagDataFromStore(MailboxSession mailboxSession)
        {
            this.ResetState();
            StoreId   defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox);
            Exception ex = null;

            this.underRetentionPolicy       = false;
            this.storeTagDictionary         = null;
            this.folderTagDictionary        = null;
            this.folderArchiveTagDictionary = null;
            this.itemClassToPolicyMapping   = null;
            try
            {
                using (UserConfiguration folderConfiguration = mailboxSession.UserConfigurationManager.GetFolderConfiguration("MRM", UserConfigurationTypes.Stream | UserConfigurationTypes.XML | UserConfigurationTypes.Dictionary, defaultFolderId))
                {
                    this.storeTagDictionary               = MrmFaiFormatter.Deserialize(folderConfiguration, mailboxSession.MailboxOwner);
                    this.haveCheckedForDefault            = false;
                    this.checkedForDefaultForMessageClass = false;
                    this.defaultTag   = null;
                    this.defaultVmTag = null;
                    StoreTagData storeTagData = new StoreTagData();
                    storeTagData.Tag      = new RetentionTag();
                    storeTagData.Tag.Guid = PolicyTagHelper.SystemCleanupTagGuid;
                    this.storeTagDictionary[PolicyTagHelper.SystemCleanupTagGuid] = storeTagData;
                    this.defaultContentSettingList = new List <ElcPolicySettings>();
                    foreach (StoreTagData storeTagData2 in this.storeTagDictionary.Values)
                    {
                        if (storeTagData2.Tag.Type == ElcFolderType.All)
                        {
                            foreach (ContentSetting elcContentSetting in storeTagData2.ContentSettings.Values)
                            {
                                ElcPolicySettings.ParseContentSettings(this.defaultContentSettingList, elcContentSetting);
                            }
                        }
                    }
                    this.folderTypeDictionary       = new Dictionary <StoreObjectId, DefaultFolderType>();
                    this.folderTagDictionary        = new Dictionary <StoreObjectId, Guid>();
                    this.folderArchiveTagDictionary = new Dictionary <StoreObjectId, Guid>();
                    this.itemClassToPolicyMapping   = new Dictionary <string, ContentSetting>();
                    this.underRetentionPolicy       = true;
                    if (this.rootFolderId == null)
                    {
                        StoreObjectId defaultFolderId2 = mailboxSession.GetDefaultFolderId(DefaultFolderType.Root);
                        if (defaultFolderId2 != null)
                        {
                            this.rootFolderId = defaultFolderId2.ProviderLevelItemId;
                        }
                    }
                    if (this.sentItemsId == null)
                    {
                        StoreObjectId defaultFolderId3 = mailboxSession.GetDefaultFolderId(DefaultFolderType.SentItems);
                        if (defaultFolderId3 != null)
                        {
                            this.sentItemsId = defaultFolderId3.ProviderLevelItemId;
                        }
                    }
                    if (this.deletedItemsId == null)
                    {
                        StoreObjectId defaultFolderId4 = mailboxSession.GetDefaultFolderId(DefaultFolderType.DeletedItems);
                        if (defaultFolderId4 != null)
                        {
                            this.deletedItemsId = defaultFolderId4.ProviderLevelItemId;
                        }
                    }
                    this.CacheFolderIdsToSkip(mailboxSession);
                }
            }
            catch (ObjectNotFoundException ex2)
            {
                ex = ex2;
            }
            catch (CorruptDataException ex3)
            {
                ex = ex3;
            }
            catch (StorageTransientException ex4)
            {
                ex = ex4;
            }
            catch (StoragePermanentException ex5)
            {
                ex = ex5;
            }
            if (ex != null)
            {
                UserRetentionPolicyCache.Tracer.TraceDebug <UserRetentionPolicyCache, Exception>((long)this.GetHashCode(), "{0}: Config message with store settings is missing or corrupt. Recreate it. Exception: {1}", this, ex);
                this.underRetentionPolicy       = false;
                this.storeTagDictionary         = null;
                this.folderTagDictionary        = null;
                this.folderArchiveTagDictionary = null;
                this.itemClassToPolicyMapping   = null;
            }
        }