// Token: 0x060009A1 RID: 2465 RVA: 0x00040844 File Offset: 0x0003EA44 public static MailboxData UpdateCache(ref MailboxData mailboxData) { if (mailboxData == null) { throw new ArgumentNullException("mailboxData"); } MailboxData mailboxData2 = null; using (MailboxData.CachedStateWriter cachedStateWriter = new MailboxData.CachedStateWriter(mailboxData.MailboxGuid)) { mailboxData2 = cachedStateWriter.Get(); if (mailboxData2 == null) { mailboxData2 = mailboxData; mailboxData = null; } else { using (mailboxData.CreateReadLock()) { using (mailboxData2.CreateWriteLock()) { mailboxData2.CopyExcludingActionsFrom(mailboxData); } } } cachedStateWriter.Set(mailboxData2); } return(mailboxData2); }
// Token: 0x06000A3A RID: 2618 RVA: 0x0004380C File Offset: 0x00041A0C public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item) { if (MailboxData.GetFromCache(mapiEvent.MailboxGuid) == null) { using (MailboxData.CachedStateWriter cachedStateWriter = new MailboxData.CachedStateWriter(mapiEvent.MailboxGuid)) { if (cachedStateWriter.Get() == null) { MailboxData mailboxData = new MailboxData(itemStore); cachedStateWriter.Set(mailboxData); } } } MessageItem messageItem = item as MessageItem; if (messageItem == null) { return; } int?valueAsNullable = messageItem.GetValueAsNullable <int>(ItemSchema.InternetMessageIdHash); if (valueAsNullable == null) { return; } string valueOrDefault = messageItem.GetValueOrDefault <string>(ItemSchema.InternetMessageId, null); if (string.IsNullOrEmpty(valueOrDefault)) { return; } int?valueAsNullable2 = messageItem.GetValueAsNullable <int>(MessageItemSchema.TextMessageDeliveryStatus); if (valueAsNullable2 == null) { return; } List <IStorePropertyBag> list = new List <IStorePropertyBag>(1); using (Folder folder = Folder.Bind(itemStore, DefaultFolderType.SentItems)) { using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, new SortBy[] { new SortBy(ItemSchema.InternetMessageIdHash, SortOrder.Ascending) }, new PropertyDefinition[] { ItemSchema.InternetMessageIdHash, ItemSchema.Id, ItemSchema.InternetMessageId, MessageItemSchema.TextMessageDeliveryStatus })) { if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.InternetMessageIdHash, valueAsNullable))) { return; } bool flag = false; while (!flag) { IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(1); if (propertyBags == null || 0 >= propertyBags.Length) { break; } for (int i = 0; i < propertyBags.Length; i++) { int?num = propertyBags[i].TryGetProperty(ItemSchema.InternetMessageIdHash) as int?; if (num == null) { break; } if (num.Value != valueAsNullable) { flag = true; break; } string a = propertyBags[i].TryGetProperty(ItemSchema.InternetMessageId) as string; if (string.Equals(a, valueOrDefault)) { list.Add(propertyBags[i]); } } } } } foreach (IStorePropertyBag storePropertyBag in list) { int?num2 = storePropertyBag.TryGetProperty(MessageItemSchema.TextMessageDeliveryStatus) as int?; if (num2 == null || !(num2 >= valueAsNullable2)) { VersionedId versionedId = storePropertyBag.TryGetProperty(ItemSchema.Id) as VersionedId; if (versionedId != null && versionedId.ObjectId != null) { using (MessageItem messageItem2 = MessageItem.Bind(itemStore, versionedId.ObjectId)) { messageItem2.OpenAsReadWrite(); messageItem2.SetProperties(TextMessageDeliveryStatusProcessor.propertyDeliveryStatus, new object[] { valueAsNullable2 }); messageItem2.Save(SaveMode.ResolveConflicts); } } } } }