コード例 #1
0
        // Token: 0x06000F80 RID: 3968 RVA: 0x0003C68C File Offset: 0x0003A88C
        protected override IList <NotificationPayloadBase> ReadDataAndResetStateInternal()
        {
            List <NotificationPayloadBase> list = new List <NotificationPayloadBase>();

            lock (this.lockObject)
            {
                if (this.Payload != null)
                {
                    list.Add(this.Payload);
                    this.Payload = null;
                }
            }
            return(list);
        }
コード例 #2
0
 private static void SetHighlightTerms(SearchNotificationPayload payload, KeyValuePair <string, string>[] searchContextHighlightTerms)
 {
     if (searchContextHighlightTerms == null || searchContextHighlightTerms.Length <= 0)
     {
         return;
     }
     HighlightTermType[] array = new HighlightTermType[searchContextHighlightTerms.Length];
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = new HighlightTermType
         {
             Scope = searchContextHighlightTerms[i].Key,
             Value = searchContextHighlightTerms[i].Value
         };
     }
     payload.HighlightTerms = array;
 }
コード例 #3
0
        internal override void HandleNotificationInternal(Notification notif, MapiNotificationsLogEvent logEvent, object context)
        {
            if (notif == null)
            {
                return;
            }
            if ((notif.Type & NotificationType.SearchComplete) != NotificationType.SearchComplete)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification is not for search complete");
                return;
            }
            OwaSearchContext localSearchContext = context as OwaSearchContext;

            if (localSearchContext == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has  not passed in context data");
                throw new ArgumentNullException("context");
            }
            ThreadPool.QueueUserWorkItem(delegate(object o)
            {
                lock (this.SyncRoot)
                {
                    if (localSearchContext != this.currentSearchContext)
                    {
                        ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "Not sending search completed notification because the currentSearchContext and the localSearchContext are different");
                        return;
                    }
                }
                SearchNotificationPayload payload = SearchNotificationHandler.SearchPayloadCreator.CreatePayLoad(this.UserContext, localSearchContext);
                lock (this.SyncRoot)
                {
                    if (localSearchContext != this.currentSearchContext)
                    {
                        ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "Payload data calculated. Not sending the notification to the client because another search has been triggered");
                    }
                    else
                    {
                        this.searchNotifier.Payload = payload;
                        this.searchNotifier.PickupData();
                    }
                }
            }, null);
        }
コード例 #4
0
            public static SearchNotificationPayload CreatePayLoad(IMailboxContext userContext, OwaSearchContext searchContext)
            {
                SearchNotificationPayload payload = new SearchNotificationPayload();

                payload.ClientId   = searchContext.ClientSearchFolderIdentity;
                payload.IsComplete = true;
                payload.Source     = MailboxLocation.FromMailboxContext(userContext);
                SearchNotificationHandler.SearchPayloadCreator.SetHighlightTerms(payload, searchContext.HighlightTerms);
                try
                {
                    OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate()
                    {
                        SearchNotificationHandler.SearchPayloadCreator.FillItemDataInPayload(userContext, searchContext, payload);
                    });
                }
                catch (GrayException arg)
                {
                    payload.ServerSearchResultsRowCount = -1;
                    ExTraceGlobals.NotificationsCallTracer.TraceError <GrayException>(0L, "MapiNotificationHandlerBase.CreatePayLoad Unable to create payload with data for search results.  exception {0}", arg);
                }
                return(payload);
            }
コード例 #5
0
 private static void FillItemDataInPayload(IMailboxContext userContext, OwaSearchContext searchContext, SearchNotificationPayload payload)
 {
     try
     {
         userContext.LockAndReconnectMailboxSession(3000);
         int serverSearchResultsRowCount = 0;
         if (searchContext.SearchContextType == SearchContextType.ItemSearch)
         {
             payload.MessageItems = SearchFolderItemDataRetriever.GetItemDataFromSearchFolder(searchContext, userContext.MailboxSession, out serverSearchResultsRowCount);
         }
         else if (searchContext.SearchContextType == SearchContextType.ConversationSearch)
         {
             payload.Conversations = SearchFolderConversationRetriever.GetConversationDataFromSearchFolder(searchContext, userContext.MailboxSession, out serverSearchResultsRowCount);
         }
         payload.ServerSearchResultsRowCount = serverSearchResultsRowCount;
     }
     catch (OwaLockTimeoutException ex)
     {
         ExTraceGlobals.CoreCallTracer.TraceError <string>(0L, "User context lock timed out in FillItemDataInPayload. Exception: {0}", ex.Message);
     }
     finally
     {
         if (userContext.MailboxSessionLockedByCurrentThread())
         {
             userContext.UnlockAndDisconnectMailboxSession();
         }
     }
 }