internal override void HandleNotificationInternal(Notification notif, MapiNotificationsLogEvent logEvent, object context)
        {
            NewMailNotification newMailNotification = notif as NewMailNotification;

            if (newMailNotification == null)
            {
                return;
            }
            if (newMailNotification.NewMailItemId == null || newMailNotification.ParentFolderId == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                return;
            }
            StoreObjectId parentFolderId = newMailNotification.ParentFolderId;

            if (parentFolderId == null || newMailNotification.NewMailItemId == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                return;
            }
            if (!parentFolderId.Equals(this.InboxFolderId))
            {
                return;
            }
            NewMailNotificationPayload newMailNotificationPayload = this.BindToItemAndCreatePayload(newMailNotification);

            if (newMailNotificationPayload != null)
            {
                this.newMailNotifier.Payload = newMailNotificationPayload;
                this.newMailNotifier.PickupData();
            }
        }
예제 #2
0
        // Token: 0x06000DDE RID: 3550 RVA: 0x000349D4 File Offset: 0x00032BD4
        protected override void OnPayloadCreated(MessageItem newMessage, NewMailNotificationPayload payload)
        {
            object obj       = newMessage.TryGetProperty(ItemSchema.IsClutter);
            bool   isClutter = false;

            if (obj is bool)
            {
                isClutter = (bool)obj;
            }
            payload.IsClutter = isClutter;
        }
예제 #3
0
        // Token: 0x06000DF8 RID: 3576 RVA: 0x00034C48 File Offset: 0x00032E48
        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);
        }
        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);
        }
 protected virtual void OnPayloadCreated(MessageItem newMessage, NewMailNotificationPayload payload)
 {
 }