// Token: 0x06000D27 RID: 3367 RVA: 0x0003156C File Offset: 0x0002F76C
 internal override void HandleNotificationInternal(Notification notification, MapiNotificationsLogEvent logEvent, object context)
 {
     lock (base.SyncRoot)
     {
         if (notification == null)
         {
             ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Received NULL notification");
             logEvent.NullNotification = true;
         }
         else
         {
             QueryNotification queryNotification = (QueryNotification)notification;
             ExTraceGlobals.NotificationsCallTracer.TraceDebug <QueryNotificationType, int>((long)this.GetHashCode(), "CalendarItemNotificationHandler received a notification. Type: {0}. Row length: {1}.", queryNotification.EventType, queryNotification.Row.Length);
             string itemProperty = RowNotificationHandler.GetItemProperty <string>(queryNotification, 38);
             if (ObjectClass.IsCalendarItemSeries(itemProperty))
             {
                 ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "CalendarItemNotificationHandler ignored notification for item of class: {0}.", itemProperty);
             }
             else if (base.ProcessErrorNotification(queryNotification))
             {
                 logEvent.InvalidNotification = true;
             }
             else
             {
                 base.Notifier.AddFolderContentChangePayload(base.FolderId, this.GetPayloadFromNotification(base.FolderId, queryNotification));
                 base.Notifier.PickupData();
             }
         }
     }
 }
Esempio n. 2
0
        // Token: 0x06000D1E RID: 3358 RVA: 0x00030ED0 File Offset: 0x0002F0D0
        protected bool ProcessErrorNotification(QueryNotification notification)
        {
            bool flag = false;

            if (notification.ErrorCode != 0)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceError <int, string>((long)this.GetHashCode(), "[RowNotificationHandler::ProcessErrorNotification]. Error in Notification: {0}. Subscription: {1}", notification.ErrorCode, base.SubscriptionId);
                flag = true;
            }
            else if (notification.EventType == QueryNotificationType.Error)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "[RowNotificationHandler::ProcessErrorNotification] Error in Notification, Type is QueryNotificationType.Error. Subscription: {0}", base.SubscriptionId);
                flag = true;
            }
            else if ((notification.EventType == QueryNotificationType.RowAdded || notification.EventType == QueryNotificationType.RowModified) && notification.Row.Length < this.SubscriptionProperties.Length)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceError <int, int, string>((long)this.GetHashCode(), "[RowNotificationHandler::ProcessErrorNotification] XSO gave an incomplete notification, expected row length {0}, actual row length {1}. Subscription: {2}", notification.Row.Length, this.SubscriptionProperties.Length, base.SubscriptionId);
                flag = true;
            }
            if (flag)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "[RowNotificationHandler::ProcessErrorNotification] Notification has error, calling AddFolderRefreshPayload and returning true. Subscription: {0}", base.SubscriptionId);
                this.AddFolderRefreshPayload();
                this.notifier.PickupData();
                return(true);
            }
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[RowNotificationHandler::ProcessErrorNotification]. Returning false, no error to process. Subscription: {0}", base.SubscriptionId);
            return(false);
        }
Esempio n. 3
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);
        }
        // Token: 0x06000D65 RID: 3429 RVA: 0x00032C78 File Offset: 0x00030E78
        private void LoadConversationFeedPropertiesIfRequested(QueryNotification notification, ConversationType conv)
        {
            bool flag   = false;
            int  index  = Array.IndexOf <PropertyDefinition>(this.SubscriptionProperties, ConversationItemSchema.ConversationInitialMemberDocumentId);
            int  index2 = Array.IndexOf <PropertyDefinition>(this.SubscriptionProperties, ConversationItemSchema.ConversationMemberDocumentIds);
            int? initialMemberDocumentId = null;

            int[] memberDocumentIds = null;
            if (RowNotificationHandler.IsPropertyDefined(notification, index))
            {
                initialMemberDocumentId = RowNotificationHandler.GetItemProperty <int?>(notification, index);
                flag = true;
            }
            if (RowNotificationHandler.IsPropertyDefined(notification, index2))
            {
                memberDocumentIds = RowNotificationHandler.GetItemProperty <int[]>(notification, index2);
                flag = true;
            }
            if (flag)
            {
                SimulatedWebRequestContext.Execute(base.UserContext, "LoadConversationFeedPropertiesIfRequested", delegate(MailboxSession mailboxSession, IRecipientSession adSession, RequestDetailsLogger logger)
                {
                    ConversationFeedLoader conversationFeedLoader = new ConversationFeedLoader(mailboxSession, this.TimeZone);
                    conversationFeedLoader.LoadConversationFeedItems(conv, initialMemberDocumentId, memberDocumentIds);
                });
            }
        }
Esempio n. 5
0
        // Token: 0x06000F01 RID: 3841 RVA: 0x0003A698 File Offset: 0x00038898
        private PeopleIKnowRowNotificationPayload GetRowNotificationPayload(QueryNotification notification)
        {
            PeopleIKnowRowNotificationPayload emptyPayload = this.GetEmptyPayload();

            emptyPayload.EventType          = notification.EventType;
            emptyPayload.PersonaEmailAdress = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.SubscriptionProperties, MessageItemSchema.SenderSmtpAddress));
            emptyPayload.PersonaUnreadCount = RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.SubscriptionProperties, FolderSchema.UnreadCount));
            emptyPayload.Source             = new MailboxLocation(base.MailboxGuid);
            return(emptyPayload);
        }
        // Token: 0x06000D2B RID: 3371 RVA: 0x00031AC8 File Offset: 0x0002FCC8
        private double?GetLocationPropertyValue(QueryNotification notification, int index)
        {
            double?itemProperty = RowNotificationHandler.GetItemProperty <double?>(notification, index);

            if (itemProperty == null || double.IsNaN(itemProperty.Value))
            {
                return(null);
            }
            return(itemProperty);
        }
Esempio n. 7
0
        // Token: 0x06000D20 RID: 3360 RVA: 0x00031050 File Offset: 0x0002F250
        protected string GetDateTimeProperty(QueryNotification notification, int index)
        {
            ExDateTime itemProperty = RowNotificationHandler.GetItemProperty <ExDateTime>(notification, index, ExDateTime.MinValue);

            if (ExDateTime.MinValue.Equals(itemProperty))
            {
                return(null);
            }
            return(ExDateTimeConverter.ToOffsetXsdDateTime(itemProperty, this.timeZone));
        }
Esempio n. 8
0
 // Token: 0x06000DB0 RID: 3504 RVA: 0x000337A0 File Offset: 0x000319A0
 private static T GetItemProperty <T>(QueryNotification notification, int index, T defaultValue)
 {
     if (index >= notification.Row.Length || notification.Row[index] == null || notification.Row[index] is PropertyError)
     {
         return(defaultValue);
     }
     if (notification.Row[index] is T)
     {
         return((T)((object)notification.Row[index]));
     }
     return(defaultValue);
 }
Esempio n. 9
0
        // Token: 0x06000D11 RID: 3345 RVA: 0x00030838 File Offset: 0x0002EA38
        internal override void HandleNotificationInternal(Notification notification, MapiNotificationsLogEvent logEvent, object context)
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification row notification received. User: {0}. SubscriptionId: {1}", base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
            lock (base.SyncRoot)
            {
                if (base.IsDisposed_Reentrant)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "RowNotificationHandlerBase.HandleNotificationInternal for {0}: Ignoring notification because we're disposed (reentrant).", base.GetType().Name);
                }
                else if (notification == null)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug <SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification: Received a null Row Notification object for user {0} SubscriptionId: {1}", base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
                    logEvent.NullNotification = true;
                }
                else
                {
                    QueryNotification queryNotification = (QueryNotification)notification;
                    if (this.ProcessErrorNotification(queryNotification))
                    {
                        ExTraceGlobals.NotificationsCallTracer.TraceDebug <SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification: Received a invalid Row Notification object for user {0} SubscriptionId: {1}", base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
                        logEvent.InvalidNotification = true;
                    }
                    else
                    {
                        QueryNotificationType eventType = queryNotification.EventType;
                        switch (eventType)
                        {
                        case QueryNotificationType.QueryResultChanged:
                            ExTraceGlobals.NotificationsCallTracer.TraceDebug <QueryNotificationType, SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification: EventType {0}. Calling ProcessQueryResultChangedNotification. user {1} SubscriptionId: {2}", eventType, base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
                            this.ProcessQueryResultChangedNotification();
                            goto IL_1EE;

                        case QueryNotificationType.RowAdded:
                        case QueryNotificationType.RowDeleted:
                        case QueryNotificationType.RowModified:
                            ExTraceGlobals.NotificationsCallTracer.TraceDebug <QueryNotificationType, SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification: EventType {0} for user {1} SubscriptionId: {2}", eventType, base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
                            this.notifier.AddFolderContentChangePayload(this.folderId, this.GetPayloadFromNotification(this.folderId, queryNotification));
                            goto IL_1EE;

                        case QueryNotificationType.Reload:
                            ExTraceGlobals.NotificationsCallTracer.TraceDebug <QueryNotificationType, SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification: EventType {0}. Calling ProcessReloadNotification. user {1} SubscriptionId: {2}", eventType, base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
                            this.ProcessReloadNotification();
                            goto IL_1EE;
                        }
                        ExTraceGlobals.NotificationsCallTracer.TraceDebug <QueryNotificationType, SmtpAddress, string>((long)this.GetHashCode(), "RowNotificationHandler.HandleNotification: EventType {0}. Ignoring. user {1} SubscriptionId: {2}", eventType, base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
IL_1EE:
                        this.notifier.PickupData();
                    }
                }
            }
        }
Esempio n. 10
0
        // Token: 0x06000D14 RID: 3348 RVA: 0x00030B94 File Offset: 0x0002ED94
        protected static T GetItemProperty <T>(QueryNotification notification, int index, T defaultValue)
        {
            if (!RowNotificationHandler.IsPropertyDefined(notification, index))
            {
                return(defaultValue);
            }
            object obj = notification.Row[index];

            if (!(obj is T))
            {
                return(defaultValue);
            }
            return((T)((object)obj));
        }
Esempio n. 11
0
 static MenuGetter()
 {
     CourseSelectionInstance = new CourseSelection();
     MatchSchemeInstance     = new MatchScheme();
     QueryMarkInstance       = new QueryMark();
     QueryInformInstance     = new QueryNotification();
     QueryEmployInstance     = new QueryEmploy();
     QueryMealCardInstance   = new QueryMealcard();
     QueryCostInstance       = new QueryElectricity();
     SearchInstance          = new Search();
     AbsenceInstance         = new AbsenceInput();
     UserInfoInstance        = new UserInfoDisplay();
     ForumInstance           = new Forum();
 }
        // Token: 0x06001471 RID: 5233 RVA: 0x0007CD6C File Offset: 0x0007AF6C
        private bool ProcessErrorNotification(QueryNotification notification)
        {
            bool flag = false;

            if (notification.ErrorCode != 0)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <int>((long)this.GetHashCode(), "Error in Notification: {0}", notification.ErrorCode);
                flag = true;
            }
            else if (notification.EventType == QueryNotificationType.Error)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Error in Notification, Type is QueryNotificationType.Error");
                flag = true;
            }
            else if ((notification.EventType == QueryNotificationType.RowAdded || notification.EventType == QueryNotificationType.RowModified) && notification.Row.Length < this.subscriptionProperties.Length)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <int, int>((long)this.GetHashCode(), "XSO gave an incomplete notification, expected row length {0}, actual row length {1}", notification.Row.Length, this.subscriptionProperties.Length);
                flag = true;
            }
            try
            {
                TimeGroupByList2 timeGroupByList = this.listView as TimeGroupByList2;
                if (timeGroupByList != null && !timeGroupByList.IsValid())
                {
                    flag = true;
                    this.needReinitSubscriptions = true;
                }
            }
            catch (Exception ex)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in FolderContentChangeNotificationHandler:ProcessErrorNotification. Exception: {0}", ex.ToString());
                if (Globals.SendWatsonReports)
                {
                    ExTraceGlobals.CoreTracer.TraceDebug(0L, "Sending watson report");
                    ExWatson.AddExtraData(this.GetExtraWatsonData());
                    ExWatson.SendReport(ex);
                }
                flag = true;
                this.needReinitSubscriptions = true;
            }
            if (flag)
            {
                this.AddFolderRefreshPayload();
                this.payload.PickupData();
                return(true);
            }
            return(false);
        }
        // Token: 0x06001462 RID: 5218 RVA: 0x0007C660 File Offset: 0x0007A860
        internal override void HandleNotification(Notification xsoNotification)
        {
            try
            {
                if (Globals.ArePerfCountersEnabled)
                {
                    OwaSingleCounters.TotalMailboxNotifications.Increment();
                }
                lock (this.syncRoot)
                {
                    if (!this.isDisposed && !this.missedNotifications && !this.needReinitSubscriptions && !this.ShouldIgnoreNotification)
                    {
                        if (xsoNotification == null)
                        {
                            ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Received NULL notification");
                        }
                        else
                        {
                            QueryNotification queryNotification = (QueryNotification)xsoNotification;
                            if (!this.ProcessErrorNotification(queryNotification))
                            {
                                switch (queryNotification.EventType)
                                {
                                case QueryNotificationType.QueryResultChanged:
                                case QueryNotificationType.Reload:
                                    this.ProcessReloadNotification();
                                    break;

                                case QueryNotificationType.RowAdded:
                                case QueryNotificationType.RowDeleted:
                                case QueryNotificationType.RowModified:
                                    this.payload.AddFolderContentChangePayload(this.contextFolderId, queryNotification);
                                    break;
                                }
                                this.payload.PickupData();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Unexpected exception in FolderContentChangeNotificationHandler:HandleNotification for user {0}. Exception: {1}", this.MailboxSessionDisplayName, ex.Message);
                this.missedNotifications = true;
            }
        }
 // Token: 0x0600146A RID: 5226 RVA: 0x0007CA98 File Offset: 0x0007AC98
 private void ProcessRowModifiedNotification(TextWriter writer, QueryNotification notification)
 {
     this.CreateNotificationDataSource(notification);
     this.AddRowNotificationPrefix(writer, notification);
     writer.Write(",'");
     Utilities.JavascriptEncode(Convert.ToBase64String(notification.Prior), writer);
     writer.Write("','");
     this.AddRowData(writer, notification.EventType, ListViewContents2.ListViewRowType.RenderOnlyRow1);
     writer.Write("','");
     this.AddRowData(writer, notification.EventType, ListViewContents2.ListViewRowType.RenderOnlyRow2);
     writer.Write("','");
     this.AddRowProperties(writer, notification.EventType);
     writer.Write("'");
     this.AddRowNotificationSuffix(writer);
     this.listView.DataSource = null;
     this.ItemList.DataSource = null;
 }
Esempio n. 15
0
 public void AddFolderContentChangePayload(OwaStoreObjectId folderId, QueryNotification notification)
 {
     lock (this)
     {
         if (!this.folderRefreshList.Contains(folderId))
         {
             Queue <QueryNotification> folderContentChangePayloadQueue = this.GetFolderContentChangePayloadQueue(folderId);
             if (folderContentChangePayloadQueue != null && folderContentChangePayloadQueue.Count >= 40)
             {
                 this.AddFolderRefreshPayload(folderId);
             }
             else
             {
                 folderContentChangePayloadQueue.Enqueue(notification);
             }
         }
     }
 }
Esempio n. 16
0
        // Token: 0x06000DAD RID: 3501 RVA: 0x000335F0 File Offset: 0x000317F0
        internal override void HandleNotificationInternal(Notification notification, MapiNotificationsLogEvent logEvent, object context)
        {
            QueryNotification queryNotification = notification as QueryNotification;

            if (queryNotification == null)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <SmtpAddress, string>((long)this.GetHashCode(), "GroupAssociationNotificationHandler.HandleNotificationInternal: Received a null QueryNotification object for user {0} SubscriptionId: {1}", base.UserContext.PrimarySmtpAddress, base.SubscriptionId);
                logEvent.NullNotification = true;
                return;
            }
            GroupAssociationNotificationPayload payloadFromNotification = this.GetPayloadFromNotification(queryNotification);

            lock (base.SyncRoot)
            {
                this.notifier.AddGroupAssociationNotificationPayload(payloadFromNotification);
                this.notifier.PickupData();
            }
        }
        private void ProcessHierarchyNotification(QueryNotification notification)
        {
            VersionedId   versionedId   = notification.Row[0] as VersionedId;
            StoreObjectId storeObjectId = null;

            if (versionedId != null)
            {
                storeObjectId = versionedId.ObjectId;
            }
            if (storeObjectId == null || notification.Row[2] == null || notification.Row[3] == null || notification.Row[4] == null || notification.Row[6] == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "Hierarchy notification has a null folder id or is malformed. User: {0}", base.UserContext.PrimarySmtpAddress);
                return;
            }
            int num  = (int)notification.Row[2];
            int num2 = (int)notification.Row[3];

            if (notification.Row[6] is bool && !(bool)notification.Row[6] && !this.IsAllowedSearchFolder(storeObjectId))
            {
                return;
            }
            HierarchyNotificationPayload payloadInstance = this.GetPayloadInstance(storeObjectId);

            payloadInstance.FolderId       = StoreId.StoreIdToEwsId(this.mailboxGuid, storeObjectId);
            payloadInstance.DisplayName    = (string)notification.Row[1];
            payloadInstance.ParentFolderId = ((notification.Row[5] != null) ? StoreId.StoreIdToEwsId(this.mailboxGuid, notification.Row[5] as StoreId) : null);
            payloadInstance.ItemCount      = (long)num;
            payloadInstance.UnreadCount    = (long)num2;
            payloadInstance.SubscriptionId = base.SubscriptionId;
            payloadInstance.EventType      = notification.EventType;
            if (!(notification.Row[4] is PropertyError))
            {
                string          itemClass  = (string)notification.Row[4];
                StoreObjectType objectType = ObjectClass.GetObjectType(itemClass);
                payloadInstance.FolderType = objectType;
            }
            else
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "Hierarchy notification received PropertyError for Item Class. User: {0}", base.UserContext.PrimarySmtpAddress);
            }
            this.hierarchyNotifier.AddFolderCountPayload(storeObjectId, payloadInstance);
        }
        internal override void HandleNotificationInternal(Notification notif, MapiNotificationsLogEvent logEvent, object context)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "HierarchyNotificationHandler.HandleNotification Hierarchy notification received. User: {0}", base.UserContext.PrimarySmtpAddress);
            lock (base.SyncRoot)
            {
                QueryNotification queryNotification = notif as QueryNotification;
                if (queryNotification == null)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "HierarchyNotificationHandler.HandleNotification: Received a null Hierarchy Notification object for user {0}", base.UserContext.PrimarySmtpAddress);
                    logEvent.NullNotification = true;
                }
                else if (queryNotification.Row.Length < this.querySubscriptionProperties.Length)
                {
                    ExTraceGlobals.CoreCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "HierarchyNotificationHandler.HandleNotification: Received an incomplete Hierarchy Notification object for user {0}", base.UserContext.PrimarySmtpAddress);
                    logEvent.InvalidNotification = true;
                }
                else
                {
                    switch (queryNotification.EventType)
                    {
                    case QueryNotificationType.QueryResultChanged:
                    case QueryNotificationType.Reload:
                        this.hierarchyNotifier.AddRefreshPayload(base.SubscriptionId);
                        ExTraceGlobals.NotificationsCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "HierarchyNotificationHandler.HandleNotification: Hierarchy notification refresh payload for user: {0}", base.UserContext.PrimarySmtpAddress);
                        break;

                    case QueryNotificationType.Error:
                        this.hierarchyNotifier.AddRefreshPayload(base.SubscriptionId);
                        ExTraceGlobals.NotificationsCallTracer.TraceDebug <SmtpAddress>((long)this.GetHashCode(), "HierarchyNotificationHandler.HandleNotification: Error in Hierarchy Notification, Type is QueryNotificationType.Error, user: {0}", base.UserContext.PrimarySmtpAddress);
                        break;

                    case QueryNotificationType.RowAdded:
                    case QueryNotificationType.RowDeleted:
                    case QueryNotificationType.RowModified:
                        this.ProcessHierarchyNotification(queryNotification);
                        break;
                    }
                    this.hierarchyNotifier.PickupData();
                }
            }
        }
        // Token: 0x0600146C RID: 5228 RVA: 0x0007CB4C File Offset: 0x0007AD4C
        private void AddRowNotificationPrefix(TextWriter writer, QueryNotification notification)
        {
            writer.Write("folderChangeNotification('");
            Utilities.JavascriptEncode(this.contextFolderId.StoreObjectId.ToBase64String(), writer);
            writer.Write("',['");
            QueryNotificationType eventType = notification.EventType;

            switch (eventType)
            {
            case QueryNotificationType.RowAdded:
            case QueryNotificationType.RowDeleted:
            case QueryNotificationType.RowModified:
                writer.Write((int)eventType);
                writer.Write("','");
                Utilities.JavascriptEncode(Convert.ToBase64String(notification.Index), writer);
                writer.Write("'");
                return;

            default:
                throw new ArgumentException("invalid value for notificationType");
            }
        }
 // Token: 0x06001469 RID: 5225 RVA: 0x0007CA84 File Offset: 0x0007AC84
 private void ProcessRowDeletedNotification(TextWriter writer, QueryNotification notification)
 {
     this.AddRowNotificationPrefix(writer, notification);
     this.AddRowNotificationSuffix(writer);
 }
        // Token: 0x06001463 RID: 5219 RVA: 0x0007C7A0 File Offset: 0x0007A9A0
        internal void ProcessNotification(TextWriter writer, QueryNotification notification, out bool successfullyProcessed)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (notification == null)
            {
                throw new ArgumentNullException("notification");
            }
            successfullyProcessed = true;
            if (this.isDisposed || this.missedNotifications || this.needReinitSubscriptions)
            {
                string message = string.Format("Ignoring folder content change notification for user {0}, isDisposed:{1}, missedNotifications:{2}, needReinitSubscriptions:{3}", new object[]
                {
                    this.MailboxSessionDisplayName,
                    this.isDisposed,
                    this.missedNotifications,
                    this.needReinitSubscriptions
                });
                ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), message);
                return;
            }
            try
            {
                QueryNotificationType eventType = notification.EventType;
                Culture.InternalSetAsyncThreadCulture(this.userContext.UserCulture);
                switch (eventType)
                {
                case QueryNotificationType.RowAdded:
                    this.ProcessRowAddedNotification(writer, notification);
                    break;

                case QueryNotificationType.RowDeleted:
                    this.ProcessRowDeletedNotification(writer, notification);
                    break;

                case QueryNotificationType.RowModified:
                    this.ProcessRowModifiedNotification(writer, notification);
                    break;

                default:
                    throw new ArgumentException("Invalid queryNotificationType :" + eventType);
                }
            }
            catch (Exception ex)
            {
                if (!this.isDisposed && !this.missedNotifications && !this.needReinitSubscriptions)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in FolderContentChangeNotificationHandler:ProcessNotification. Exception: {0}", ex.Message);
                    if (Globals.SendWatsonReports)
                    {
                        ExTraceGlobals.CoreTracer.TraceDebug(0L, "Sending watson report");
                        ExWatson.AddExtraData(this.GetExtraWatsonData());
                        ExWatson.SendReport(ex, ReportOptions.None, null);
                    }
                    successfullyProcessed    = false;
                    this.missedNotifications = true;
                }
            }
        }
        private ItemType GetMessageItemFromNotification(QueryNotification notification)
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[MessageItemRowNotificationHandler.GetMessageItemFromNotification] Start. SubscriptionId: {0}", base.SubscriptionId);
            ItemType itemType;

            if (notification.EventType == QueryNotificationType.RowDeleted)
            {
                itemType = new MessageType
                {
                    InstanceKey = notification.Index
                };
            }
            else
            {
                StoreId       itemProperty  = RowNotificationHandler.GetItemProperty <StoreId>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Id));
                StoreObjectId storeObjectId = StoreId.GetStoreObjectId(itemProperty);
                itemType                   = ItemType.CreateFromStoreObjectType(storeObjectId.ObjectType);
                itemType.InstanceKey       = notification.Index;
                itemType.ItemId            = this.StoreIdToEwsItemId(itemProperty);
                itemType.ParentFolderId    = new FolderId(base.GetEwsId(RowNotificationHandler.GetItemProperty <StoreId>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.ParentItemId))), null);
                itemType.ConversationId    = new ItemId(IdConverter.ConversationIdToEwsId(base.MailboxGuid, RowNotificationHandler.GetItemProperty <ConversationId>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ConversationId))), null);
                itemType.Subject           = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Subject));
                itemType.ImportanceString  = RowNotificationHandler.GetItemProperty <Importance>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Importance), Importance.Normal).ToString();
                itemType.SensitivityString = RowNotificationHandler.GetItemProperty <Sensitivity>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Sensitivity), Sensitivity.Normal).ToString();
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedTime)))
                {
                    itemType.DateTimeReceived = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedTime));
                }
                itemType.HasAttachments = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.HasAttachment)));
                itemType.IsDraft        = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemSchema.IsDraft)));
                itemType.ItemClass      = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.ItemClass));
                MessageType messageType = itemType as MessageType;
                if (messageType != null)
                {
                    if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.From)))
                    {
                        messageType.From = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.From)]);
                    }
                    if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Sender)))
                    {
                        messageType.Sender = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Sender)]);
                    }
                    messageType.IsRead = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemSchema.IsRead)));
                }
                FlagType flagType = new FlagType();
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.CompleteDate)))
                {
                    flagType.CompleteDate = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.CompleteDate));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.FlagStatus)))
                {
                    flagType.FlagStatus = RowNotificationHandler.GetItemProperty <FlagStatus>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.FlagStatus), FlagStatus.NotFlagged);
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.StartDate)))
                {
                    flagType.StartDate = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.StartDate));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.DueDate)))
                {
                    flagType.DueDate = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, TaskSchema.DueDate));
                }
                itemType.Flag = flagType;
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.CreationTime)))
                {
                    itemType.DateTimeCreated = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.CreationTime));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.LastModifiedTime)))
                {
                    itemType.LastModifiedTime = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, StoreObjectSchema.LastModifiedTime));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedOrRenewTime)))
                {
                    itemType.ReceivedOrRenewTime = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.ReceivedOrRenewTime));
                }
                itemType.Categories = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Categories));
                itemType.Preview    = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Preview), null);
                itemType.Size       = RowNotificationHandler.GetItemProperty <int?>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.Size), null);
                itemType.AddExtendedPropertyValue(new ExtendedPropertyType(WellKnownProperties.NormalizedSubject, RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.normalizedSubjectPropertyDefinition), null)));
                itemType.DisplayTo = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.DisplayTo), null);
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.IconIndex)))
                {
                    IconIndex itemProperty2 = (IconIndex)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.IconIndex));
                    if (itemProperty2 > (IconIndex)0)
                    {
                        itemType.IconIndexString = itemProperty2.ToString();
                    }
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.SentTime)))
                {
                    itemType.DateTimeSent = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, ItemSchema.SentTime));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutedPropertyDefinition)))
                {
                    itemType.AddExtendedPropertyValue(new ExtendedPropertyType(WellKnownProperties.LastVerbExecuted, RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutedPropertyDefinition)).ToString()));
                }
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutionTimePropertyDefinition)))
                {
                    itemType.AddExtendedPropertyValue(new ExtendedPropertyType(WellKnownProperties.LastVerbExecutionTime, base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.subscriptionProperties, MessageItemRowNotificationHandler.lastVerbExecutionTimePropertyDefinition))));
                }
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[MessageItemRowNotificationHandler.GetMessageItemFromNotification] End. SubscriptionId: {0}", base.SubscriptionId);
            }
            return(itemType);
        }
        // Token: 0x06000D28 RID: 3368 RVA: 0x0003165C File Offset: 0x0002F85C
        protected override NotificationPayloadBase GetPayloadFromNotification(StoreObjectId folderId, QueryNotification notification)
        {
            CalendarItemNotificationPayload calendarItemNotificationPayload = new CalendarItemNotificationPayload();

            calendarItemNotificationPayload.FolderId       = StoreId.StoreIdToEwsId(base.MailboxGuid, folderId);
            calendarItemNotificationPayload.SubscriptionId = base.SubscriptionId;
            calendarItemNotificationPayload.EventType      = notification.EventType;
            calendarItemNotificationPayload.Source         = new MailboxLocation(base.MailboxGuid);
            EwsCalendarItemType ewsCalendarItemType = new EwsCalendarItemType();

            ewsCalendarItemType.InstanceKey      = notification.Index;
            calendarItemNotificationPayload.Item = ewsCalendarItemType;
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                VersionedId itemProperty = RowNotificationHandler.GetItemProperty <VersionedId>(notification, 0);
                if (itemProperty == null)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Invalid StoreId for calendar item notification.");
                    calendarItemNotificationPayload.Reload = true;
                    return(calendarItemNotificationPayload);
                }
                ConcatenatedIdAndChangeKey concatenatedId = IdConverter.GetConcatenatedId(itemProperty, new MailboxId(base.MailboxGuid), null);
                ewsCalendarItemType.ItemId  = new ItemId(concatenatedId.Id, concatenatedId.ChangeKey);
                ewsCalendarItemType.Start   = base.GetDateTimeProperty(notification, 2);
                ewsCalendarItemType.End     = base.GetDateTimeProperty(notification, 3);
                ewsCalendarItemType.Subject = RowNotificationHandler.GetItemProperty <string>(notification, 4);
                ewsCalendarItemType.LegacyFreeBusyStatusString = BusyTypeConverter.ToString((BusyType)RowNotificationHandler.GetItemProperty <int>(notification, 5));
                ewsCalendarItemType.IsAllDayEvent = RowNotificationHandler.GetItemProperty <bool?>(notification, 6);
                ewsCalendarItemType.IsRecurring   = new bool?(RowNotificationHandler.GetItemProperty <byte[]>(notification, 7) != null);
                if (RowNotificationHandler.IsPropertyDefined(notification, 8))
                {
                    ewsCalendarItemType.Organizer = RowNotificationHandler.CreateRecipientFromParticipant((Participant)notification.Row[8]);
                }
                ewsCalendarItemType.IsMeeting            = RowNotificationHandler.GetItemProperty <bool?>(notification, 9);
                ewsCalendarItemType.MyResponseTypeString = ResponseTypeConverter.ToString((ResponseType)RowNotificationHandler.GetItemProperty <int>(notification, 10));
                ewsCalendarItemType.SensitivityString    = SensitivityConverter.ToString(RowNotificationHandler.GetItemProperty <Sensitivity>(notification, 11));
                ewsCalendarItemType.HasAttachments       = RowNotificationHandler.GetItemProperty <bool?>(notification, 12);
                LocationSourceType itemProperty2 = (LocationSourceType)RowNotificationHandler.GetItemProperty <int>(notification, 26);
                ewsCalendarItemType.EnhancedLocation = ((itemProperty2 == LocationSourceType.None) ? new EnhancedLocationType
                {
                    DisplayName = RowNotificationHandler.GetItemProperty <string>(notification, 13),
                    PostalAddress = new Microsoft.Exchange.Services.Core.Types.PostalAddress()
                } : new EnhancedLocationType
                {
                    DisplayName = RowNotificationHandler.GetItemProperty <string>(notification, 24),
                    Annotation = RowNotificationHandler.GetItemProperty <string>(notification, 25),
                    PostalAddress = new Microsoft.Exchange.Services.Core.Types.PostalAddress
                    {
                        LocationSource = itemProperty2,
                        LocationUri = RowNotificationHandler.GetItemProperty <string>(notification, 27),
                        Latitude = this.GetLocationPropertyValue(notification, 28),
                        Longitude = this.GetLocationPropertyValue(notification, 29),
                        Accuracy = this.GetLocationPropertyValue(notification, 30),
                        Altitude = this.GetLocationPropertyValue(notification, 31),
                        AltitudeAccuracy = this.GetLocationPropertyValue(notification, 32),
                        Street = RowNotificationHandler.GetItemProperty <string>(notification, 33),
                        City = RowNotificationHandler.GetItemProperty <string>(notification, 34),
                        State = RowNotificationHandler.GetItemProperty <string>(notification, 35),
                        Country = RowNotificationHandler.GetItemProperty <string>(notification, 36),
                        PostalCode = RowNotificationHandler.GetItemProperty <string>(notification, 37)
                    }
                });
                StoreId itemProperty3 = RowNotificationHandler.GetItemProperty <StoreId>(notification, 14);
                ewsCalendarItemType.ParentFolderId = IdConverter.GetFolderIdFromStoreId(itemProperty3, new MailboxId(base.MailboxGuid));
                byte[] itemProperty4 = RowNotificationHandler.GetItemProperty <byte[]>(notification, 15);
                if (itemProperty4 != null)
                {
                    try
                    {
                        GlobalObjectId globalObjectId = new GlobalObjectId(itemProperty4);
                        ewsCalendarItemType.UID = globalObjectId.Uid;
                    }
                    catch (CorruptDataException ex)
                    {
                        ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)this.GetHashCode(), "Exception setting the UID in CalendarItemNotificationHandler:GetPayloadFromNotification. Exception: {1}", ex.Message);
                    }
                }
                ewsCalendarItemType.AppointmentState       = new int?(RowNotificationHandler.GetItemProperty <int>(notification, 16));
                ewsCalendarItemType.IsCancelled            = new bool?((ewsCalendarItemType.AppointmentState.Value & 4) == 4);
                ewsCalendarItemType.CalendarItemTypeString = CalendarItemTypeConverter.ToString(RowNotificationHandler.GetItemProperty <CalendarItemType>(notification, 17));
                ewsCalendarItemType.AppointmentReplyTime   = base.GetDateTimeProperty(notification, 18);
                if (RowNotificationHandler.IsPropertyDefined(notification, 19))
                {
                    ewsCalendarItemType.JoinOnlineMeetingUrl = RowNotificationHandler.GetItemProperty <string>(notification, 19);
                }
                ewsCalendarItemType.Categories  = RowNotificationHandler.GetItemProperty <string[]>(notification, 20);
                ewsCalendarItemType.IsOrganizer = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, 23));
                ConversationId itemProperty5 = RowNotificationHandler.GetItemProperty <ConversationId>(notification, 21);
                string         id            = IdConverter.ConversationIdToEwsId(base.MailboxGuid, itemProperty5);
                ewsCalendarItemType.ConversationId      = new ItemId(id, null);
                ewsCalendarItemType.IsResponseRequested = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, 22));
                try
                {
                    base.UserContext.LockAndReconnectMailboxSession(3000);
                    ewsCalendarItemType.EffectiveRights = EffectiveRightsProperty.GetFromEffectiveRights(EffectiveRights.Modify | EffectiveRights.Read | EffectiveRights.Delete, base.UserContext.MailboxSession);
                }
                finally
                {
                    if (base.UserContext.MailboxSessionLockedByCurrentThread())
                    {
                        base.UserContext.UnlockAndDisconnectMailboxSession();
                    }
                }
            }
            return(calendarItemNotificationPayload);
        }
Esempio n. 24
0
        private void UpdateSubscriptionCache(QueryNotification notification, TextWriter writer)
        {
            bool flag = null == this.userContext.SubscriptionCache;

            if (!RecipientCache.RunGetCacheOperationUnderExceptionHandler(delegate
            {
                SubscriptionCache.GetCache(this.userContext);
            }, new RecipientCache.ExceptionHandler(this.HandleSubscriptionLoadException), this.GetHashCode()))
            {
                return;
            }
            SubscriptionCache subscriptionCache = this.userContext.SubscriptionCache;

            if (flag)
            {
                SubscriptionNotificationHandler.RefreshClientCache(writer, subscriptionCache);
                return;
            }
            int num;

            if (QueryNotificationType.RowDeleted == notification.EventType)
            {
                num = subscriptionCache.Delete(notification.Index);
            }
            else
            {
                object obj = notification.Row[0];
                if (!(obj is Guid))
                {
                    return;
                }
                Guid   id   = (Guid)obj;
                string text = notification.Row[1] as string;
                if (text == null)
                {
                    return;
                }
                string text2 = notification.Row[2] as string;
                if (text2 == null)
                {
                    return;
                }
                obj = notification.Row[3];
                if (!(obj is int))
                {
                    return;
                }
                SendAsState sendAsState = (SendAsState)obj;
                obj = notification.Row[4];
                if (!(obj is int))
                {
                    return;
                }
                AggregationStatus      status  = (AggregationStatus)obj;
                string                 address = Utilities.DecodeIDNDomain(text);
                SubscriptionCacheEntry entry   = new SubscriptionCacheEntry(id, address, text2, notification.Index, this.mailboxSession.PreferedCulture);
                switch (notification.EventType)
                {
                case QueryNotificationType.RowAdded:
                    if (!SubscriptionManager.IsValidForSendAs(sendAsState, status))
                    {
                        return;
                    }
                    num = subscriptionCache.Add(entry);
                    goto IL_14B;

                case QueryNotificationType.RowModified:
                    num = subscriptionCache.Modify(entry, sendAsState, status);
                    goto IL_14B;
                }
                num = -1;
            }
IL_14B:
            if (-1 < num)
            {
                SubscriptionNotificationHandler.RefreshClientCache(writer, subscriptionCache);
            }
        }
Esempio n. 25
0
        internal void HandleReminderNotification(Notification notif)
        {
            QueryNotification queryNotification = notif as QueryNotification;
            StringBuilder     stringBuilder     = null;

            if (queryNotification == null || !this.FProcessEventType(queryNotification.EventType))
            {
                return;
            }
            bool flag = false;

            lock (this)
            {
                if (this.isDisposed || this.missedNotifications || this.needReinitSubscriptions)
                {
                    return;
                }
            }
            try
            {
                this.userContext.Lock();
                Culture.InternalSetAsyncThreadCulture(this.userContext.UserCulture, this.userContext);
                OwaMapiNotificationHandler.UpdateMailboxSessionBeforeAccessing(this.mailboxSession, this.userContext);
                lock (this)
                {
                    bool flag4 = (this.flags & ClientSubscriptionFlags.Reminders) == ClientSubscriptionFlags.Reminders;
                    if (flag4)
                    {
                        stringBuilder = new StringBuilder();
                        using (StringWriter stringWriter = new StringWriter(stringBuilder, CultureInfo.InvariantCulture))
                        {
                            OwaMapiNotificationHandler.ProcessReminders(this.userContext, stringWriter);
                            stringWriter.Write("setRmPllInt(" + 28800000L + "); ");
                        }
                    }
                }
                if (this.userContext.LockedByCurrentThread())
                {
                    Utilities.DisconnectStoreSession(this.mailboxSession);
                    this.userContext.Unlock();
                }
                if (stringBuilder != null)
                {
                    this.emailPayload.AddRemindersPayload(stringBuilder);
                }
                this.emailPayload.PickupData();
            }
            catch (OwaLockTimeoutException ex)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "User context lock timed out for notification thread. Exception: {0}", ex.Message);
                flag = true;
            }
            catch (Exception ex2)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in HandleHierarchyNotification on the notification thread. Exception: {0}", ex2.Message);
                flag = true;
            }
            finally
            {
                if (flag)
                {
                    lock (this)
                    {
                        this.missedNotifications = true;
                    }
                }
                if (this.userContext.LockedByCurrentThread())
                {
                    Utilities.DisconnectStoreSessionSafe(this.mailboxSession);
                    this.userContext.Unlock();
                }
            }
        }
Esempio n. 26
0
        // Token: 0x06000F00 RID: 3840 RVA: 0x0003A618 File Offset: 0x00038818
        protected override NotificationPayloadBase GetPayloadFromNotification(StoreObjectId folderId, QueryNotification notification)
        {
            ExTraceGlobals.PeopleIKnowNotificationsTracer.TraceDebug <string, QueryNotificationType>((long)this.GetHashCode(), "[PeopleIKnowRowNotificationHandler.GetPayloadFromNotification] SubscriptionId: {0}, NotificationEventType: {1}", base.SubscriptionId, notification.EventType);
            switch (notification.EventType)
            {
            case QueryNotificationType.RowAdded:
            case QueryNotificationType.RowModified:
                return(this.GetRowNotificationPayload(notification));

            case QueryNotificationType.RowDeleted:
                return(this.GetQueryResultChangedPayload(QueryNotificationType.QueryResultChanged));

            default:
                ExTraceGlobals.PeopleIKnowNotificationsTracer.TraceError <QueryNotificationType>((long)this.GetHashCode(), "[PeopleIKnowRowNotificationHandler.GetPayloadFromNotification] Unknown event type: {0}.", notification.EventType);
                return(this.GetEmptyPayload());
            }
        }
        protected override NotificationPayloadBase GetPayloadFromNotification(StoreObjectId folderId, QueryNotification notification)
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[MessageItemRowNotificationHandler.GetPayloadFromNotification] Start. SubscriptionId: {0}", base.SubscriptionId);
            RowNotificationPayload rowNotificationPayload = new RowNotificationPayload();

            rowNotificationPayload.Source = new MailboxLocation(base.MailboxGuid);
            base.GetPartialPayloadFromNotification(rowNotificationPayload, notification);
            rowNotificationPayload.Item = this.GetMessageItemFromNotification(notification);
            return(rowNotificationPayload);
        }
 // Token: 0x06001470 RID: 5232 RVA: 0x0007CD14 File Offset: 0x0007AF14
 private void CreateNotificationDataSource(QueryNotification notification)
 {
     this.listView.DataSource = new ListViewNotificationDataSource(this.userContext, this.dataFolderId.StoreObjectId, this.isConversationView, this.propertyMap, this.sortBy, notification);
     this.ItemList.DataSource = this.listView.DataSource;
 }
Esempio n. 29
0
        internal void HandleHierarchyNotification(Notification notif)
        {
            bool flag = false;

            try
            {
                if (Globals.ArePerfCountersEnabled)
                {
                    OwaSingleCounters.TotalMailboxNotifications.Increment();
                }
                QueryNotification queryNotification = notif as QueryNotification;
                if (queryNotification != null)
                {
                    if (queryNotification.Row.Length >= this.querySubscriptionProperties.Length)
                    {
                        VersionedId   versionedId   = queryNotification.Row[0] as VersionedId;
                        StoreObjectId storeObjectId = null;
                        if (versionedId != null)
                        {
                            storeObjectId = versionedId.ObjectId;
                        }
                        if (storeObjectId == null || queryNotification.Row[2] == null || queryNotification.Row[3] == null)
                        {
                            ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                        }
                        else
                        {
                            int              num      = (int)queryNotification.Row[2];
                            int              num2     = (int)queryNotification.Row[3];
                            bool             flag2    = false;
                            bool             flag3    = false;
                            OwaStoreObjectId folderId = null;
                            bool             flag4    = false;
                            lock (this)
                            {
                                if (this.isDisposed || this.missedNotifications || this.needReinitSubscriptions)
                                {
                                    return;
                                }
                                if (!this.HandleSearchNotification(storeObjectId, num, ref flag4, ref folderId))
                                {
                                    if (storeObjectId.Equals(this.userContext.RemindersSearchFolderId) || (this.searchFolderIdCurrent != null && storeObjectId.Equals(this.searchFolderIdCurrent.StoreObjectId)))
                                    {
                                        return;
                                    }
                                    if ((this.flags & ClientSubscriptionFlags.FolderCount) == ClientSubscriptionFlags.FolderCount && num != -1 && num2 != -1)
                                    {
                                        if (this.folderCountsList != null)
                                        {
                                            using (List <OwaStoreObjectId> .Enumerator enumerator = this.folderCountsList.GetEnumerator())
                                            {
                                                while (enumerator.MoveNext())
                                                {
                                                    OwaStoreObjectId owaStoreObjectId = enumerator.Current;
                                                    if (owaStoreObjectId.StoreObjectId != null && storeObjectId.Equals(owaStoreObjectId.StoreObjectId))
                                                    {
                                                        flag2 = true;
                                                        break;
                                                    }
                                                }
                                                goto IL_195;
                                            }
                                        }
                                        flag2 = true;
                                    }
IL_195:
                                    if ((this.flags & ClientSubscriptionFlags.FolderChange) == ClientSubscriptionFlags.FolderChange && this.folderChangeList != null)
                                    {
                                        foreach (OwaStoreObjectId owaStoreObjectId2 in this.folderChangeList)
                                        {
                                            if (owaStoreObjectId2.StoreObjectId != null && storeObjectId.Equals(owaStoreObjectId2.StoreObjectId))
                                            {
                                                flag3 = true;
                                                break;
                                            }
                                        }
                                    }
                                    folderId = OwaStoreObjectId.CreateFromSessionFolderId(this.owaStoreObjectIdType, this.mailboxOwnerLegacyDN, storeObjectId);
                                }
                            }
                            if (flag2)
                            {
                                this.emailPayload.AddFolderCountPayload(folderId, (long)num, (long)num2);
                            }
                            if (flag3)
                            {
                                this.emailPayload.AddFolderRefreshPayload(folderId, false);
                            }
                            if (flag4)
                            {
                                this.searchPayload.AddSearchFolderRefreshPayload(folderId, SearchNotificationType.FirstPage);
                                this.searchPayload.PickupData();
                            }
                            this.emailPayload.PickupData();
                        }
                    }
                }
            }
            catch (OwaLockTimeoutException ex)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "User context lock timed out for notification thread. Exception: {0}", ex.Message);
                flag = true;
            }
            catch (Exception ex2)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in HandleHierarchyNotification on the notification thread. Exception: {0}", ex2.Message);
                flag = true;
            }
            finally
            {
                if (flag)
                {
                    lock (this)
                    {
                        this.missedNotifications = true;
                    }
                }
            }
        }
        // Token: 0x06000D64 RID: 3428 RVA: 0x00032724 File Offset: 0x00030924
        private ConversationType GetConversationFromNotification(QueryNotification notification)
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[ConversationRowNotificationHandler.GetConversationFromNotification] Start. SubscriptionId: {0}", base.SubscriptionId);
            ConversationType conv = new ConversationType();

            conv.InstanceKey = notification.Index;
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                conv.ConversationId          = new ItemId(IdConverter.ConversationIdToEwsId(base.MailboxGuid, RowNotificationHandler.GetItemProperty <ConversationId>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationId))), null);
                conv.ConversationTopic       = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationTopic));
                conv.UniqueRecipients        = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMVTo));
                conv.UniqueSenders           = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMVFrom));
                conv.LastDeliveryTime        = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationLastDeliveryTime));
                conv.LastDeliveryOrRenewTime = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationLastDeliveryOrRenewTime));
                conv.Categories = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationCategories));
                FlagType flagType = new FlagType();
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationFlagStatus)))
                {
                    flagType.FlagStatus = (FlagStatus)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationFlagStatus), 0);
                }
                conv.FlagStatus         = flagType.FlagStatus;
                conv.HasAttachments     = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationHasAttach)));
                conv.HasIrm             = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationHasIrm)));
                conv.MessageCount       = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMessageCount)));
                conv.GlobalMessageCount = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalMessageCount)));
                conv.UnreadCount        = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationUnreadMessageCount)));
                conv.GlobalUnreadCount  = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalUnreadMessageCount)));
                conv.Size             = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMessageSize)));
                conv.ItemClasses      = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMessageClasses));
                conv.ImportanceString = ((ImportanceType)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationImportance), 1)).ToString();
                StoreId[] itemProperty = RowNotificationHandler.GetItemProperty <StoreId[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationItemIds), new StoreId[0]);
                conv.ItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty, (StoreId s) => new ItemId(base.GetEwsId(s), null));
                StoreId[] itemProperty2 = RowNotificationHandler.GetItemProperty <StoreId[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalItemIds), new StoreId[0]);
                conv.GlobalItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty2, (StoreId s) => new ItemId(base.GetEwsId(s), null));
                conv.DraftStoreIds = from storeId in itemProperty2
                                     where DraftItemIdsProperty.IsItemInDraftsFolder(storeId, this.draftFolderId)
                                     select StoreId.GetStoreObjectId(storeId);

                if (conv.DraftStoreIds.FirstOrDefault <StoreId>() != null)
                {
                    SimulatedWebRequestContext.Execute(base.UserContext, "ConversationNotificationDraftItemIds", delegate(MailboxSession mailboxSession, IRecipientSession adSession, RequestDetailsLogger logger)
                    {
                        NormalQueryView.PrepareDraftItemIds(mailboxSession, new ConversationType[]
                        {
                            conv
                        });
                    });
                }
                conv.LastModifiedTime   = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, StoreObjectSchema.LastModifiedTime));
                conv.Preview            = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationPreview));
                conv.MailboxScopeString = MailboxSearchLocation.PrimaryOnly.ToString();
                IconIndex itemProperty3 = (IconIndex)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationReplyForwardState));
                if (itemProperty3 > (IconIndex)0)
                {
                    conv.IconIndexString = itemProperty3.ToString();
                }
                itemProperty3 = (IconIndex)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalReplyForwardState));
                if (itemProperty3 > (IconIndex)0)
                {
                    conv.GlobalIconIndexString = itemProperty3.ToString();
                }
                this.LoadConversationFeedPropertiesIfRequested(notification, conv);
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[ConversationRowNotificationHandler.GetConversationFromNotification] End. SubscriptionId: {0}", base.SubscriptionId);
            }
            return(conv);
        }