Example #1
0
 // Token: 0x0600079B RID: 1947 RVA: 0x00036360 File Offset: 0x00034560
 private void ProcessMeetingRequest(MailboxSession itemStore, MeetingRequest mtgMessage, ref CalendarItemBase originalCalItem, string internetMessageId, int defaultReminderInMinutes)
 {
     try
     {
         if (mtgMessage.TryUpdateCalendarItem(ref originalCalItem, false))
         {
             MeetingMessageType meetingRequestType = mtgMessage.MeetingRequestType;
             if (originalCalItem != null)
             {
                 if (originalCalItem.Id == null && MeetingMessageType.NewMeetingRequest == meetingRequestType)
                 {
                     int num = (int)Utils.SafeGetProperty(mtgMessage, ItemSchema.ReminderMinutesBeforeStart, defaultReminderInMinutes);
                     if (num == 1525252321)
                     {
                         num = defaultReminderInMinutes;
                         originalCalItem[ItemSchema.ReminderMinutesBeforeStart] = num;
                     }
                     if (num < 0 || num > 2629800)
                     {
                         originalCalItem[ItemSchema.ReminderMinutesBeforeStart] = defaultReminderInMinutes;
                     }
                     if (!originalCalItem.Reminder.IsSet)
                     {
                         originalCalItem.Reminder.MinutesBeforeStart = defaultReminderInMinutes;
                         originalCalItem.Reminder.IsSet = true;
                     }
                 }
                 originalCalItem.Validate();
                 ConflictResolutionResult conflictResolutionResult = originalCalItem.Save(SaveMode.ResolveConflicts);
                 originalCalItem.Load();
                 if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                 {
                     throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(originalCalItem.Id), conflictResolutionResult);
                 }
             }
         }
         CalendarAssistantPerformanceCounters.MeetingRequests.Increment();
         CalendarProcessing.TracerPfd.TracePfd <int, object, string>((long)mtgMessage.GetHashCode(), "PFD IWC {0} {1}:completed Processing Meeting Request for {2}", 24727, TraceContext.Get(), internetMessageId);
     }
     catch (ObjectNotFoundException innerException)
     {
         throw new TransientException(Strings.descTransientErrorInRequest, innerException);
     }
 }
        // Token: 0x060007B6 RID: 1974 RVA: 0x0003766C File Offset: 0x0003586C
        internal static void ApplyRollingHighlight(MeetingRequest meetingRequest, string internetMessageId, CalendarItemBase originalCalItem, OldMessageDeletion.LatestItemInfo latestInfo)
        {
            int            i = 3;
            MeetingRequest meetingRequest2 = meetingRequest;

            CalendarAssistant.TracerPfd.TracePfd <int, object, string>(0L, "PFD IWC {0} {1} Applying the rolling highlight to the item{2}", 18583, TraceContext.Get(), internetMessageId);
            if (meetingRequest2 != null)
            {
                int hashCode = meetingRequest.GetHashCode();
                PropertyDefinition changeHighlight = CalendarItemBaseSchema.ChangeHighlight;
                while (i > 0)
                {
                    try
                    {
                        if (meetingRequest2 == null)
                        {
                            meetingRequest2 = MeetingRequest.Bind(meetingRequest.Session, meetingRequest.Id);
                            meetingRequest2.OpenAsReadWrite();
                        }
                        if (latestInfo.RollingHighlight != 0)
                        {
                            int num = (int)Utils.SafeGetProperty(meetingRequest2, changeHighlight, 0);
                            if ((num & 8) == 0 && (latestInfo.RollingHighlight & 8) != 0)
                            {
                                if (!string.IsNullOrEmpty(latestInfo.LatestOldLocationStr))
                                {
                                    meetingRequest2[CalendarItemBaseSchema.OldLocation] = latestInfo.LatestOldLocationStr;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -9;
                                }
                            }
                            if ((num & 3) == 0 && (latestInfo.RollingHighlight & 3) != 0)
                            {
                                if (latestInfo.LatestOldStartTime != ExDateTime.MinValue && latestInfo.LatestOldEndTime != ExDateTime.MinValue)
                                {
                                    meetingRequest2[MeetingRequestSchema.OldStartWhole] = latestInfo.LatestOldStartTime;
                                    meetingRequest2[MeetingRequestSchema.OldEndWhole]   = latestInfo.LatestOldEndTime;
                                }
                                else
                                {
                                    latestInfo.RollingHighlight &= -4;
                                }
                            }
                            num |= latestInfo.RollingHighlight;
                            meetingRequest2[changeHighlight] = num;
                            if (meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                            {
                                ChangeHighlightHelper changeHighlightHelper = new ChangeHighlightHelper(num);
                                MeetingMessageType    suggestedMeetingType  = changeHighlightHelper.SuggestedMeetingType;
                                meetingRequest2.MeetingRequestType = suggestedMeetingType;
                            }
                        }
                        if (originalCalItem != null && meetingRequest2.MeetingRequestType != MeetingMessageType.NewMeetingRequest && meetingRequest2.MeetingRequestType != MeetingMessageType.PrincipalWantsCopy)
                        {
                            ResponseType responseType = originalCalItem.ResponseType;
                            if (responseType == ResponseType.NotResponded || responseType == ResponseType.None)
                            {
                                meetingRequest2.MeetingRequestType    = MeetingMessageType.FullUpdate;
                                meetingRequest2[ItemSchema.IconIndex] = CalendarItemBase.CalculateMeetingRequestIcon(meetingRequest2);
                            }
                        }
                        if (!meetingRequest2.IsDirty)
                        {
                            break;
                        }
                        ConflictResolutionResult saveResults = meetingRequest2.Save(SaveMode.ResolveConflicts);
                        meetingRequest2.Load();
                        if (CalendarProcessing.CheckSaveResults(meetingRequest2, saveResults, internetMessageId))
                        {
                            break;
                        }
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                        meetingRequest2 = null;
                    }
                    catch (ObjectExistedException ex)
                    {
                        MailboxSession session = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex
                        });
                        CalendarAssistantLog.LogEntry(session, ex, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (SaveConflictException ex2)
                    {
                        MailboxSession session2 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1}, attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex2
                        });
                        CalendarAssistantLog.LogEntry(session2, ex2, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        i--;
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                            meetingRequest2 = null;
                        }
                    }
                    catch (ObjectNotFoundException ex3)
                    {
                        MailboxSession session3 = meetingRequest.Session as MailboxSession;
                        OldMessageDeletion.Tracer.TraceError((long)hashCode, "{0}: Exception thrown when rolling forward the change highlight on item: {1},  attempt: {2}, exception = {3}", new object[]
                        {
                            TraceContext.Get(),
                            internetMessageId,
                            4 - i,
                            ex3
                        });
                        CalendarAssistantLog.LogEntry(session3, ex3, false, "Exception thrown when rolling forward the change highlight on item: {0}, attempt: {1}", new object[]
                        {
                            internetMessageId,
                            4 - i
                        });
                        break;
                    }
                    finally
                    {
                        if (meetingRequest2 != meetingRequest && meetingRequest2 != null)
                        {
                            meetingRequest2.Dispose();
                        }
                    }
                }
            }
        }