Пример #1
0
        // Token: 0x06001427 RID: 5159 RVA: 0x00074578 File Offset: 0x00072778
        internal bool ShouldProcessUnseenEmailEvent(IMailboxSession session, IXSOFactory xsoFactory, IMapiEvent mapiEvent)
        {
            if (!this.IsEmailSubscriptionEnabled(mapiEvent.MailboxGuid))
            {
                return(false);
            }
            if (PushNotificationMapiEventAnalyzer.IsIpmFolderContentChangeEvent(mapiEvent))
            {
                return(true);
            }
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(session.MailboxGuid);

            using (new PushNotificationDataHandler.CachedStateReadLock(cachedState))
            {
                if (!(cachedState.State[9] is MailboxData))
                {
                    using (new PushNotificationDataHandler.CachedStateUpgradeWriteLock(cachedState))
                    {
                        if (!(cachedState.State[9] is MailboxData))
                        {
                            MailboxData mailboxData = new MailboxData(session.MailboxGuid);
                            if (!mailboxData.LoadData(session, xsoFactory))
                            {
                                return(false);
                            }
                            cachedState.State[9] = mailboxData;
                            return(ArrayComparer <byte> .Comparer.Equals(mapiEvent.ParentEntryId, mailboxData.InboxFolderId));
                        }
                    }
                }
            }
            return(false);
        }
        // Token: 0x060013D9 RID: 5081 RVA: 0x000738DC File Offset: 0x00071ADC
        private int ResolveUnseenEmailCount(IMapiEvent mapiEvent, List <PushNotificationServerSubscription> subscriptions)
        {
            int result;

            if (!PushNotificationMapiEventAnalyzer.IsIpmFolderContentChangeEvent(mapiEvent))
            {
                long num  = this.assistantCache.ReadEmailWatermarkFromCache(mapiEvent.MailboxGuid);
                long num2 = (subscriptions[0].InboxUnreadCount != null) ? subscriptions[0].InboxUnreadCount.Value : num;
                if (num <= num2)
                {
                    result = 1;
                    this.assistantCache.UpdateEmailWatermarkToCache(mapiEvent.MailboxGuid, num - 1L);
                }
                else
                {
                    result = (int)(num - num2);
                    this.assistantCache.UpdateEmailWatermarkToCache(mapiEvent.MailboxGuid, num2);
                }
            }
            else
            {
                long num2 = this.assistantCache.ReadEmailWatermarkFromCache(mapiEvent.MailboxGuid);
                long num  = mapiEvent.UnreadItemCount;
                if (num <= num2)
                {
                    result = 1;
                    this.assistantCache.UpdateEmailWatermarkToCache(mapiEvent.MailboxGuid, num - 1L);
                }
                else
                {
                    result = (int)(num - num2);
                }
            }
            return(result);
        }
 // Token: 0x060013D4 RID: 5076 RVA: 0x00073581 File Offset: 0x00071781
 internal void HandleEvent(IMapiEvent mapiEvent, IMailboxSession session, IStoreObject item)
 {
     if (PushNotificationMapiEventAnalyzer.IsSubscriptionChangeEvent(mapiEvent))
     {
         this.HandleSubscriptionChangeEvent(session, item);
         return;
     }
     this.HandleNotificationEvent(mapiEvent, session, item);
 }
 // Token: 0x060013D3 RID: 5075 RVA: 0x0007351C File Offset: 0x0007171C
 internal bool IsEventInteresting(IMapiEvent mapiEvent)
 {
     if (mapiEvent.ItemType != ObjectType.MAPI_MESSAGE && mapiEvent.ItemType != ObjectType.MAPI_FOLDER)
     {
         return(false);
     }
     if (PushNotificationMapiEventAnalyzer.IsSubscriptionChangeEvent(mapiEvent))
     {
         return(true);
     }
     if (!this.AssistantConfig.IsPublishingEnabled)
     {
         return(false);
     }
     if (PushNotificationMapiEventAnalyzer.IsNewMessageEvent(mapiEvent))
     {
         return(this.assistantCache.IsCacheUpdateRequiredForEmailSubscription(mapiEvent));
     }
     return(PushNotificationMapiEventAnalyzer.IsIpmFolderContentChangeEvent(mapiEvent) && this.assistantCache.IsValidFolderMessageForEmailSubscription(mapiEvent));
 }