// Token: 0x06000E82 RID: 3714 RVA: 0x00036E28 File Offset: 0x00035028 public void SubscribeToRowNotification(string subscriptionId, SubscriptionParameters parameters, ExTimeZone timeZone, CallContext callContext, bool remoteSubscription) { if (parameters == null) { throw new ArgumentNullException("parameters"); } if (parameters.FolderId == null) { throw new OwaInvalidOperationException("Folder Id must be specified when subscribing to row notifications"); } if (subscriptionId == null) { throw new ArgumentNullException("subscriptionId"); } if (timeZone == null) { throw new ArgumentNullException("timeZone"); } lock (this.syncRoot) { if (!this.isDisposed) { ExTraceGlobals.NotificationsCallTracer.TraceDebug <UserContextKey, string, string>((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] START userContextKey: {0} SubscriptionId: {1} ChannelId: {2}", this.userContext.Key, subscriptionId, parameters.ChannelId); RowNotificationHandler rowNotificationHandler = null; this.rowNotificationHandlerCache.TryGetHandler(subscriptionId, out rowNotificationHandler); if (rowNotificationHandler == null) { StoreObjectId storeObjectId = StoreId.EwsIdToStoreObjectId(parameters.FolderId); if (storeObjectId == null) { throw new OwaInvalidOperationException("Invalid Folder Id. Could not be converted to a storeFolderId"); } if (parameters.NotificationType == NotificationType.CalendarItemNotification) { rowNotificationHandler = new CalendarItemNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, remoteSubscription); } else if (parameters.NotificationType == NotificationType.PeopleIKnowNotification) { rowNotificationHandler = new PeopleIKnowRowNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, callContext.ClientCulture); } else if (parameters.IsConversation) { UserContext fullUserContext = this.GetFullUserContext("Conversation row notification"); rowNotificationHandler = new ConversationRowNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, remoteSubscription, fullUserContext.FeaturesManager); } else { UserContext fullUserContext2 = this.GetFullUserContext("MessageItem row notification"); rowNotificationHandler = new MessageItemRowNotificationHandler(subscriptionId, parameters, storeObjectId, this.userContext, this.userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, timeZone, fullUserContext2.FeaturesManager); } try { ExTraceGlobals.NotificationsCallTracer.TraceDebug <UserContextKey, string, string>((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] userContextKey: {0} New subscription for subscriptionId: {1} ChannelId: {2}", this.userContext.Key, subscriptionId, parameters.ChannelId); this.WireConnectionDroppedHandler(rowNotificationHandler); rowNotificationHandler.Subscribe(); rowNotificationHandler.OnBeforeDisposed += this.BeforeDisposeRowNotificationHandler; this.rowNotificationHandlerCache.AddHandler(subscriptionId, rowNotificationHandler, parameters.ChannelId); rowNotificationHandler = null; goto IL_319; } finally { if (rowNotificationHandler != null) { try { this.userContext.LockAndReconnectMailboxSession(3000); rowNotificationHandler.Dispose(); rowNotificationHandler = null; } catch (OwaLockTimeoutException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] User context lock timed out in attempt to dispose handler. Exception: {0}", ex.Message); } finally { if (this.userContext.MailboxSessionLockedByCurrentThread()) { this.userContext.UnlockAndDisconnectMailboxSession(); } } } } } ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] userContextKey: {0} Reusing existing notification handler subscriptionId: {1} ChannelId: {2} Current RefCount: {3}. Setting MissedNotifications = false", new object[] { this.userContext.Key, subscriptionId, parameters.ChannelId, rowNotificationHandler.RefCount }); rowNotificationHandler.MissedNotifications = false; if (rowNotificationHandler.NeedToReinitSubscriptions) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "[OwaMapiNotificationManager::SubscribeToRowNotification] userContextKey: {0} Need to re-init subscriptionId: {1} ChannelId: {2} Refcount: {3}", new object[] { this.userContext.Key, subscriptionId, parameters.ChannelId, rowNotificationHandler.RefCount }); rowNotificationHandler.Subscribe(); } this.rowNotificationHandlerCache.AddHandler(subscriptionId, rowNotificationHandler, parameters.ChannelId); } IL_319 :; } }
protected MessageItemRowNotificationHandler(string subscriptionId, SubscriptionParameters parameters, StoreObjectId folderId, IMailboxContext userContext, Guid mailboxGuid, RowNotifier notifier, IFeaturesManager featuresManager = null) : base(subscriptionId, parameters, folderId, userContext, mailboxGuid, notifier, false) { this.mailboxId = new MailboxId(mailboxGuid); this.subscriptionProperties = MessageItemRowNotificationHandler.GetSubscriptionProperties(featuresManager); }