public static CalendarItemBase TryGetCorrelatedItem(MeetingMessage meetingMessage) { CalendarItemBase result = null; try { ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Retreiving calendar item associated with meeting message. Value = '{0}'", (meetingMessage.Id != null) ? meetingMessage.Id.ObjectId.ToBase64String() : "null"); result = meetingMessage.GetCorrelatedItem(); } catch (CorrelationFailedException ex) { ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Can not retrieve calendar item associated with Meeting message. Exception: {0}", ex.Message); } catch (CorruptDataException ex2) { ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Can not retrieve calendar item associated with Meeting message. Exception: {0}", ex2.Message); } catch (ObjectDisposedException ex3) { ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Can not retrieve calendar item associated with Meeting message. Exception: {0}", ex3.Message); } catch (StorageTransientException ex4) { ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Can not retrieve calendar item associated with Meeting message. Exception: {0}", ex4.Message); } catch (InvalidOperationException ex5) { ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Can not retrieve calendar item associated with Meeting message. Exception: {0}", ex5.Message); } return(result); }
// Token: 0x06000781 RID: 1921 RVA: 0x00035210 File Offset: 0x00033410 internal static bool GetCalendarItem(MeetingMessage mtgMessage, Trace tracer, ref CalendarItemBase originalCalItem, bool shouldDetectDuplicateIds, out IEnumerable <VersionedId> detectedDuplicatesIds, out Exception exception) { MailboxSession session = mtgMessage.Session as MailboxSession; bool result = true; exception = null; originalCalItem = null; try { originalCalItem = mtgMessage.GetCorrelatedItem(shouldDetectDuplicateIds, out detectedDuplicatesIds); } catch (ObjectNotFoundException ex) { detectedDuplicatesIds = null; result = false; exception = ex; } catch (CorruptDataException ex2) { tracer.TraceError <object, VersionedId>(0L, "{0}: There was an error opening the original CalendarItem associated with this message {1}. This message will be skipped.", TraceContext.Get(), mtgMessage.Id); CalendarAssistantLog.LogEntry(session, ex2, false, "There was an error opening the original CalendarItem associated with this message {0}. This message will be skipped.", new object[] { mtgMessage.Id }); detectedDuplicatesIds = null; result = false; exception = ex2; } catch (CorrelationFailedException ex3) { tracer.TraceError <object, VersionedId>(0L, "{0}: The original CalendarItem associated with this message {1} is a master, but this message is a single occurrence. This message will be skipped.", TraceContext.Get(), mtgMessage.Id); CalendarAssistantLog.LogEntry(session, ex3, false, "The original CalendarItem associated with this message {0} is a master, but this message is a single occurrence. This message will be skipped.", new object[] { mtgMessage.Id }); detectedDuplicatesIds = null; result = false; exception = ex3; } catch (VirusDetectedException ex4) { tracer.TraceError <object, VersionedId>(0L, "{0}: A virus was detected in the CalendarItem associated with this message {1}. This message will be skipped.", TraceContext.Get(), mtgMessage.Id); CalendarAssistantLog.LogEntry(session, ex4, false, "A virus was detected in the CalendarItem associated with this message {0}. This message will be skipped.", new object[] { mtgMessage.Id }); detectedDuplicatesIds = null; result = false; exception = ex4; } catch (VirusMessageDeletedException ex5) { tracer.TraceError <object, VersionedId>(0L, "{0}: A virus was detected in the CalendarItem associated with this message and was deleted {1}. This message will be skipped.", TraceContext.Get(), mtgMessage.Id); CalendarAssistantLog.LogEntry(session, ex5, false, "A virus was detected in the CalendarItem associated with this message and was deleted {0}. This message will be skipped.", new object[] { mtgMessage.Id }); detectedDuplicatesIds = null; result = false; exception = ex5; } catch (RecurrenceException ex6) { tracer.TraceError <object, VersionedId, RecurrenceException>(0L, "{0}: There was a problem with the recurrence blob. Messageid={1}. This message will be skipped. Exception {2}", TraceContext.Get(), mtgMessage.Id, ex6); CalendarAssistantLog.LogEntry(session, ex6, false, "There was a problem with the recurrence blob. Messageid={0}. This message will be skipped", new object[] { mtgMessage.Id }); detectedDuplicatesIds = null; result = false; exception = ex6; } if (originalCalItem == null) { tracer.TraceDebug <object, VersionedId>(0L, "{0}: Original CalendarItem is null for message {1}.", TraceContext.Get(), mtgMessage.Id); } return(result); }
// Token: 0x06000CE9 RID: 3305 RVA: 0x000459B0 File Offset: 0x00043BB0 private bool Respond(StoreObjectId itemId, string requestId, MeetingResponseCommand.RequestNodeData response, bool usingLongId) { if (base.Version <= 141) { return(this.LegacyRespond(itemId, requestId, response.UserResponse, usingLongId)); } if (response.RespondToEventParameters == null) { throw new InvalidOperationException("Response.RespondToEventParameters must not be null at this point."); } StoreObjectId storeObjectId = null; string calendarId = null; if (this.CalendaringContainer == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Set default CalendaringContainer"); this.CalendaringContainer = new CalendaringContainer(base.MailboxSession, null); } if (this.MailboxGuid == Guid.Empty) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Set default MailboxGuid"); this.MailboxGuid = base.MailboxSession.MailboxGuid; } string key = EntitySyncItem.GetKey(this.MailboxGuid, itemId); IEvents events; if (itemId.ObjectType == StoreObjectType.CalendarItem || itemId.ObjectType == StoreObjectType.CalendarItemOccurrence || itemId.ObjectType == StoreObjectType.CalendarItemSeries) { storeObjectId = itemId; events = EntitySyncItem.GetEvents(this.CalendaringContainer, base.MailboxSession, itemId); } else { if (itemId.ObjectType != StoreObjectType.MeetingRequest) { this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, response.UserResponse, "The item is not meeting-request or calendar item.", usingLongId); base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "UnsupportedObjectType" + itemId.ObjectType); return(false); } using (MeetingMessage meetingMessage = MeetingMessage.Bind(base.MailboxSession, itemId)) { if (meetingMessage == null) { this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, response.UserResponse, "Cannot find the meeting-request as specified in the reqest.", usingLongId); base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemNotFound"); return(false); } using (CalendarItemBase correlatedItem = meetingMessage.GetCorrelatedItem()) { if (meetingMessage == null) { this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolVersionMismatch, response.UserResponse, "Cannot find the correlated meeitng item.", usingLongId); base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NullCalItemInMRCmd"); return(false); } storeObjectId = correlatedItem.Id.ObjectId; } } response.RespondToEventParameters.MeetingRequestIdToBeDeleted = key; key = EntitySyncItem.GetKey(this.MailboxGuid, storeObjectId); events = this.CalendaringContainer.Calendars.Default.Events; } try { events.Respond(key, response.RespondToEventParameters, null); } catch (LocalizedException ex) { this.AppendNonSuccessXmlNode(requestId, StatusCode.Sync_ProtocolError, response.UserResponse, ex.Message, usingLongId); base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "EntityRespondError"); return(false); } if (storeObjectId != null) { MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(storeObjectId); if (this.CalendarItemIdMapping.Contains(mailboxSyncItemId)) { calendarId = this.CalendarItemIdMapping[mailboxSyncItemId]; } else { calendarId = this.CalendarItemIdMapping.Add(mailboxSyncItemId); this.calendarSyncStateChangedFlag = true; } } this.AppendXmlNode(requestId, StatusCode.Success, calendarId, response.UserResponse, usingLongId); return(true); }
// 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 }); }