// Token: 0x0600091D RID: 2333 RVA: 0x0003D75C File Offset: 0x0003B95C private static CalendarNotificationType AnalyzeEvent(MapiEvent mapiEvent, StoreObjectId defaultCalFldrId, AppointmentStateFlags flags, ChangeHighlightProperties changeHilite, ResponseType responseType) { CalendarNotificationType result = CalendarNotificationType.Uninteresting; if ((AppointmentStateFlags.Cancelled & flags) != AppointmentStateFlags.None || (MapiEventTypeFlags.ObjectDeleted & mapiEvent.EventMask) != (MapiEventTypeFlags)0) { result = CalendarNotificationType.DeletedUpdate; } else if (((MapiEventTypeFlags.ObjectCreated | MapiEventTypeFlags.ObjectCopied) & mapiEvent.EventMask) != (MapiEventTypeFlags)0) { result = CalendarNotificationType.NewUpdate; } else if ((MapiEventTypeFlags.ObjectModified & mapiEvent.EventMask) != (MapiEventTypeFlags)0 && (CalendarChangeProcessor.InterestingFlagsExists(changeHilite, mapiEvent.ExtendedEventFlags) || ResponseType.Organizer == responseType)) { result = CalendarNotificationType.ChangedUpdate; } else if ((MapiEventTypeFlags.ObjectMoved & mapiEvent.EventMask) != (MapiEventTypeFlags)0) { if (object.Equals(defaultCalFldrId, StoreObjectId.FromProviderSpecificId(mapiEvent.ParentEntryId))) { result = CalendarNotificationType.NewUpdate; } else if (object.Equals(defaultCalFldrId, StoreObjectId.FromProviderSpecificId(mapiEvent.OldParentEntryId))) { result = CalendarNotificationType.DeletedUpdate; } } return(result); }
private string Write4_CalendarNotificationType(CalendarNotificationType v) { string result; switch (v) { case CalendarNotificationType.Uninteresting: result = "Uninteresting"; break; case CalendarNotificationType.Summary: result = "Summary"; break; case CalendarNotificationType.Reminder: result = "Reminder"; break; case CalendarNotificationType.NewUpdate: result = "NewUpdate"; break; case CalendarNotificationType.ChangedUpdate: result = "ChangedUpdate"; break; case CalendarNotificationType.DeletedUpdate: result = "DeletedUpdate"; break; default: throw base.CreateInvalidEnumValueException(((long)v).ToString(CultureInfo.InvariantCulture), "Microsoft.Exchange.Data.Storage.Management.CalendarNotificationType"); } return(result); }
public CalendarNotificationContentVersion1Point0(CalendarNotificationType type, string typeDesc, IEnumerable <CalendarEvent> events) { this.CalNotifType = type; this.CalNotifTypeDesc = typeDesc; if (events != null) { this.CalEvents = new List <CalendarEvent>(events); } }
// Token: 0x06000920 RID: 2336 RVA: 0x0003D85C File Offset: 0x0003BA5C private static CalendarNotificationType AnalyzeEvent(MapiEvent mapiEvent, MeetingMessage meeting) { CalendarNotificationType result = CalendarNotificationType.Uninteresting; if (meeting is MeetingRequest) { MeetingRequest meetingRequest = (MeetingRequest)meeting; MeetingMessageType meetingRequestType = meetingRequest.MeetingRequestType; if (meetingRequestType <= MeetingMessageType.FullUpdate) { if (meetingRequestType != MeetingMessageType.NewMeetingRequest) { if (meetingRequestType != MeetingMessageType.FullUpdate) { return(result); } goto IL_4A; } } else { if (meetingRequestType == MeetingMessageType.InformationalUpdate || meetingRequestType == MeetingMessageType.SilentUpdate) { goto IL_4A; } if (meetingRequestType != MeetingMessageType.PrincipalWantsCopy) { return(result); } } return(CalendarNotificationType.NewUpdate); IL_4A: if (CalendarChangeProcessor.InterestingFlagsExists(meetingRequest.ChangeHighlight, MapiExtendedEventFlags.NoReminderPropertyModified)) { result = CalendarNotificationType.ChangedUpdate; } } else if (meeting is MeetingCancellation) { result = CalendarNotificationType.DeletedUpdate; } return(result); }
// Token: 0x06000959 RID: 2393 RVA: 0x0003EC2C File Offset: 0x0003CE2C public bool IsInteresting(CalendarNotificationType type) { switch (type) { case CalendarNotificationType.Summary: case CalendarNotificationType.Reminder: return(ResponseType.Decline != this.ResponseType && AppointmentStateFlags.None == (AppointmentStateFlags.Cancelled & this.AppointmentState)); case CalendarNotificationType.NewUpdate: case CalendarNotificationType.ChangedUpdate: return(true); case CalendarNotificationType.DeletedUpdate: return(ResponseType.Decline != this.ResponseType); default: return(false); } }
// Token: 0x06000925 RID: 2341 RVA: 0x0003DD58 File Offset: 0x0003BF58 private static void UpdateReminder(CalendarNotificationType type, MailboxData mailboxData, StoreObjectId calItemId, IList <CalendarInfo> calEvents, IList <CalendarInfo> eventsToBeRemoved) { switch (type) { case CalendarNotificationType.NewUpdate: case CalendarNotificationType.ChangedUpdate: if (0 < calEvents.Count || 0 < eventsToBeRemoved.Count) { CalendarChangeProcessor.UpdateReminderAccordingToChangedUpdate(mailboxData, calEvents, eventsToBeRemoved); return; } CalendarChangeProcessor.UpdateReminderAccordingToDeletedUpdate(mailboxData, calItemId); return; case CalendarNotificationType.DeletedUpdate: CalendarChangeProcessor.UpdateReminderAccordingToDeletedUpdate(mailboxData, calItemId); return; default: throw new InvalidOperationException("unsupported CalendarNotificationType"); } }
// Token: 0x06000A82 RID: 2690 RVA: 0x00044F28 File Offset: 0x00043128 public void Emit(MailboxSession session, CalendarNotificationType type, IList <CalendarInfo> calendarInfos) { ADRecipient adrecipient = Utils.GetADRecipient(this.tenantGuid, this.ownerLegacyDN); if (!UMSubscriber.IsValidSubscriber(adrecipient)) { ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "UM is not enabled for user {0}", this.ownerLegacyDN); return; } using (UMSubscriber umsubscriber = new UMSubscriber(adrecipient)) { if (!umsubscriber.UMMailboxPolicy.AllowVoiceNotification || this.IsThisActionAllowed()) { ExTraceGlobals.AssistantTracer.TraceDebug <string, string, bool>((long)this.GetHashCode(), "Abort Voice Emitter, subject: {0}, user: {1}, UM Mailboxpolicy AllowVoiceNotification = {2}", calendarInfos[0].NormalizedSubject, this.ownerLegacyDN, umsubscriber.UMMailboxPolicy.AllowVoiceNotification); return; } ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Voice Emitter is emitting, subject: {0}, user: {1} ", calendarInfos[0].NormalizedSubject, this.ownerLegacyDN); UMServerManager.GetServerByDialplan((ADObjectId)umsubscriber.DialPlan.Identity); } string voiceReminderPhoneNumber = calendarInfos[0].VoiceReminderPhoneNumber; CalNotifsCounters.NumberOfVoiceRemindersSent.Increment(); ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Voice Emitter is emitted, subject: {0}, user: {1}", calendarInfos[0].NormalizedSubject, this.ownerLegacyDN); }
// Token: 0x0600090D RID: 2317 RVA: 0x0003D028 File Offset: 0x0003B228 public UpdateEmitting(MailboxData mailboxData, CalendarInfo calInfo, CalendarNotificationType type) : base(ExDateTime.Now, mailboxData, calInfo) { this.Type = type; }
// Token: 0x06000A2B RID: 2603 RVA: 0x00042F58 File Offset: 0x00041158 public void Emit(MailboxSession session, CalendarNotificationType type, IList <CalendarInfo> events) { ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Text Emitter is invoked, subject: {0} for user {1}", events[0].NormalizedSubject, this.MailboxData.Settings.LegacyDN); if (type == CalendarNotificationType.Uninteresting) { return; } Emitter emitter = null; foreach (Emitter emitter2 in this.MailboxData.Settings.Text.TextNotification.CalendarNotificationSettings.Emitters) { if (EmitterType.TextMessaging == emitter2.Type) { emitter = emitter2; break; } } if (emitter == null || emitter.PhoneNumbers.Count == 0) { return; } MailboxRegionalConfiguration regionalConfiguration = this.MailboxData.Settings.Text.RegionalConfiguration; CultureInfo cultureInfo = regionalConfiguration.Language ?? CultureInfo.InvariantCulture; string text = regionalConfiguration.TimeFormat; if (string.IsNullOrEmpty(text)) { text = cultureInfo.DateTimeFormat.ShortTimePattern; } string text2 = regionalConfiguration.DateFormat; if (string.IsNullOrEmpty(text2)) { text2 = cultureInfo.DateTimeFormat.ShortDatePattern; } bool flag = false; try { if (session == null) { ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLocalServerMailboxGuid(this.MailboxData.Settings.GetADSettings(), this.MailboxData.DatabaseGuid, this.MailboxData.MailboxGuid); session = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=Emit"); flag = true; } ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "Text Emitter is emitting for user {0}", this.MailboxData.Settings.LegacyDN); if (CalendarNotificationType.Summary == type) { CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point = new CalendarNotificationContentVersion1Point0(); calendarNotificationContentVersion1Point.CalNotifType = type; calendarNotificationContentVersion1Point.CalNotifTypeDesc = Strings.notifTypeSummary.ToString(cultureInfo); string agendaDateFormat = TextNotificationFactory.TextMessagingEmitter.GetAgendaDateFormat(text2); string timeOfStartTime = string.Empty; foreach (CalendarInfo calendarInfo in events) { timeOfStartTime = calendarInfo.StartTime.ToString("H:mm", cultureInfo); if (calendarInfo.EndTime.Subtract(calendarInfo.StartTime).Equals(TimeSpan.FromDays(1.0)) && calendarInfo.StartTime.Hour == 0 && calendarInfo.StartTime.Minute == 0) { timeOfStartTime = string.Empty; } calendarNotificationContentVersion1Point.CalEvents.Add(new CalendarEvent(cultureInfo.DateTimeFormat.GetDayName(calendarInfo.StartTime.DayOfWeek), calendarInfo.StartTime.ToString(agendaDateFormat, cultureInfo), timeOfStartTime, cultureInfo.DateTimeFormat.GetDayName(calendarInfo.EndTime.DayOfWeek), calendarInfo.EndTime.ToString(agendaDateFormat, cultureInfo), calendarInfo.EndTime.ToString("H:mm", cultureInfo), calendarInfo.NormalizedSubject ?? string.Empty, calendarInfo.Location ?? string.Empty)); } TextNotificationFactory.TextMessagingEmitter.SendTextMessage(session, emitter.PhoneNumbers, calendarNotificationContentVersion1Point.ToString(), CalNotifsCounters.NumberOfAgendasSent); } else { foreach (CalendarInfo calendarInfo2 in events) { CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point2 = new CalendarNotificationContentVersion1Point0(); calendarNotificationContentVersion1Point2.CalNotifType = type; bool flag2 = false; ExPerformanceCounter perfcounter; switch (type) { case CalendarNotificationType.Reminder: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeReminder.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfTextRemindersSent; break; case CalendarNotificationType.NewUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeNewUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; case CalendarNotificationType.ChangedUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeChangedUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; case CalendarNotificationType.DeletedUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeDeletedUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; default: throw new InvalidOperationException("unsupported CalendarNotificationType"); } if (flag2) { CalendarChangeProcessor.UpdateAverageProcessingLatency(calendarInfo2.CreationRequestTime); } calendarNotificationContentVersion1Point2.CalEvents.Add(new CalendarEvent(cultureInfo.DateTimeFormat.GetDayName(calendarInfo2.StartTime.DayOfWeek), calendarInfo2.StartTime.ToString(text2, cultureInfo), calendarInfo2.StartTime.ToString(text, cultureInfo), cultureInfo.DateTimeFormat.GetDayName(calendarInfo2.EndTime.DayOfWeek), calendarInfo2.EndTime.ToString(text2, cultureInfo), calendarInfo2.EndTime.ToString(text, cultureInfo), calendarInfo2.NormalizedSubject ?? string.Empty, calendarInfo2.Location ?? string.Empty)); TextNotificationFactory.TextMessagingEmitter.SendTextMessage(session, emitter.PhoneNumbers, calendarNotificationContentVersion1Point2.ToString(), perfcounter); } } ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Text Emitter is emitted, subject: {0}, user: {1}", events[0].NormalizedSubject, this.MailboxData.Settings.LegacyDN); } finally { if (flag) { session.Dispose(); session = null; } } }
// Token: 0x06000928 RID: 2344 RVA: 0x0003E288 File Offset: 0x0003C488 private static void HandleCalendarEvent(ExDateTime eventTime, MailboxData mailboxData, MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item) { CalendarChangeProcessor.< > c__DisplayClassc CS$ < > 8__locals1 = new CalendarChangeProcessor.< > c__DisplayClassc(); CS$ < > 8__locals1.mailboxData = mailboxData; CS$ < > 8__locals1.mapiEvent = mapiEvent; if (!NotificationFactories.Instance.IsReminderEnabled(CS$ < > 8__locals1.mailboxData.Settings)) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore cal event because reminder is disabled for user {0}, event: {1}", CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.mapiEvent); return; } CS$ < > 8__locals1.type = CalendarChangeProcessor.AnalyzeEvent(CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.mapiEvent, item); if (CS$ < > 8__locals1.type == CalendarNotificationType.Uninteresting) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore cal event due to uninteresting for user {0}, event: {1}", CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.mapiEvent); return; } CS$ < > 8__locals1.calItemId = ((item == null) ? StoreObjectId.FromProviderSpecificId(CS$ < > 8__locals1.mapiEvent.ItemEntryId) : item.Id.ObjectId); CalendarItem calendarItem = (CalendarItem)item; TimeSpan t = TimeSpan.FromDays(1.0); CS$ < > 8__locals1.calEvents = null; if (item != null) { TimeSpan t2 = TimeSpan.FromMinutes((double)calendarItem.Reminder.MinutesBeforeStart) + TimeSpan.FromTicks(1L); Interval <ExDateTime> interval = new Interval <ExDateTime>(eventTime, false, eventTime + t + t2, true); CS$ < > 8__locals1.calEvents = OccurrenceLoader.Load(eventTime, CS$ < > 8__locals1.mailboxData.Settings.TimeZone.ExTimeZone, itemStore, null, calendarItem, null, interval.Minimum, interval.Maximum); } else { CS$ < > 8__locals1.calEvents = new List <CalendarInfo>(); } CS$ < > 8__locals1.eventsToBeRemoved = new List <CalendarInfo>(); if (CalendarNotificationType.ChangedUpdate == CS$ < > 8__locals1.type) { CS$ < > 8__locals1.calEvents.RemoveAll(delegate(CalendarInfo calInfo) { CalendarNotificationType calendarNotificationType = CalendarChangeProcessor.AnalyzeEvent(CS$ < > 8__locals1.mapiEvent, CS$ < > 8__locals1.mailboxData.DefaultCalendarFolderId, calInfo.AppointmentState, calInfo.ChangeHighlight, calInfo.ResponseType); if (calendarNotificationType == CalendarNotificationType.Uninteresting) { return(true); } if (CalendarNotificationType.DeletedUpdate == calendarNotificationType) { CS$ < > 8__locals1.eventsToBeRemoved.Add(calInfo); return(true); } return(false); }); } using (ManualResetEvent customizedOperationFinished = new ManualResetEvent(false)) { CalendarNotificationInitiator.PerformCustomizedOperationOnActionsList(delegate { try { using (CS$ < > 8__locals1.mailboxData.CreateReadLock()) { CalendarChangeProcessor.UpdateReminder(CS$ < > 8__locals1.type, CS$ < > 8__locals1.mailboxData, CS$ < > 8__locals1.calItemId, CS$ < > 8__locals1.calEvents, CS$ < > 8__locals1.eventsToBeRemoved); } } finally { customizedOperationFinished.Set(); } }, "HandleCalendarEvent");
// Token: 0x06000927 RID: 2343 RVA: 0x0003DEC0 File Offset: 0x0003C0C0 private static void HandleMeetingEvent(ExDateTime eventTime, MailboxData mailboxData, MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item) { if (item == null || !NotificationFactories.Instance.IsInterestedInCalendarMeetingEvent(mailboxData.Settings)) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore event because update is disabled for user {0}, event: {1}", mailboxData, mapiEvent); return; } if (object.Equals(item.Id.ObjectId, mailboxData.DefaultDeletedItemsFolderId) || object.Equals(item.Id.ObjectId, mailboxData.DefaultJunkEmailFolderId)) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore event because item has been deleted for user {0}, event: {1}", mailboxData, mapiEvent); return; } MeetingMessage meetingMessage = item as MeetingMessage; if (meetingMessage == null) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Meeting event handler could do nothing because the item is not meeting message for user {0}, event: {1}", mailboxData, mapiEvent); return; } if (meetingMessage.IsDelegated() || meetingMessage.IsMailboxOwnerTheSender() || meetingMessage.IsOutOfDate()) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore event because mtg is delegated or out of data or is ornizer for user {0}, event: {1}", mailboxData, mapiEvent); return; } CalendarNotificationType calendarNotificationType = CalendarChangeProcessor.AnalyzeEvent(mapiEvent, meetingMessage); if (calendarNotificationType == CalendarNotificationType.Uninteresting) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore mtg event due to uninteresting for user {0}, event: {1}", mailboxData, mapiEvent); return; } List <CalendarInfo> list = null; Interval <ExDateTime> interval = new Interval <ExDateTime>(eventTime, false, eventTime + TimeSpan.FromDays((double)mailboxData.Settings.Text.TextNotification.NextDays), true); CalendarItemBase calendarItemBase = null; try { calendarItemBase = meetingMessage.GetCorrelatedItem(); if (!meetingMessage.TryUpdateCalendarItem(ref calendarItemBase, false)) { ExTraceGlobals.AssistantTracer.TraceDebug <MailboxData, MapiEvent>((long)typeof(CalendarChangeProcessor).GetHashCode(), "Ignore mtg event because TryUpdateCalendarItem failed for user {0}, event: {1}", mailboxData, mapiEvent); return; } list = OccurrenceLoader.Load(eventTime, mailboxData.Settings.TimeZone.ExTimeZone, itemStore, meetingMessage as MeetingRequest, calendarItemBase, mailboxData.Settings.Text.TextNotification.CalendarNotificationSettings.UpdateSettings.Duration.NonWorkHoursExcluded ? mailboxData.Settings.Text.WorkingHours : null, interval.Minimum, interval.Maximum); } finally { if (calendarItemBase != null) { calendarItemBase.Dispose(); calendarItemBase = null; } } int num = 0; foreach (CalendarInfo calendarInfo in list) { if (calendarInfo.IsInteresting(calendarNotificationType)) { CalendarNotificationInitiator.ScheduleAction(new UpdateEmitting(mailboxData, calendarInfo, calendarNotificationType), "HandleMeetingEvent"); num++; } } ExTraceGlobals.AssistantTracer.TraceDebug((long)typeof(CalendarChangeProcessor).GetHashCode(), "{0} updates has been sent according to mtg msg {1} for user {2}, type: {3}, event: {4}", new object[] { num, meetingMessage.Id.ObjectId, mailboxData, calendarNotificationType, mapiEvent }); }