// Token: 0x06000FAA RID: 4010 RVA: 0x00061E5C File Offset: 0x0006005C
        public SortBy[] GetFolderSortBy(OwaStoreObjectId folderId)
        {
            FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = this.GetFolderContentChangeNotificationHandler(folderId);

            if (folderContentChangeNotificationHandler != null)
            {
                return(folderContentChangeNotificationHandler.SortBy);
            }
            return(null);
        }
        // Token: 0x06000FAB RID: 4011 RVA: 0x00061E7C File Offset: 0x0006007C
        public FolderVirtualListViewFilter GetFolderFilter(OwaStoreObjectId folderId)
        {
            FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = this.GetFolderContentChangeNotificationHandler(folderId);

            if (folderContentChangeNotificationHandler != null)
            {
                return(folderContentChangeNotificationHandler.FolderFilter);
            }
            return(null);
        }
        // Token: 0x06000FA9 RID: 4009 RVA: 0x00061E3C File Offset: 0x0006003C
        public QueryResult GetFolderQueryResult(OwaStoreObjectId folderId)
        {
            FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = this.GetFolderContentChangeNotificationHandler(folderId);

            if (folderContentChangeNotificationHandler != null)
            {
                return(folderContentChangeNotificationHandler.QueryResult);
            }
            return(null);
        }
        // Token: 0x06000FA7 RID: 4007 RVA: 0x00061D7C File Offset: 0x0005FF7C
        private void RemoveFolderContentChangeSubscription(OwaStoreObjectId folderId)
        {
            FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = this.GetFolderContentChangeNotificationHandler(folderId);

            if (folderContentChangeNotificationHandler != null)
            {
                folderContentChangeNotificationHandler.RemoveSubscription(this.connectionDroppedNotificationHandler);
                folderContentChangeNotificationHandler.Dispose();
                this.folderContentChangeNotificationHandlers.Remove(folderId);
            }
        }
 // Token: 0x06000FA8 RID: 4008 RVA: 0x00061DB8 File Offset: 0x0005FFB8
 private void RemoveAllFolderContentChangeSubscriptions()
 {
     foreach (OwaStoreObjectId contextFolderId in this.folderContentChangeNotificationHandlers.Keys)
     {
         FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = this.GetFolderContentChangeNotificationHandler(contextFolderId);
         if (folderContentChangeNotificationHandler != null)
         {
             folderContentChangeNotificationHandler.RemoveSubscription(this.connectionDroppedNotificationHandler);
             folderContentChangeNotificationHandler.Dispose();
         }
     }
     this.folderContentChangeNotificationHandlers.Clear();
     this.folderContentChangeNotificationHandlers = null;
 }
        // Token: 0x06000FA5 RID: 4005 RVA: 0x00061C98 File Offset: 0x0005FE98
        public FolderContentChangeNotificationHandler GetFolderContentChangeNotificationHandler(OwaStoreObjectId contextFolderId)
        {
            if (contextFolderId == null)
            {
                throw new ArgumentNullException("contextFolderId");
            }
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            FolderContentChangeNotificationHandler result = null;

            this.folderContentChangeNotificationHandlers.TryGetValue(contextFolderId, out result);
            return(result);
        }
        // Token: 0x06000FA2 RID: 4002 RVA: 0x00061B7C File Offset: 0x0005FD7C
        public void SubscribeForFolderContentChanges(MailboxSession sessionIn, OwaStoreObjectId contextFolderId, OwaStoreObjectId dataFolderId, QueryResult queryResult, ListViewContents2 listView, PropertyDefinition[] subscriptionProperties, Dictionary <PropertyDefinition, int> propertyMap, SortBy[] sortBy, FolderVirtualListViewFilter folderFilter, bool isConversationView)
        {
            MailboxSession mailboxSession = this.userContext.MailboxSession;

            this.SubscribeForFolderChanges(contextFolderId, sessionIn);
            if (queryResult == null)
            {
                return;
            }
            if (sessionIn == mailboxSession)
            {
                FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = null;
                this.folderContentChangeNotificationHandlers.TryGetValue(contextFolderId, out folderContentChangeNotificationHandler);
                if (folderContentChangeNotificationHandler != null && folderContentChangeNotificationHandler.NeedReinitSubscriptions)
                {
                    this.RemoveFolderContentChangeSubscription(contextFolderId);
                    folderContentChangeNotificationHandler = null;
                }
                if (folderContentChangeNotificationHandler == null)
                {
                    this.ClearOldFolderContentChangeSubscriptions();
                    this.InitializeConnectionDroppedHandler();
                    folderContentChangeNotificationHandler = new FolderContentChangeNotificationHandler(this.userContext, mailboxSession, contextFolderId, dataFolderId, queryResult, this.omnhLoggedUser.EmailPayload, listView, subscriptionProperties, propertyMap, sortBy, folderFilter, isConversationView);
                    try
                    {
                        if (!folderContentChangeNotificationHandler.TrySubscribe(this.connectionDroppedNotificationHandler))
                        {
                            ExTraceGlobals.NotificationsCallTracer.TraceError((long)this.GetHashCode(), "Failed to create a folder content change subscription.");
                            folderContentChangeNotificationHandler.Dispose();
                            folderContentChangeNotificationHandler = null;
                            return;
                        }
                        this.folderContentChangeNotificationHandlers[contextFolderId] = folderContentChangeNotificationHandler;
                        folderContentChangeNotificationHandler = null;
                        return;
                    }
                    finally
                    {
                        if (folderContentChangeNotificationHandler != null)
                        {
                            folderContentChangeNotificationHandler.Dispose();
                            folderContentChangeNotificationHandler = null;
                        }
                    }
                }
                folderContentChangeNotificationHandler.MissedNotifications = false;
            }
        }
        // Token: 0x06000FA4 RID: 4004 RVA: 0x00061C74 File Offset: 0x0005FE74
        public bool HasDataFolderChanged(MailboxSession sessionIn, OwaStoreObjectId contextFolderId, OwaStoreObjectId dataFolderId)
        {
            FolderContentChangeNotificationHandler folderContentChangeNotificationHandler = this.GetFolderContentChangeNotificationHandler(contextFolderId);

            return(folderContentChangeNotificationHandler != null && folderContentChangeNotificationHandler.HasDataFolderChanged(dataFolderId));
        }
Beispiel #9
0
 internal FCNHState(FolderContentChangeNotificationHandler notificationHandler)
 {
     this.NotificationHandler = notificationHandler;
     this.Queue = new Queue <QueryNotification>();
 }
Beispiel #10
0
        public string ReadDataAndResetState()
        {
            string result = null;

            ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "EmailPayload.ReadDataAndResetState. Mailbox: {0}", this.mailboxSessionDisplayName);
            lock (this)
            {
                this.containsDataToPickup = false;
                if (this.payloadStringRefreshAll.Length > 0)
                {
                    result = this.payloadStringRefreshAll.ToString();
                }
                else
                {
                    StringBuilder stringBuilder  = null;
                    StringBuilder stringBuilder2 = null;
                    if (this.folderCountTable.Count > 0)
                    {
                        stringBuilder = new StringBuilder();
                        using (StringWriter stringWriter = new StringWriter(stringBuilder, CultureInfo.InvariantCulture))
                        {
                            foreach (KeyValuePair <OwaStoreObjectId, ItemCountPair> keyValuePair in this.folderCountTable)
                            {
                                OwaStoreObjectId key   = keyValuePair.Key;
                                ItemCountPair    value = keyValuePair.Value;
                                stringWriter.Write("updMapiCnt(\"");
                                Utilities.JavascriptEncode(key.ToBase64String(), stringWriter);
                                stringWriter.Write(string.Concat(new object[]
                                {
                                    "\",",
                                    value.ItemCount,
                                    ",",
                                    value.UnreadItemCount,
                                    ");"
                                }));
                            }
                        }
                    }
                    stringBuilder2 = new StringBuilder();
                    if (this.folderRefreshList.Count > 0)
                    {
                        using (StringWriter stringWriter2 = new StringWriter(stringBuilder2, CultureInfo.InvariantCulture))
                        {
                            foreach (OwaStoreObjectId owaStoreObjectId in this.folderRefreshList)
                            {
                                if (!this.folderContentChangeNotifications.ContainsKey(owaStoreObjectId) || this.folderContentChangeNotifications[owaStoreObjectId].NotificationHandler == null || this.folderContentChangeNotifications[owaStoreObjectId].NotificationHandler.AllowFolderRefreshNotification)
                                {
                                    stringWriter2.Write("stMapiDrty(\"");
                                    Utilities.JavascriptEncode(owaStoreObjectId.ToBase64String(), stringWriter2);
                                    stringWriter2.Write("\");");
                                }
                            }
                        }
                    }
                    int num = 0;
                    if (this.folderContentChangeNotifications.Count > 0)
                    {
                        foreach (EmailPayload.FCNHState fcnhstate in this.folderContentChangeNotifications.Values)
                        {
                            num += fcnhstate.Queue.Count;
                        }
                    }
                    StringBuilder stringBuilder3 = null;
                    bool          flag2          = true;
                    if (num > 0)
                    {
                        stringBuilder3 = new StringBuilder(1280 * num);
                        using (StringWriter stringWriter3 = new StringWriter(stringBuilder3, CultureInfo.InvariantCulture))
                        {
                            foreach (KeyValuePair <OwaStoreObjectId, EmailPayload.FCNHState> keyValuePair2 in this.folderContentChangeNotifications)
                            {
                                OwaStoreObjectId          key2  = keyValuePair2.Key;
                                Queue <QueryNotification> queue = keyValuePair2.Value.Queue;
                                FolderContentChangeNotificationHandler notificationHandler = keyValuePair2.Value.NotificationHandler;
                                foreach (QueryNotification notification in queue)
                                {
                                    notificationHandler.ProcessNotification(stringWriter3, notification, out flag2);
                                }
                            }
                        }
                    }
                    result = string.Concat(new string[]
                    {
                        (stringBuilder != null) ? stringBuilder.ToString() : string.Empty,
                        (stringBuilder2 != null) ? stringBuilder2.ToString() : string.Empty,
                        this.payloadStringReminderChanges.ToString(),
                        this.payloadStringNewMail.ToString(),
                        this.payloadStringQuota.ToString(),
                        this.payloadStringReminderNotify.ToString(),
                        (stringBuilder3 != null) ? stringBuilder3.ToString() : string.Empty
                    });
                }
                this.Clear(true);
            }
            return(result);
        }
Beispiel #11
0
 public void AttachFolderContentChangeNotificationHandler(OwaStoreObjectId folderId, FolderContentChangeNotificationHandler notificationHandler)
 {
     lock (this)
     {
         if (this.folderContentChangeNotifications.ContainsKey(folderId))
         {
             throw new OwaInvalidOperationException("There is already an active notification handler for this folder. That should not be the case");
         }
         this.folderContentChangeNotifications[folderId] = new EmailPayload.FCNHState(notificationHandler);
     }
 }