Example #1
0
        private void ProcessFolderCountAdvisor(OwaFolderCountAdvisor folderCountAdvisor)
        {
            if (folderCountAdvisor == null)
            {
                throw new ArgumentNullException("folderCountAdvisor");
            }
            MailboxSession mailboxSession = null;

            if (folderCountAdvisor.FolderId == null)
            {
                if (!folderCountAdvisor.MailboxOwner.MailboxInfo.IsAggregated)
                {
                    mailboxSession = base.UserContext.MailboxSession;
                }
                else
                {
                    mailboxSession = base.UserContext.GetArchiveMailboxSession(folderCountAdvisor.MailboxOwner);
                }
            }
            else
            {
                try
                {
                    mailboxSession = (folderCountAdvisor.FolderId.GetSession(base.UserContext) as MailboxSession);
                }
                catch (ObjectNotFoundException)
                {
                    return;
                }
            }
            if (mailboxSession != null)
            {
                Dictionary <StoreObjectId, ItemCountPair> itemCounts = folderCountAdvisor.GetItemCounts(mailboxSession);
                if (itemCounts == null)
                {
                    return;
                }
                IDictionaryEnumerator dictionaryEnumerator = itemCounts.GetEnumerator();
                while (dictionaryEnumerator.MoveNext())
                {
                    ItemCountPair countPair = (ItemCountPair)dictionaryEnumerator.Value;
                    if (countPair.ItemCount != -1L || countPair.UnreadItemCount != -1L)
                    {
                        OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromSessionFolderId(base.UserContext, mailboxSession, (StoreObjectId)dictionaryEnumerator.Key);
                        this.RenderUpdateCountJavascript(owaStoreObjectId, countPair);
                        if (owaStoreObjectId.StoreObjectType == StoreObjectType.Folder)
                        {
                            StoreObjectId folderId = StoreObjectId.FromProviderSpecificId(owaStoreObjectId.StoreObjectId.ProviderLevelItemId, StoreObjectType.OutlookSearchFolder);
                            this.RenderUpdateCountJavascript(OwaStoreObjectId.CreateFromSessionFolderId(base.UserContext, mailboxSession, folderId), countPair);
                            StoreObjectId folderId2 = StoreObjectId.FromProviderSpecificId(owaStoreObjectId.StoreObjectId.ProviderLevelItemId, StoreObjectType.SearchFolder);
                            this.RenderUpdateCountJavascript(OwaStoreObjectId.CreateFromSessionFolderId(base.UserContext, mailboxSession, folderId2), countPair);
                        }
                    }
                }
                return;
            }
        }
		// Token: 0x06002EC4 RID: 11972 RVA: 0x0010CA34 File Offset: 0x0010AC34
		private void RenderUpdateCountJavascript(OwaStoreObjectId folderId, ItemCountPair countPair)
		{
			this.Writer.Write("updCnt(\"");
			Utilities.JavascriptEncode(folderId.ToBase64String(), this.Writer);
			this.Writer.Write("\",");
			this.Writer.Write(countPair.ItemCount);
			this.Writer.Write(",");
			this.Writer.Write(countPair.UnreadItemCount);
			this.Writer.Write(");");
		}
Example #3
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);
        }