Esempio n. 1
0
        // Token: 0x06000DB2 RID: 3506 RVA: 0x00033824 File Offset: 0x00031A24
        private GroupAssociationNotificationPayload GetPayloadFromNotification(QueryNotification notification)
        {
            GroupAssociationNotificationPayload groupAssociationNotificationPayload = new GroupAssociationNotificationPayload();

            groupAssociationNotificationPayload.SubscriptionId = base.SubscriptionId;
            groupAssociationNotificationPayload.EventType      = notification.EventType;
            groupAssociationNotificationPayload.Source         = MailboxLocation.FromMailboxContext(base.UserContext);
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                string itemProperty  = GroupAssociationNotificationHandler.GetItemProperty <string>(notification, 0, string.Empty);
                string itemProperty2 = GroupAssociationNotificationHandler.GetItemProperty <string>(notification, 1, string.Empty);
                bool   itemProperty3 = GroupAssociationNotificationHandler.GetItemProperty <bool>(notification, 2, false);
                GroupMailboxLocator groupMailboxLocator = new GroupMailboxLocator(this.adSession, itemProperty, itemProperty2);
                ADUser aduser = groupMailboxLocator.FindAdUser();
                if (aduser != null)
                {
                    groupAssociationNotificationPayload.Group = new ModernGroupType
                    {
                        DisplayName = aduser.DisplayName,
                        SmtpAddress = aduser.PrimarySmtpAddress.ToString(),
                        IsPinned    = itemProperty3
                    };
                }
                else
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceError <string, string>((long)this.GetHashCode(), "GroupAssociationNotificationHandler.GetPayloadFromNotification: Could not find Group in AD with ExternalObjectId {0} or LegacyDn {1}", itemProperty, itemProperty2);
                }
            }
            return(groupAssociationNotificationPayload);
        }
 private UnseenItemNotificationPayload GetPayload(UnseenItemNotificationHandler.NotifierData data)
 {
     return(new UnseenItemNotificationPayload
     {
         SubscriptionId = data.Notifier.PayloadSubscriptionId,
         UnseenData = new UnseenDataType(this.unseenItemsReader.GetUnseenItemCount(data.LastVisitedDateUTC), ExDateTimeConverter.ToUtcXsdDateTime(data.LastVisitedDateUTC)),
         Source = MailboxLocation.FromMailboxContext(base.UserContext)
     });
 }
        internal override void HandleNotificationInternal(Notification notif, MapiNotificationsLogEvent logEvent, object context)
        {
            if (notif == null)
            {
                return;
            }
            ReminderNotificationPayload reminderNotificationPayload = new ReminderNotificationPayload(true);

            reminderNotificationPayload.SubscriptionId = base.SubscriptionId;
            reminderNotificationPayload.Source         = MailboxLocation.FromMailboxContext(base.UserContext);
            this.reminderNotifier.AddGetRemindersPayload(reminderNotificationPayload);
            this.reminderNotifier.PickupData();
        }
Esempio n. 4
0
        protected override IList <NotificationPayloadBase> ReadDataAndResetStateInternal()
        {
            List <NotificationPayloadBase> list = new List <NotificationPayloadBase>();

            if (this.refreshAll)
            {
                list.Add(new ReminderNotificationPayload
                {
                    Reload = true,
                    Source = MailboxLocation.FromMailboxContext(base.UserContext)
                });
            }
            else if (this.shouldGetRemindersPayload != null)
            {
                list.Add(this.shouldGetRemindersPayload);
            }
            this.Clear(true);
            return(list);
        }
 internal override void HandlePendingGetTimerCallback(MapiNotificationsLogEvent logEvent)
 {
     lock (base.SyncRoot)
     {
         base.InitSubscription();
         if (base.MissedNotifications)
         {
             base.NeedRefreshPayload = true;
         }
         base.MissedNotifications = false;
     }
     if (base.NeedRefreshPayload)
     {
         ReminderNotificationPayload reminderNotificationPayload = new ReminderNotificationPayload(true);
         reminderNotificationPayload.SubscriptionId = base.SubscriptionId;
         reminderNotificationPayload.Source         = MailboxLocation.FromMailboxContext(base.UserContext);
         this.reminderNotifier.AddGetRemindersPayload(reminderNotificationPayload);
         base.NeedRefreshPayload = false;
     }
     this.reminderNotifier.PickupData();
 }
            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);
            }
        protected override IList <NotificationPayloadBase> ReadDataAndResetStateInternal()
        {
            List <NotificationPayloadBase> result;

            if (this.refreshAll)
            {
                GroupAssociationNotificationPayload groupAssociationNotificationPayload = new GroupAssociationNotificationPayload();
                groupAssociationNotificationPayload.EventType = QueryNotificationType.Reload;
                groupAssociationNotificationPayload.Source    = MailboxLocation.FromMailboxContext(base.UserContext);
                this.refreshAll = false;
                result          = new List <NotificationPayloadBase>
                {
                    groupAssociationNotificationPayload
                };
                NotificationStatisticsManager.Instance.NotificationCreated(groupAssociationNotificationPayload);
            }
            else
            {
                result = new List <NotificationPayloadBase>(this.payloadQueue);
                this.payloadQueue.Clear();
            }
            return(result);
        }
        // Token: 0x06000DE4 RID: 3556 RVA: 0x00034ABC File Offset: 0x00032CBC
        public override bool Equals(object obj)
        {
            MailboxLocation mailboxLocation = obj as MailboxLocation;

            return(mailboxLocation != null && this.mailboxGuid.Equals(mailboxLocation.mailboxGuid));
        }
        protected NewMailNotificationPayload BindToItemAndCreatePayload(NewMailNotification notification)
        {
            NewMailNotificationPayload result;

            try
            {
                base.UserContext.LockAndReconnectMailboxSession(3000);
                MessageItem newMessage             = null;
                NewMailNotificationPayload payload = new NewMailNotificationPayload();
                payload.Source         = MailboxLocation.FromMailboxContext(base.UserContext);
                payload.SubscriptionId = base.SubscriptionId;
                try
                {
                    newMessage = Item.BindAsMessage(base.UserContext.MailboxSession, notification.NewMailItemId, this.GetAdditionalPropsToLoad());
                    ExchangeVersion.ExecuteWithSpecifiedVersion(ExchangeVersion.Exchange2012, delegate
                    {
                        payload.ItemId         = IdConverter.ConvertStoreItemIdToItemId(newMessage.Id, this.UserContext.MailboxSession).Id;
                        payload.ConversationId = IdConverter.ConversationIdToEwsId(this.UserContext.MailboxSession.MailboxGuid, newMessage.GetConversation(new PropertyDefinition[0]).ConversationId);
                    });
                    if (newMessage != null)
                    {
                        if (newMessage.From != null && newMessage.From.DisplayName != null)
                        {
                            payload.Sender = newMessage.From.DisplayName;
                        }
                        if (newMessage.Subject != null)
                        {
                            payload.Subject = newMessage.Subject;
                        }
                        string previewText = newMessage.Body.PreviewText;
                        if (previewText != null)
                        {
                            payload.PreviewText = previewText;
                        }
                        this.OnPayloadCreated(newMessage, payload);
                        result = payload;
                    }
                    else
                    {
                        result = null;
                    }
                }
                catch (ObjectNotFoundException)
                {
                    result = null;
                }
                finally
                {
                    if (newMessage != null)
                    {
                        newMessage.Dispose();
                    }
                }
            }
            finally
            {
                if (base.UserContext.MailboxSessionLockedByCurrentThread())
                {
                    base.UserContext.UnlockAndDisconnectMailboxSession();
                }
            }
            return(result);
        }