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(); } } } }
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(); } } }
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(); } } }
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(); } } }