Пример #1
0
 public static OwaStoreObjectId CreateFromSessionFolderId(UserContext userContext, StoreSession session, StoreObjectId folderId)
 {
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     if (session == null)
     {
         throw new ArgumentNullException("session");
     }
     if (folderId == null)
     {
         throw new ArgumentNullException("folderId");
     }
     if (userContext.IsMyMailbox(session))
     {
         return(OwaStoreObjectId.CreateFromSessionFolderId(OwaStoreObjectIdType.MailBoxObject, null, folderId));
     }
     if (userContext.IsOtherMailbox(session))
     {
         return(OwaStoreObjectId.CreateFromSessionFolderId(OwaStoreObjectIdType.OtherUserMailboxObject, ((MailboxSession)session).MailboxOwner.LegacyDn, folderId));
     }
     if (Utilities.IsArchiveMailbox(session))
     {
         return(OwaStoreObjectId.CreateFromSessionFolderId(OwaStoreObjectIdType.ArchiveMailboxObject, ((MailboxSession)session).MailboxOwnerLegacyDN, folderId));
     }
     if (session is PublicFolderSession)
     {
         return(OwaStoreObjectId.CreateFromSessionFolderId(OwaStoreObjectIdType.PublicStoreFolder, null, folderId));
     }
     throw new ArgumentException("The type of session is unknown");
 }
Пример #2
0
 public void SubscribeForSearchPageNotify(StoreObjectId searchFolderId, SearchFolder searchFolder, SearchFolderCriteria searchCriteria, string searchString)
 {
     if (!this.userContext.LockedByCurrentThread())
     {
         throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
     }
     lock (this)
     {
         this.ResetSearchFolderReferences(true);
         this.InitSubscriptions(ClientSubscriptionFlags.StaticSearch);
         this.hasCurrentSearchCompleted             = false;
         this.wasFailNonContentIndexedSearchFlagSet = searchCriteria.FailNonContentIndexedSearch;
         this.searchFolderIdCurrent = OwaStoreObjectId.CreateFromSessionFolderId(this.userContext, this.mailboxSession, searchFolderId);
         this.searchSub             = Subscription.Create(this.mailboxSession, new NotificationHandler(this.HandleFullSearchComplete), NotificationType.SearchComplete, searchFolderId);
         searchFolder.ApplyOneTimeSearch(searchCriteria);
         this.searchPerformanceData = new SearchPerformanceData();
         this.searchPerformanceData.StartSearch(searchString);
     }
 }
Пример #3
0
        internal void HandleHierarchyNotification(Notification notif)
        {
            bool flag = false;

            try
            {
                if (Globals.ArePerfCountersEnabled)
                {
                    OwaSingleCounters.TotalMailboxNotifications.Increment();
                }
                QueryNotification queryNotification = notif as QueryNotification;
                if (queryNotification != null)
                {
                    if (queryNotification.Row.Length >= this.querySubscriptionProperties.Length)
                    {
                        VersionedId   versionedId   = queryNotification.Row[0] as VersionedId;
                        StoreObjectId storeObjectId = null;
                        if (versionedId != null)
                        {
                            storeObjectId = versionedId.ObjectId;
                        }
                        if (storeObjectId == null || queryNotification.Row[2] == null || queryNotification.Row[3] == null)
                        {
                            ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                        }
                        else
                        {
                            int              num      = (int)queryNotification.Row[2];
                            int              num2     = (int)queryNotification.Row[3];
                            bool             flag2    = false;
                            bool             flag3    = false;
                            OwaStoreObjectId folderId = null;
                            bool             flag4    = false;
                            lock (this)
                            {
                                if (this.isDisposed || this.missedNotifications || this.needReinitSubscriptions)
                                {
                                    return;
                                }
                                if (!this.HandleSearchNotification(storeObjectId, num, ref flag4, ref folderId))
                                {
                                    if (storeObjectId.Equals(this.userContext.RemindersSearchFolderId) || (this.searchFolderIdCurrent != null && storeObjectId.Equals(this.searchFolderIdCurrent.StoreObjectId)))
                                    {
                                        return;
                                    }
                                    if ((this.flags & ClientSubscriptionFlags.FolderCount) == ClientSubscriptionFlags.FolderCount && num != -1 && num2 != -1)
                                    {
                                        if (this.folderCountsList != null)
                                        {
                                            using (List <OwaStoreObjectId> .Enumerator enumerator = this.folderCountsList.GetEnumerator())
                                            {
                                                while (enumerator.MoveNext())
                                                {
                                                    OwaStoreObjectId owaStoreObjectId = enumerator.Current;
                                                    if (owaStoreObjectId.StoreObjectId != null && storeObjectId.Equals(owaStoreObjectId.StoreObjectId))
                                                    {
                                                        flag2 = true;
                                                        break;
                                                    }
                                                }
                                                goto IL_195;
                                            }
                                        }
                                        flag2 = true;
                                    }
IL_195:
                                    if ((this.flags & ClientSubscriptionFlags.FolderChange) == ClientSubscriptionFlags.FolderChange && this.folderChangeList != null)
                                    {
                                        foreach (OwaStoreObjectId owaStoreObjectId2 in this.folderChangeList)
                                        {
                                            if (owaStoreObjectId2.StoreObjectId != null && storeObjectId.Equals(owaStoreObjectId2.StoreObjectId))
                                            {
                                                flag3 = true;
                                                break;
                                            }
                                        }
                                    }
                                    folderId = OwaStoreObjectId.CreateFromSessionFolderId(this.owaStoreObjectIdType, this.mailboxOwnerLegacyDN, storeObjectId);
                                }
                            }
                            if (flag2)
                            {
                                this.emailPayload.AddFolderCountPayload(folderId, (long)num, (long)num2);
                            }
                            if (flag3)
                            {
                                this.emailPayload.AddFolderRefreshPayload(folderId, false);
                            }
                            if (flag4)
                            {
                                this.searchPayload.AddSearchFolderRefreshPayload(folderId, SearchNotificationType.FirstPage);
                                this.searchPayload.PickupData();
                            }
                            this.emailPayload.PickupData();
                        }
                    }
                }
            }
            catch (OwaLockTimeoutException ex)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "User context lock timed out for notification thread. Exception: {0}", ex.Message);
                flag = true;
            }
            catch (Exception ex2)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in HandleHierarchyNotification on the notification thread. Exception: {0}", ex2.Message);
                flag = true;
            }
            finally
            {
                if (flag)
                {
                    lock (this)
                    {
                        this.missedNotifications = true;
                    }
                }
            }
        }