示例#1
0
 private void CleanupSubscriptions()
 {
     if (this.hierSub != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.hierSub);
     }
     this.hierSub = null;
     if (this.resultHierarchy != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.resultHierarchy);
     }
     this.resultHierarchy = null;
     if (this.newmailSub != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.newmailSub);
     }
     this.newmailSub = null;
     if (this.reminderSub != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.reminderSub);
         OwaMapiNotificationHandler.DisposeXSOObjects(this.queryResultReminder);
     }
     this.reminderSub         = null;
     this.queryResultReminder = null;
     this.ResetSearchFolderReferences(true);
 }
        // Token: 0x06000FAE RID: 4014 RVA: 0x00062084 File Offset: 0x00060284
        public void UnsubscribeFolderCounts(OwaStoreObjectId delegateFolderId, MailboxSession sessionIn)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            MailboxSession mailboxSession = this.userContext.MailboxSession;

            if (sessionIn == mailboxSession || Utilities.IsArchiveMailbox(sessionIn))
            {
                return;
            }
            if (this.omnhDelegates != null)
            {
                OwaMapiNotificationHandler owaMapiNotificationHandler = null;
                foreach (OwaMapiNotificationHandler owaMapiNotificationHandler2 in this.omnhDelegates)
                {
                    if (owaMapiNotificationHandler2.DelegateSessionHandle.Session == sessionIn)
                    {
                        owaMapiNotificationHandler = owaMapiNotificationHandler2;
                        break;
                    }
                }
                if (owaMapiNotificationHandler != null)
                {
                    owaMapiNotificationHandler.SubscribeForFolderCounts();
                    owaMapiNotificationHandler.DeleteFolderCountsNotification(delegateFolderId);
                }
            }
        }
 // Token: 0x06000FA1 RID: 4001 RVA: 0x00061AFC File Offset: 0x0005FCFC
 public void RenewDelegateHandler(MailboxSession session)
 {
     if (session == null)
     {
         throw new ArgumentNullException("session");
     }
     if (this.omnhDelegates != null)
     {
         int i = 0;
         while (i < this.omnhDelegates.Count)
         {
             OwaMapiNotificationHandler owaMapiNotificationHandler = this.omnhDelegates[i];
             if (owaMapiNotificationHandler.DelegateSessionHandle.Session == session)
             {
                 if (i < this.omnhDelegates.Count - 1)
                 {
                     this.omnhDelegates.Remove(owaMapiNotificationHandler);
                     this.omnhDelegates.Add(owaMapiNotificationHandler);
                     return;
                 }
                 break;
             }
             else
             {
                 i++;
             }
         }
     }
 }
        // Token: 0x06000FA0 RID: 4000 RVA: 0x000619BC File Offset: 0x0005FBBC
        public void UnsubscribeFolderChanges(OwaStoreObjectId folderId, MailboxSession sessionIn)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            MailboxSession mailboxSession = this.userContext.MailboxSession;

            if (sessionIn == null || sessionIn == mailboxSession)
            {
                if (this.omnhLoggedUser != null)
                {
                    this.omnhLoggedUser.SubscribeForFolderChanges();
                    this.omnhLoggedUser.DeleteFolderChangeNotification(folderId);
                    this.UnsubscribeFolderContentChanges(folderId);
                    return;
                }
            }
            else if (Utilities.IsArchiveMailbox(sessionIn))
            {
                if (this.omnhArchives != null)
                {
                    OwaMapiNotificationHandler owaMapiNotificationHandler = null;
                    foreach (OwaMapiNotificationHandler owaMapiNotificationHandler2 in this.omnhArchives)
                    {
                        if (owaMapiNotificationHandler2.ArchiveMailboxSession == sessionIn)
                        {
                            owaMapiNotificationHandler = owaMapiNotificationHandler2;
                            break;
                        }
                    }
                    if (owaMapiNotificationHandler != null)
                    {
                        owaMapiNotificationHandler.SubscribeForFolderChanges();
                        owaMapiNotificationHandler.DeleteFolderChangeNotification(folderId);
                        return;
                    }
                }
            }
            else if (this.omnhDelegates != null)
            {
                OwaMapiNotificationHandler owaMapiNotificationHandler3 = null;
                foreach (OwaMapiNotificationHandler owaMapiNotificationHandler4 in this.omnhDelegates)
                {
                    if (owaMapiNotificationHandler4.DelegateSessionHandle.Session == sessionIn)
                    {
                        owaMapiNotificationHandler3 = owaMapiNotificationHandler4;
                        break;
                    }
                }
                if (owaMapiNotificationHandler3 != null)
                {
                    owaMapiNotificationHandler3.SubscribeForFolderChanges();
                    owaMapiNotificationHandler3.DeleteFolderChangeNotification(folderId);
                }
            }
        }
示例#5
0
        protected override void InternalDispose(bool isDisposing)
        {
            bool flag = false;

            ExTraceGlobals.NotificationsCallTracer.TraceDebug <bool>((long)this.GetHashCode(), "OwaMapiNotificationHandler.Dispose. IsDisposing: {0}", isDisposing);
            lock (this)
            {
                if (this.isDisposed)
                {
                    return;
                }
                if (isDisposing)
                {
                    this.isDisposed = true;
                    flag            = true;
                }
            }
            if (flag)
            {
                try
                {
                    this.userContext.Lock();
                    OwaMapiNotificationHandler.UpdateMailboxSessionBeforeAccessing(this.mailboxSession, this.userContext);
                    lock (this)
                    {
                        this.flags = ClientSubscriptionFlags.None;
                        if (this.folderChangeList != null)
                        {
                            this.folderChangeList.Clear();
                        }
                        this.folderChangeList = null;
                        if (this.folderCountsList != null)
                        {
                            this.folderCountsList.Clear();
                        }
                        this.folderCountsList = null;
                        this.ClearSearchFolderDeleteList();
                        this.searchFolderDeleteList = null;
                        this.CleanupSubscriptions();
                        if (this.delegateSessionHandle != null)
                        {
                            OwaMapiNotificationHandler.DisposeXSOObjects(this.delegateSessionHandle);
                        }
                        this.delegateSessionHandle = null;
                    }
                }
                finally
                {
                    if (this.userContext.LockedByCurrentThread())
                    {
                        this.userContext.Unlock();
                    }
                }
            }
        }
        // Token: 0x06000FAD RID: 4013 RVA: 0x00062048 File Offset: 0x00060248
        private void ReleaseOldestSessionIfNecessary()
        {
            if (this.omnhDelegates.Count <= 5)
            {
                return;
            }
            OwaMapiNotificationHandler owaMapiNotificationHandler = this.omnhDelegates[0];

            this.omnhDelegates.Remove(owaMapiNotificationHandler);
            owaMapiNotificationHandler.Dispose();
        }
 // Token: 0x06000837 RID: 2103 RVA: 0x0003CFE0 File Offset: 0x0003B1E0
 private void DisposeInternal()
 {
     if (!this.userContext.LockedByCurrentThread())
     {
         throw new InvalidOperationException("User context needs to be locked while this operation is called");
     }
     if (this.mapiSubscription != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.mapiSubscription);
         this.mapiSubscription = null;
     }
 }
        // Token: 0x06000FB6 RID: 4022 RVA: 0x000623E0 File Offset: 0x000605E0
        public void AddSearchFolderDeleteList(MailboxSession sessionIn, StoreObjectId folderId)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            OwaMapiNotificationHandler owaMapiHandler = this.GetOwaMapiHandler(sessionIn);

            if (owaMapiHandler == null)
            {
                throw new OwaInvalidOperationException("Cannot find the mapi notification handler for this session");
            }
            owaMapiHandler.AddSearchFolderDeleteList(folderId);
        }
        // Token: 0x06000FB9 RID: 4025 RVA: 0x000624A8 File Offset: 0x000606A8
        public SearchPerformanceData GetSearchPerformanceData(MailboxSession sessionIn)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            OwaMapiNotificationHandler owaMapiHandler = this.GetOwaMapiHandler(sessionIn);

            if (owaMapiHandler != null)
            {
                return(owaMapiHandler.SearchPerformanceData);
            }
            return(null);
        }
示例#10
0
 private void ResetSearchFolderReferences(bool cleanupOldSubscription)
 {
     if (cleanupOldSubscription && this.searchSub != null)
     {
         if (!this.userContext.LockedByCurrentThread())
         {
             throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
         }
         OwaMapiNotificationHandler.DisposeXSOObjects(this.searchSub);
         this.searchSub = null;
     }
     this.searchFolderIdCurrent   = null;
     this.isTopPageSearchComplete = false;
 }
        // Token: 0x06000FB5 RID: 4021 RVA: 0x0006239C File Offset: 0x0006059C
        public void CancelSearchNotifications(MailboxSession sessionIn)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            OwaMapiNotificationHandler owaMapiHandler = this.GetOwaMapiHandler(sessionIn);

            if (owaMapiHandler == null)
            {
                throw new OwaInvalidOperationException("Cannot find the mapi notification handler for this session");
            }
            owaMapiHandler.CancelSearchPageNotify();
        }
        // Token: 0x06000FB4 RID: 4020 RVA: 0x00062350 File Offset: 0x00060550
        public void InitSearchNotifications(MailboxSession sessionIn, StoreObjectId searchFolderId, SearchFolder searchFolder, SearchFolderCriteria searchCriteria, string searchString)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            OwaMapiNotificationHandler owaMapiHandler = this.GetOwaMapiHandler(sessionIn);

            if (owaMapiHandler == null)
            {
                throw new OwaInvalidOperationException("Cannot find the mapi notification handler for this session");
            }
            owaMapiHandler.SubscribeForSearchPageNotify(searchFolderId, searchFolder, searchCriteria, searchString);
        }
示例#13
0
 public void UnsubscribeNewMail()
 {
     if (!this.userContext.LockedByCurrentThread())
     {
         throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
     }
     lock (this)
     {
         this.flags &= ~ClientSubscriptionFlags.NewMail;
         if (this.newmailSub != null)
         {
             OwaMapiNotificationHandler.DisposeXSOObjects(this.newmailSub);
         }
         this.newmailSub = null;
     }
 }
        // Token: 0x06000FB7 RID: 4023 RVA: 0x00062424 File Offset: 0x00060624
        public bool IsSearchInProgress(MailboxSession sessionIn, StoreObjectId folderId)
        {
            bool result = false;

            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            OwaMapiNotificationHandler owaMapiHandler = this.GetOwaMapiHandler(sessionIn);

            if (owaMapiHandler != null)
            {
                result = owaMapiHandler.IsSearchInProgress(folderId);
            }
            return(result);
        }
示例#15
0
 private void InitHierarchyTableSubscription()
 {
     if (this.hierSub == null)
     {
         if (this.resultHierarchy != null)
         {
             OwaMapiNotificationHandler.DisposeXSOObjects(this.resultHierarchy);
         }
         this.resultHierarchy = null;
         using (Folder folder = Folder.Bind(this.mailboxSession, DefaultFolderType.Configuration))
         {
             this.resultHierarchy = folder.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, this.querySubscriptionProperties);
             this.resultHierarchy.GetRows(this.resultHierarchy.EstimatedRowCount);
             this.hierSub = Subscription.Create(this.resultHierarchy, new NotificationHandler(this.HandleHierarchyNotification));
         }
     }
 }
 // Token: 0x06001444 RID: 5188 RVA: 0x0007BAF0 File Offset: 0x00079CF0
 internal virtual void DisposeInternal(bool doNotDisposeQueryResult)
 {
     if (!this.userContext.LockedByCurrentThread())
     {
         throw new InvalidOperationException("User context needs to be locked while this operation is called");
     }
     if (!doNotDisposeQueryResult && this.result != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.result);
         this.result = null;
     }
     if (this.mapiSubscription != null)
     {
         OwaMapiNotificationHandler.DisposeXSOObjects(this.mapiSubscription);
         this.mapiSubscription = null;
     }
 }
        // Token: 0x06000FB8 RID: 4024 RVA: 0x00062464 File Offset: 0x00060664
        public bool HasCurrentSearchCompleted(MailboxSession sessionIn, StoreObjectId folderId, out bool wasFailNonContentIndexedSearchFlagSet)
        {
            bool result = false;

            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            wasFailNonContentIndexedSearchFlagSet = false;
            OwaMapiNotificationHandler owaMapiHandler = this.GetOwaMapiHandler(sessionIn);

            if (owaMapiHandler != null)
            {
                result = owaMapiHandler.HasCurrentSearchCompleted(folderId, out wasFailNonContentIndexedSearchFlagSet);
            }
            return(result);
        }
        // Token: 0x0600145F RID: 5215 RVA: 0x0007C450 File Offset: 0x0007A650
        internal bool TrySubscribe(ConnectionDroppedNotificationHandler connectionDroppedNotificationHandler)
        {
            bool result;

            lock (this.syncRoot)
            {
                if (this.isDisposed)
                {
                    throw new InvalidOperationException("Cannot call Subscribe on a Disposed object");
                }
                if (!this.userContext.LockedByCurrentThread())
                {
                    throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
                }
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Subscribing for folder content change notifications for user {0}", this.MailboxSessionDisplayName);
                try
                {
                    this.InitSubscription();
                }
                catch (MapiExceptionObjectDisposed)
                {
                    OwaMapiNotificationHandler.DisposeXSOObjects(this.result);
                    return(false);
                }
                catch (ObjectDisposedException)
                {
                    return(false);
                }
                catch (StoragePermanentException)
                {
                    return(false);
                }
                catch (StorageTransientException)
                {
                    return(false);
                }
                this.payload.AttachFolderContentChangeNotificationHandler(this.contextFolderId, this);
                connectionDroppedNotificationHandler.OnConnectionDropped += this.HandleConnectionDroppedNotification;
                result = true;
            }
            return(result);
        }
        // Token: 0x06000FC1 RID: 4033 RVA: 0x000626D4 File Offset: 0x000608D4
        private OwaMapiNotificationHandler GetOwaMapiHandler(MailboxSession sessionIn)
        {
            OwaMapiNotificationHandler result         = null;
            MailboxSession             mailboxSession = this.userContext.MailboxSession;

            if (sessionIn == mailboxSession)
            {
                if (this.omnhLoggedUser == null)
                {
                    this.omnhLoggedUser = new OwaMapiNotificationHandler(this.userContext, sessionIn, null);
                    this.WireConnectionDroppedHandler(this.omnhLoggedUser);
                }
                result = this.omnhLoggedUser;
            }
            else if (Utilities.IsArchiveMailbox(sessionIn))
            {
                if (this.omnhArchives == null)
                {
                    this.omnhArchives = new List <OwaMapiNotificationHandler>();
                }
                OwaMapiNotificationHandler owaMapiNotificationHandler = null;
                foreach (OwaMapiNotificationHandler owaMapiNotificationHandler2 in this.omnhArchives)
                {
                    if (owaMapiNotificationHandler2.ArchiveMailboxSession == sessionIn)
                    {
                        owaMapiNotificationHandler = owaMapiNotificationHandler2;
                        break;
                    }
                }
                if (owaMapiNotificationHandler == null)
                {
                    owaMapiNotificationHandler = new OwaMapiNotificationHandler(this.userContext, sessionIn, null);
                    this.WireConnectionDroppedHandler(owaMapiNotificationHandler);
                    this.omnhArchives.Add(owaMapiNotificationHandler);
                }
                result = owaMapiNotificationHandler;
            }
            return(result);
        }
示例#20
0
 internal EmailPayload(UserContext userContext, MailboxSession mailboxSession, OwaMapiNotificationHandler omnhParent)
 {
     this.folderCountTable                 = new Dictionary <OwaStoreObjectId, ItemCountPair>();
     this.folderRefreshList                = new List <OwaStoreObjectId>();
     this.payloadStringReminderChanges     = new StringBuilder(256);
     this.payloadStringNewMail             = new StringBuilder(256);
     this.payloadStringRefreshAll          = new StringBuilder(256);
     this.payloadStringQuota               = new StringBuilder(256);
     this.payloadStringReminderNotify      = new StringBuilder(256);
     this.folderContentChangeNotifications = new Dictionary <OwaStoreObjectId, EmailPayload.FCNHState>();
     this.userContext = userContext;
     this.mailboxSessionDisplayName = string.Copy(mailboxSession.DisplayName);
     this.omnhParent = omnhParent;
     this.connectionAliveTimerCount = 1;
 }
示例#21
0
        internal void HandleNewMailNotification(Notification notif)
        {
            if (Globals.ArePerfCountersEnabled)
            {
                OwaSingleCounters.TotalMailboxNotifications.Increment();
            }
            NewMailNotification newMailNotification = notif as NewMailNotification;

            if (newMailNotification == null)
            {
                return;
            }
            bool          flag          = false;
            StringBuilder stringBuilder = null;
            bool          flag2         = false;
            bool          flag3         = false;
            bool          flag4         = false;

            if (newMailNotification.NewMailItemId == null || newMailNotification.ParentFolderId == null)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "notification has a null notifying item id");
                return;
            }
            lock (this)
            {
                if (this.isDisposed || this.missedNotifications || this.needReinitSubscriptions)
                {
                    return;
                }
            }
            try
            {
                this.userContext.Lock();
                OwaMapiNotificationHandler.UpdateMailboxSessionBeforeAccessing(this.mailboxSession, this.userContext);
                lock (this)
                {
                    if ((this.flags & ClientSubscriptionFlags.NewMail) != ClientSubscriptionFlags.NewMail)
                    {
                        return;
                    }
                    if (newMailNotification.ParentFolderId == null || !newMailNotification.ParentFolderId.Equals(this.userContext.InboxFolderId))
                    {
                        return;
                    }
                    stringBuilder = new StringBuilder();
                    using (StringWriter stringWriter = new StringWriter(stringBuilder, CultureInfo.InvariantCulture))
                    {
                        bool flag7 = false;
                        if (ObjectClass.IsVoiceMessage(newMailNotification.MessageClass))
                        {
                            flag3 = true;
                        }
                        else if (ObjectClass.IsOfClass(newMailNotification.MessageClass, "IPM.Note.Microsoft.Fax.CA"))
                        {
                            flag4 = true;
                        }
                        else
                        {
                            flag2 = true;
                        }
                        if (flag4)
                        {
                            flag7 = true;
                            if ((this.userContext.UserOptions.NewItemNotify & NewNotification.FaxToast) == NewNotification.FaxToast)
                            {
                                stringWriter.Write("shwNF(1);");
                                stringWriter.Write("g_sFId=\"");
                                Utilities.JavascriptEncode(newMailNotification.NewMailItemId.ToBase64String(), stringWriter);
                                stringWriter.Write("\";");
                                flag7 = this.BindItemAndShowDialog(newMailNotification.NewMailItemId, "lnkNwFx", stringWriter);
                            }
                            else
                            {
                                flag4 = false;
                            }
                        }
                        if (flag3)
                        {
                            flag7 = true;
                            if ((this.userContext.UserOptions.NewItemNotify & NewNotification.VoiceMailToast) == NewNotification.VoiceMailToast)
                            {
                                stringWriter.Write("shwNVM(1);");
                                stringWriter.Write("g_sVMId=\"");
                                Utilities.JavascriptEncode(newMailNotification.NewMailItemId.ToBase64String(), stringWriter);
                                stringWriter.Write("\";");
                                flag7 = this.BindItemAndShowDialog(newMailNotification.NewMailItemId, "lnkNwVMl", stringWriter);
                            }
                            else
                            {
                                flag3 = false;
                            }
                        }
                        if (flag2)
                        {
                            flag7 = true;
                            if ((this.userContext.UserOptions.NewItemNotify & NewNotification.EMailToast) == NewNotification.EMailToast)
                            {
                                stringWriter.Write("shwNM(1);");
                                stringWriter.Write("g_sMId=\"");
                                Utilities.JavascriptEncode(newMailNotification.NewMailItemId.ToBase64String(), stringWriter);
                                stringWriter.Write("\";");
                                flag7 = this.BindItemAndShowDialog(newMailNotification.NewMailItemId, "lnkNwMl", stringWriter);
                            }
                            else
                            {
                                flag2 = false;
                            }
                        }
                        if ((this.userContext.UserOptions.NewItemNotify & NewNotification.Sound) == NewNotification.Sound && flag7)
                        {
                            stringWriter.Write("plySnd();");
                        }
                    }
                }
                if (this.userContext.LockedByCurrentThread())
                {
                    Utilities.DisconnectStoreSession(this.mailboxSession);
                    this.userContext.Unlock();
                }
                if (flag4 || flag3 || flag2)
                {
                    this.emailPayload.AddNewMailPayload(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 HandleNewMailNotification 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();
                }
            }
        }
示例#22
0
        internal void HandlePendingGetTimerCallback(bool clearSearchFolderDeleteList)
        {
            string mailboxQuotaHtml = null;
            bool   flag             = false;
            bool   flag2            = false;
            bool   flag3            = false;

            try
            {
                this.userContext.Lock();
                OwaMapiNotificationHandler.UpdateMailboxSessionBeforeAccessing(this.mailboxSession, this.userContext);
                lock (this)
                {
                    if (this.isDisposed)
                    {
                        return;
                    }
                    flag3 = this.InitSubscriptions(ClientSubscriptionFlags.None);
                    if (this.missedNotifications)
                    {
                        flag3 = true;
                    }
                    if (clearSearchFolderDeleteList)
                    {
                        this.ClearSearchFolderDeleteList();
                    }
                    if (this.searchFolderIdCurrent == null)
                    {
                        this.ResetSearchFolderReferences(true);
                    }
                    this.missedNotifications = false;
                }
                long num = Globals.ApplicationTime - this.userContext.LastQuotaUpdateTime;
                if ((this.userContext.IsQuotaAboveWarning && num >= 900000L) || num >= 1800000L)
                {
                    using (StringWriter stringWriter = new StringWriter())
                    {
                        RenderingUtilities.RenderMailboxQuota(stringWriter, this.userContext);
                        mailboxQuotaHtml = stringWriter.ToString();
                    }
                    flag = true;
                }
                int num2 = (int)DateTimeUtilities.GetLocalTime(this.userContext).Bias.TotalMinutes;
                if (num2 != this.userContext.RemindersTimeZoneOffset)
                {
                    this.userContext.RemindersTimeZoneOffset = num2;
                    flag2 = true;
                }
                if (this.userContext.LockedByCurrentThread())
                {
                    Utilities.DisconnectStoreSession(this.mailboxSession);
                    this.userContext.Unlock();
                }
                if (flag3)
                {
                    this.emailPayload.AddRefreshPayload();
                }
                else
                {
                    if (flag)
                    {
                        this.emailPayload.AddQuotaPayload(mailboxQuotaHtml);
                    }
                    if (flag2)
                    {
                        this.emailPayload.AddReminderNotifyPayload(num2);
                    }
                }
                this.emailPayload.PickupData();
            }
            catch (OwaLockTimeoutException ex)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "User context lock timed out in the pending GET timer callback. Exception: {0}", ex.Message);
            }
            catch (Exception ex2)
            {
                ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in pending GET timer callback thread. Exception: {0}", ex2.Message);
            }
            finally
            {
                if (this.userContext.LockedByCurrentThread())
                {
                    Utilities.DisconnectStoreSessionSafe(this.mailboxSession);
                    this.userContext.Unlock();
                }
            }
        }
 // Token: 0x06000FBD RID: 4029 RVA: 0x0006264C File Offset: 0x0006084C
 private void WireConnectionDroppedHandler(OwaMapiNotificationHandler mapiNotificationHandler)
 {
     this.InitializeConnectionDroppedHandler();
     this.connectionDroppedNotificationHandler.OnConnectionDropped += mapiNotificationHandler.HandleConnectionDroppedNotification;
 }
示例#24
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();
                }
            }
        }
 // Token: 0x060008B4 RID: 2228 RVA: 0x0004024A File Offset: 0x0003E44A
 internal SearchPayload(UserContext userContext, MailboxSession mailboxSession, OwaMapiNotificationHandler omnhParent)
 {
     this.searchFolderRefreshList   = new List <OwaStoreObjectId>();
     this.userContext               = userContext;
     this.mailboxSessionDisplayName = string.Copy(mailboxSession.DisplayName);
     this.omnhParent = omnhParent;
 }
        // Token: 0x06000FAC RID: 4012 RVA: 0x00061E9C File Offset: 0x0006009C
        public void SubscribeForFolderCounts(OwaStoreObjectId delegateFolderId, MailboxSession sessionIn)
        {
            if (!this.userContext.LockedByCurrentThread())
            {
                throw new InvalidOperationException("UserContext lock should be acquired before calling this method");
            }
            MailboxSession mailboxSession = this.userContext.MailboxSession;

            if (sessionIn == mailboxSession)
            {
                if (this.omnhLoggedUser == null)
                {
                    this.omnhLoggedUser = new OwaMapiNotificationHandler(this.userContext, mailboxSession, null);
                    this.WireConnectionDroppedHandler(this.omnhLoggedUser);
                }
                this.omnhLoggedUser.SubscribeForFolderCounts();
                return;
            }
            if (Utilities.IsArchiveMailbox(sessionIn))
            {
                if (this.omnhArchives == null)
                {
                    this.omnhArchives = new List <OwaMapiNotificationHandler>();
                }
                OwaMapiNotificationHandler owaMapiNotificationHandler = null;
                foreach (OwaMapiNotificationHandler owaMapiNotificationHandler2 in this.omnhArchives)
                {
                    if (owaMapiNotificationHandler2.ArchiveMailboxSession == sessionIn)
                    {
                        owaMapiNotificationHandler = owaMapiNotificationHandler2;
                        break;
                    }
                }
                if (owaMapiNotificationHandler == null)
                {
                    owaMapiNotificationHandler = new OwaMapiNotificationHandler(this.userContext, sessionIn, null);
                    this.WireConnectionDroppedHandler(owaMapiNotificationHandler);
                    this.omnhArchives.Add(owaMapiNotificationHandler);
                }
                owaMapiNotificationHandler.SubscribeForFolderCounts();
                return;
            }
            if (this.omnhDelegates == null)
            {
                this.omnhDelegates = new List <OwaMapiNotificationHandler>();
            }
            OwaMapiNotificationHandler owaMapiNotificationHandler3 = null;

            foreach (OwaMapiNotificationHandler owaMapiNotificationHandler4 in this.omnhDelegates)
            {
                if (owaMapiNotificationHandler4.DelegateSessionHandle.Session == sessionIn)
                {
                    owaMapiNotificationHandler3 = owaMapiNotificationHandler4;
                    break;
                }
            }
            if (owaMapiNotificationHandler3 == null)
            {
                OwaStoreObjectIdSessionHandle delegateSessionHandle = new OwaStoreObjectIdSessionHandle(delegateFolderId, this.userContext);
                owaMapiNotificationHandler3 = new OwaMapiNotificationHandler(this.userContext, sessionIn, delegateSessionHandle);
                this.WireConnectionDroppedHandler(owaMapiNotificationHandler3);
                this.omnhDelegates.Add(owaMapiNotificationHandler3);
                this.ReleaseOldestSessionIfNecessary();
            }
            owaMapiNotificationHandler3.SubscribeForFolderCounts();
            owaMapiNotificationHandler3.AddFolderCountsNotification(delegateFolderId);
        }