Beispiel #1
0
        // Token: 0x06001BF2 RID: 7154 RVA: 0x0006C848 File Offset: 0x0006AA48
        protected override void InternalUnsubscribeNotification(IMailboxContext userContext, SubscriptionData subscription)
        {
            if (subscription.Parameters == null)
            {
                throw new ArgumentNullException("Subscription data parameters cannot be null");
            }
            NotificationType notificationType = subscription.Parameters.NotificationType;

            if (notificationType == NotificationType.UnseenItemNotification)
            {
                userContext.NotificationManager.UnsubscribeToUnseenCountNotification(subscription.SubscriptionId, subscription.Parameters);
                return;
            }
            base.InternalUnsubscribeNotification(userContext, subscription);
        }
Beispiel #2
0
        protected virtual void InternalUnsubscribeNotification(IMailboxContext userContext, SubscriptionData subscription)
        {
            if (subscription.Parameters == null)
            {
                throw new ArgumentNullException("Subscription data parameters cannot be null");
            }
            NotificationType notificationType = subscription.Parameters.NotificationType;

            switch (notificationType)
            {
            case NotificationType.RowNotification:
            case NotificationType.CalendarItemNotification:
                userContext.NotificationManager.UnsubscribeForRowNotifications(subscription.SubscriptionId, subscription.Parameters);
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <NotificationType>((long)this.GetHashCode(), "[UnsubscribeToNotificationBase::InternalExecute] Unsubscribe for row notifications ({0})", subscription.Parameters.NotificationType);
                return;

            default:
                if (notificationType == NotificationType.SearchNotification)
                {
                    RemoteNotificationManager.Instance.UnSubscribe(userContext.Key.ToString(), "SearchNotification", subscription.Parameters.ChannelId, RemoteRequestProcessor.GetRequesterUserId(base.CallContext.HttpContext.Request.Headers));
                    return;
                }
                if (notificationType != NotificationType.InstantSearchNotification)
                {
                    throw new OwaInvalidOperationException("Invalid Notification type specified when calling unsubscribe");
                }
                return;
            }
        }
Beispiel #3
0
 // Token: 0x06001BF0 RID: 7152 RVA: 0x0006C7E8 File Offset: 0x0006A9E8
 protected override void InternalUnsubscribeNotification(IMailboxContext userContext, SubscriptionData subscription)
 {
     if (subscription.Parameters == null)
     {
         throw new ArgumentNullException("Subscription data parameters cannot be null");
     }
     if (subscription.Parameters.NotificationType != NotificationType.UnseenItemNotification)
     {
         throw new OwaInvalidOperationException("Invalid Notification type specified when calling UnsubscribeToGroupUnseenNotification");
     }
     ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[UnsubscribeToGroupUnseenNotification::InternalUnsubscribeNotification] Unsubscribe for unseen notifications for subscription {0}", subscription.SubscriptionId);
 }
        // Token: 0x06001BD5 RID: 7125 RVA: 0x0006B918 File Offset: 0x00069B18
        protected virtual void InternalCreateASubscription(IMailboxContext userContext, SubscriptionData subscription, bool remoteSubscription)
        {
            switch (subscription.Parameters.NotificationType)
            {
            case NotificationType.RowNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't subsribe to RowNotification.");
                }
                this.metricType = SubscribeToNotificationMetadata.RowNotificationLatency;
                userContext.NotificationManager.SubscribeToRowNotification(subscription.SubscriptionId, subscription.Parameters, this.request.Header.TimeZoneContext.TimeZoneDefinition.ExTimeZone, base.CallContext, remoteSubscription);
                return;

            case NotificationType.CalendarItemNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't subsribe to CalendarItenNotification.");
                }
                this.metricType = SubscribeToNotificationMetadata.CalendarItemNotificationLatency;
                userContext.NotificationManager.SubscribeToRowNotification(subscription.SubscriptionId, subscription.Parameters, this.request.Header.TimeZoneContext.TimeZoneDefinition.ExTimeZone, base.CallContext, remoteSubscription);
                return;

            default:
                ExTraceGlobals.NotificationsCallTracer.TraceWarning(0L, "[SubscribeToNotificationBase.InternalCreateASubscription] Unsupported subscription type provided.");
                return;
            }
        }
        // Token: 0x06001BDC RID: 7132 RVA: 0x0006BF88 File Offset: 0x0006A188
        protected override void InternalCreateASubscription(IMailboxContext userContext, SubscriptionData subscription, bool remoteSubscription)
        {
            if (subscription.Parameters.FolderId != null)
            {
                throw new ArgumentException("Subscription parameter FolderId cannot be specified on Group subscriptions");
            }
            if (subscription.Parameters.NotificationType != NotificationType.UnseenItemNotification)
            {
                throw new OwaInvalidOperationException("Invalid Notification type specified when calling SubscribeToGroupUnseenNotification");
            }
            if (!(userContext is SharedContext))
            {
                throw new OwaInvalidOperationException("Unseen Notifications should be using a SharedContext");
            }
            this.metricType = SubscribeToNotificationMetadata.UnseenItemNotificationLatency;
            IRecipientSession  adrecipientSession = base.CallContext.ADRecipientSessionContext.GetADRecipientSession();
            UserMailboxLocator mailboxLocator     = UserMailboxLocator.Instantiate(adrecipientSession, base.CallContext.AccessingADUser);
            string             subscriptionId     = userContext.NotificationManager.SubscribeToUnseenItemNotification(subscription.SubscriptionId, mailboxLocator, adrecipientSession);

            subscription.SubscriptionId = subscriptionId;
        }
 private void CreateSubscriptionForWellKnownFolder(IMailboxContext userContext, SubscriptionData subscription, DefaultFolderType folderType)
 {
     try
     {
         userContext.LockAndReconnectMailboxSession(3000);
         StoreObjectId defaultFolderId = userContext.MailboxSession.GetDefaultFolderId(folderType);
         subscription.Parameters.FolderId = StoreId.StoreIdToEwsId(userContext.MailboxSession.MailboxGuid, defaultFolderId);
     }
     finally
     {
         if (userContext.MailboxSessionLockedByCurrentThread())
         {
             userContext.UnlockAndDisconnectMailboxSession();
         }
     }
     base.InternalCreateASubscription(userContext, subscription, true);
 }
        protected override void InternalCreateASubscription(IMailboxContext userContext, SubscriptionData subscription, bool remoteSubscription)
        {
            NotificationType notificationType = subscription.Parameters.NotificationType;

            switch (notificationType)
            {
            case NotificationType.RowNotification:
                if (subscription.Parameters.FolderId != null)
                {
                    throw new ArgumentException("Subscription parameter FolderId cannot be specified on Group subscriptions");
                }
                this.CreateSubscriptionForWellKnownFolder(userContext, subscription, DefaultFolderType.Inbox);
                return;

            case NotificationType.CalendarItemNotification:
                this.CreateSubscriptionForWellKnownFolder(userContext, subscription, DefaultFolderType.Calendar);
                return;

            default:
            {
                if (notificationType == NotificationType.SearchNotification)
                {
                    bool flag;
                    RemoteNotificationManager.Instance.Subscribe(userContext.Key.ToString(), userContext.ExchangePrincipal.MailboxInfo.MailboxGuid.ToString(), "SearchNotification", subscription.Parameters.ChannelId, RemoteRequestProcessor.GetRequesterUserId(base.CallContext.HttpContext.Request.Headers), NotificationType.SearchNotification, out flag);
                    return;
                }
                if (notificationType != NotificationType.InstantSearchNotification)
                {
                    base.InternalCreateASubscription(userContext, subscription, true);
                    return;
                }
                UserContext userContext2 = userContext as UserContext;
                if (userContext2 == null)
                {
                    throw new OwaInvalidOperationException("UserContext isn't a full user context. Cannot subscribe to InstantSearch notifications.");
                }
                InstantSearchRemoteNotificationHandler instantSearchRemoteNotificationHandler = userContext2.InstantSearchNotificationHandler as InstantSearchRemoteNotificationHandler;
                if (instantSearchRemoteNotificationHandler == null)
                {
                    throw new OwaInvalidOperationException("Wrong notification handler for an InstantSearch remote subscription scenario.");
                }
                instantSearchRemoteNotificationHandler.RegisterNotifier(subscription.SubscriptionId);
                return;
            }
            }
        }
        protected override void InternalCreateASubscription(IMailboxContext userContext, SubscriptionData subscription, bool remoteSubscription)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            UserContext userContext2 = userContext as UserContext;

            switch (subscription.Parameters.NotificationType)
            {
            case NotificationType.HierarchyNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't access HierarchyNotificationManager.");
                }
                this.metricType = SubscribeToNotificationMetadata.HierarchyNotificationLatency;
                userContext.NotificationManager.SubscribeToHierarchyNotification(subscription.SubscriptionId);
                return;

            case NotificationType.ReminderNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't access ReminderNotificationManager.");
                }
                this.metricType = SubscribeToNotificationMetadata.ReminderNotificationLatency;
                userContext.NotificationManager.SubscribeToReminderNotification(subscription.SubscriptionId);
                return;

            case NotificationType.PlayOnPhoneNotification:
                this.metricType = SubscribeToNotificationMetadata.PlayOnPhoneNotificationLatency;
                if (userContext2 == null)
                {
                    throw new OwaInvalidOperationException("UserContext isn't a full user context. Can't access PlayOnPhoneNotificationManager.");
                }
                userContext2.PlayOnPhoneNotificationManager.SubscribeToPlayOnPhoneNotification(subscription.SubscriptionId, subscription.Parameters);
                return;

            case NotificationType.InstantMessageNotification:
                this.metricType = SubscribeToNotificationMetadata.InstantMessageNotificationLatency;
                if (userContext2 == null)
                {
                    throw new OwaInvalidOperationException("UserContext isn't a full user context. Can't access InstantMessageManager.");
                }
                if (userContext2.InstantMessageManager != null)
                {
                    userContext2.InstantMessageManager.Subscribe(subscription.SubscriptionId);
                    return;
                }
                return;

            case NotificationType.NewMailNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't access NewMailNotificationManager.");
                }
                this.metricType = SubscribeToNotificationMetadata.NewMailNotificationLatency;
                userContext.NotificationManager.SubscribeToNewMailNotification(subscription.SubscriptionId, subscription.Parameters);
                return;

            case NotificationType.UnseenItemNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager.");
                }
                this.metricType = SubscribeToNotificationMetadata.UnseenItemNotificationLatency;
                userContext.NotificationManager.SubscribeToUnseenCountNotification(subscription.SubscriptionId, subscription.Parameters, base.CallContext.ADRecipientSessionContext.GetADRecipientSession());
                return;

            case NotificationType.GroupAssociationNotification:
            {
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't access GroupAssociationNotificationManager.");
                }
                IRecipientSession adrecipientSession = base.CallContext.ADRecipientSessionContext.GetADRecipientSession();
                userContext.NotificationManager.SubscribeToGroupAssociationNotification(subscription.SubscriptionId, adrecipientSession);
                return;
            }

            case NotificationType.PeopleIKnowNotification:
                if (userContext.NotificationManager == null)
                {
                    throw new OwaInvalidOperationException("User context does not have a valid NotificationManager. Can't access PeopleIKnowNotificationManager.");
                }
                this.metricType = SubscribeToNotificationMetadata.PeopleIKnowNotificationLatency;
                userContext.NotificationManager.SubscribeToRowNotification(subscription.SubscriptionId, subscription.Parameters, this.request.Header.TimeZoneContext.TimeZoneDefinition.ExTimeZone, base.CallContext, false);
                return;
            }
            base.InternalCreateASubscription(userContext, subscription, false);
        }