// Token: 0x060007BE RID: 1982 RVA: 0x00038224 File Offset: 0x00036424
 private static void MarkMeetingMessageAsOld(MeetingMessage meetingMessage, Trace tracer)
 {
     meetingMessage.MarkAsOutOfDate();
     meetingMessage.IsRead = true;
     try
     {
         int num = 3;
         ConflictResolutionResult saveResults;
         do
         {
             saveResults = meetingMessage.Save(SaveMode.ResolveConflicts);
             meetingMessage.Load();
             num--;
         }while (num > 0 && !CalendarProcessing.CheckSaveResults(meetingMessage, saveResults, meetingMessage.InternetMessageId));
     }
     catch (ObjectNotFoundException arg)
     {
         tracer.TraceWarning <object, ObjectNotFoundException>(0L, "{0}: RUMOldMessageDeletion: Tried to mark a meeting message as Outdated, which does not exist anymore. Exception: {1}", TraceContext.Get(), arg);
     }
 }
示例#2
0
        // Token: 0x06000790 RID: 1936 RVA: 0x00035684 File Offset: 0x00033884
        public void ProcessMeetingMessage(MailboxSession itemStore, MeetingMessage mtgMessage, ref CalendarItemBase originalCalItem, CalendarConfiguration mailboxConfig, IEnumerable <VersionedId> duplicates, bool performOmd, bool honorExternalMeetingMessageProcessingConfig)
        {
            bool isProcessed = mtgMessage.IsProcessed;
            bool flag        = this.PreProcessMessage(itemStore, mtgMessage, isProcessed, mtgMessage.CalendarProcessed);
            bool flag2       = false;

            if (!flag)
            {
                flag2 = CalendarProcessing.IsAutoAcceptanceProcessingRequired(itemStore, mtgMessage, originalCalItem);
            }
            if (flag || flag2)
            {
                int num = mailboxConfig.DefaultReminderTime;
                if (num < 0 || num > 2629800)
                {
                    num = CalendarProcessing.DefaultReminderMinutesBeforeStart;
                }
                int num2 = 3;
                int i    = num2;
                if (this.honorProcessingConfiguration && originalCalItem == null && !mailboxConfig.AddNewRequestsTentatively && !mtgMessage.IsRepairUpdateMessage)
                {
                    CalendarProcessing.ProcessingTracer.TraceDebug((long)mtgMessage.GetHashCode(), "{0}: Skipping processing because user settings for adding new items is false.", new object[]
                    {
                        TraceContext.Get()
                    });
                    return;
                }
                if (honorExternalMeetingMessageProcessingConfig && mtgMessage.SkipMessage(mailboxConfig.ProcessExternalMeetingMessages, originalCalItem))
                {
                    CalendarProcessing.ProcessingTracer.TraceDebug <object, bool>((long)mtgMessage.GetHashCode(), "{0}: Skipping processing because user settings for processing external items is false. IsRepairUpdateMessage: {1}", TraceContext.Get(), mtgMessage.IsRepairUpdateMessage);
                    return;
                }
                while (i > 0)
                {
                    try
                    {
                        if (flag)
                        {
                            if (!this.DoProcessingLogic(itemStore, mtgMessage, ref originalCalItem, num, ref i))
                            {
                                this.TraceDebugAndPfd(mtgMessage.GetHashCode(), string.Format("{0}: completedProcessing = {1}", TraceContext.Get(), false));
                                continue;
                            }
                            flag = false;
                            this.TraceDebugAndPfd(mtgMessage.GetHashCode(), string.Format("{0}: completedProcessing = {1}", TraceContext.Get(), true));
                            flag2 = CalendarProcessing.IsAutoAcceptanceProcessingRequired(itemStore, mtgMessage, originalCalItem);
                        }
                        if (flag2)
                        {
                            CalendarProcessing.AutoAcceptEvents(itemStore, originalCalItem);
                            flag2 = false;
                        }
                        if (!flag && !flag2)
                        {
                            break;
                        }
                    }
                    catch (ObjectExistedException exception)
                    {
                        this.TraceAndLogException(exception, itemStore, mtgMessage, i);
                        i--;
                    }
                    catch (SaveConflictException ex)
                    {
                        this.TraceAndLogException(ex, itemStore, mtgMessage, i);
                        i--;
                        if (originalCalItem != null)
                        {
                            originalCalItem.Dispose();
                            originalCalItem = null;
                        }
                        if (!CalendarAssistant.GetCalendarItem(mtgMessage, CalendarProcessing.UnexpectedPathTracer, ref originalCalItem, duplicates != null, out duplicates))
                        {
                            throw new SkipException(Strings.descSkipExceptionFailedToLoadCalItem, ex);
                        }
                        if (originalCalItem != null)
                        {
                            originalCalItem.OpenAsReadWrite();
                        }
                    }
                    catch (QuotaExceededException exception2)
                    {
                        this.TraceAndLogException(exception2, itemStore, mtgMessage, i);
                        i = -1;
                    }
                    catch (ObjectNotFoundException ex2)
                    {
                        this.TraceAndLogException(ex2, itemStore, mtgMessage, i);
                        throw new SkipException(ex2);
                    }
                    catch (VirusDetectedException exception3)
                    {
                        this.TraceAndLogException(exception3, itemStore, mtgMessage, i);
                        i = -1;
                    }
                    catch (VirusMessageDeletedException exception4)
                    {
                        this.TraceAndLogException(exception4, itemStore, mtgMessage, i);
                        i = -1;
                    }
                    catch (DataValidationException ex3)
                    {
                        this.TraceAndLogException(ex3, itemStore, mtgMessage, i);
                        throw new SkipException(ex3);
                    }
                    catch (RecurrenceException ex4)
                    {
                        this.TraceAndLogException(ex4, itemStore, mtgMessage, i);
                        throw new SkipException(ex4);
                    }
                }
                if (flag && i == 0)
                {
                    string internetMessageId = mtgMessage.InternetMessageId;
                    CalendarProcessing.ProcessingTracer.TraceDebug <object, string>((long)mtgMessage.GetHashCode(), "{0}: Attempting a third time to process message, but without the catch blocks: {1}", TraceContext.Get(), internetMessageId);
                    this.DoProcessingLogic(itemStore, mtgMessage, ref originalCalItem, num, ref i);
                }
            }
            if (ObjectClass.IsMeetingCancellationSeries(mtgMessage.ClassName) || ObjectClass.IsMeetingRequestSeries(mtgMessage.ClassName))
            {
                this.TryUnparkInstanceMessages(itemStore, mtgMessage.GetValueOrDefault <string>(MeetingMessageSchema.SeriesId), mtgMessage.GetValueOrDefault <int>(MeetingMessageSchema.SeriesSequenceNumber));
            }
            if (performOmd)
            {
                this.OldMessageDeletion.PerformCleanUp(itemStore, mtgMessage, mailboxConfig, originalCalItem, duplicates);
            }
        }
示例#3
0
        // Token: 0x06000795 RID: 1941 RVA: 0x00035CE8 File Offset: 0x00033EE8
        private bool DoProcessingLogic(MailboxSession itemStore, MeetingMessage mtgMessage, ref CalendarItemBase originalCalItem, int defaultReminderInMinutes, ref int retries)
        {
            string internetMessageId = mtgMessage.InternetMessageId;
            bool   isProcessed       = mtgMessage.IsProcessed;

            CalendarProcessing.ProcessingRequestTracer.TraceDebug((long)mtgMessage.GetHashCode(), "{0}: About to call OrganizerOrDelegateCheck", new object[]
            {
                TraceContext.Get()
            });
            bool flag;

            if (!CalendarProcessing.OrganizerOrDelegateCheck(mtgMessage, originalCalItem, out flag))
            {
                CalendarProcessing.ProcessingRequestTracer.TraceDebug((long)mtgMessage.GetHashCode(), "{0}: Not Organizer or delegate", new object[]
                {
                    TraceContext.Get()
                });
                if (mtgMessage is MeetingRequest)
                {
                    CalendarProcessing.ProcessingRequestTracer.TraceDebug <object, string>((long)mtgMessage.GetHashCode(), "{0}: Processing MeetingRequest: {1}", TraceContext.Get(), internetMessageId);
                    this.ProcessMeetingRequest(itemStore, (MeetingRequest)mtgMessage, ref originalCalItem, internetMessageId, defaultReminderInMinutes);
                    int num = (int)Utils.SafeGetProperty(mtgMessage, CalendarItemBaseSchema.AppointmentSequenceNumber, -1);
                    if (isProcessed && num == 0)
                    {
                        ((MeetingRequest)mtgMessage).MeetingRequestType = MeetingMessageType.NewMeetingRequest;
                    }
                }
                else if (mtgMessage is MeetingResponse)
                {
                    CalendarProcessing.ProcessingResponseTracer.TraceDebug <object, string>((long)mtgMessage.GetHashCode(), "{0}: Processing MeetingResponse: {1}", TraceContext.Get(), internetMessageId);
                    this.ProcessMeetingResponse(itemStore, (MeetingResponse)mtgMessage, ref originalCalItem, internetMessageId);
                }
                else if (mtgMessage is MeetingCancellation)
                {
                    CalendarProcessing.ProcessingCancellationTracer.TraceDebug <object, string>((long)mtgMessage.GetHashCode(), "{0}: Processing MeetingCancellation: {1}", TraceContext.Get(), internetMessageId);
                    this.ProcessMeetingCancellation(itemStore, (MeetingCancellation)mtgMessage, ref originalCalItem, internetMessageId);
                }
                else if (mtgMessage is MeetingForwardNotification)
                {
                    CalendarProcessing.ProcessingMeetingForwardNotificationTracer.TraceDebug <object, string>((long)mtgMessage.GetHashCode(), "{0}: Processing MeetingForwardNotification: {1}", TraceContext.Get(), internetMessageId);
                    this.ProcessMeetingForwardNotification(itemStore, (MeetingForwardNotification)mtgMessage, ref originalCalItem, internetMessageId);
                }
            }
            else
            {
                int?num2 = (int?)Utils.SafeGetProperty(mtgMessage, MeetingMessageInstanceSchema.OriginalMeetingType, null);
                if (num2 != null)
                {
                    mtgMessage[CalendarItemBaseSchema.MeetingRequestType] = (MeetingMessageType)num2.Value;
                }
            }
            if (flag)
            {
                mtgMessage.CalendarProcessed = true;
            }
            ConflictResolutionResult saveResults = mtgMessage.Save(SaveMode.ResolveConflicts);

            mtgMessage.Load();
            if (!CalendarProcessing.CheckSaveResults(mtgMessage, saveResults, internetMessageId))
            {
                retries--;
                return(false);
            }
            return(true);
        }
        // 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();
                        }
                    }
                }
            }
        }
        // Token: 0x060007AC RID: 1964 RVA: 0x00036880 File Offset: 0x00034A80
        public void PerformCleanUp(MailboxSession itemStore, StoreObject item, CalendarConfiguration mailboxConfig, CalendarItemBase originalCalItem, IEnumerable <VersionedId> duplicates)
        {
            bool flag = false;

            if (mailboxConfig.RemoveOldMeetingMessages && !(item is MeetingForwardNotification))
            {
                this.DeleteOldMessages(itemStore, (MeetingMessage)item, originalCalItem, out flag);
            }
            if (item is MeetingMessage)
            {
                bool           flag2          = false;
                MeetingMessage meetingMessage = (MeetingMessage)item;
                if (meetingMessage.IsRepairUpdateMessage)
                {
                    flag2 = (!flag || (!(meetingMessage is MeetingRequest) && !(meetingMessage is MeetingCancellation)));
                    if (flag2)
                    {
                        meetingMessage.MarkAsOutOfDate();
                        meetingMessage.IsRead = true;
                        try
                        {
                            int num = 3;
                            ConflictResolutionResult saveResults;
                            do
                            {
                                saveResults = meetingMessage.Save(SaveMode.ResolveConflicts);
                                meetingMessage.Load();
                                num--;
                            }while (num > 0 && !CalendarProcessing.CheckSaveResults(meetingMessage, saveResults, meetingMessage.InternetMessageId));
                        }
                        catch (ObjectNotFoundException arg)
                        {
                            flag2 = false;
                            OldMessageDeletion.Tracer.TraceWarning <object, ObjectNotFoundException>((long)this.GetHashCode(), "{0}: Tried to mark a RUM as Outdated, which does not exist anymore. Exception: {1}", TraceContext.Get(), arg);
                        }
                    }
                }
                if (!flag2 && item is MeetingForwardNotification)
                {
                    bool   flag3 = itemStore.IsGroupMailbox();
                    string text  = null;
                    flag2 = (mailboxConfig.RemoveForwardedMeetingNotifications || !meetingMessage.IsResponseRequested || flag3);
                    if (!flag2)
                    {
                        Participant participant = null;
                        flag2 = OldMessageDeletion.IsSenderSame(meetingMessage.From, itemStore, out participant);
                        if (participant != null)
                        {
                            text = participant.EmailAddress;
                        }
                    }
                    string text2;
                    if (flag2)
                    {
                        text2 = string.Format("Deleting MFN message as it was forwarded by the organizer. ParticipantFromEmail: {0}, Message From: {1},  From RoutingType: {2},  Mailbox owner : {3}, Mailboxconfig.RemoveMFN setting {4}, IsResponseRequested {5}, Subject: {6}, IsGroupMailbox: {7} ", new object[]
                        {
                            text ?? "unspecified",
                            meetingMessage.From,
                            (meetingMessage.From != null) ? meetingMessage.From.RoutingType : "unspecified",
                            itemStore.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(),
                            mailboxConfig.RemoveForwardedMeetingNotifications,
                            meetingMessage.IsResponseRequested,
                            meetingMessage.Subject,
                            flag3
                        });
                    }
                    else
                    {
                        text2 = string.Format("Not deleting MFN message as it was forwarded by someone other than the organizer. ParticipantFromEmail {0}, Message From: {1}, From RoutingType: {2},  Mailbox owner : {3}, Mailboxconfig.RemoveMFN setting {4}, IsResponseRequested {5}, Subject: {6} ", new object[]
                        {
                            text ?? "unspecified",
                            meetingMessage.From,
                            (meetingMessage.From != null) ? meetingMessage.From.RoutingType : "unspecified",
                            itemStore.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(),
                            mailboxConfig.RemoveForwardedMeetingNotifications,
                            meetingMessage.IsResponseRequested,
                            meetingMessage.Subject
                        });
                    }
                    OldMessageDeletion.Tracer.TraceDebug((long)this.GetHashCode(), text2);
                    MfnLog.LogEntry(itemStore, text2);
                }
                if (!flag2 && OldMessageDeletion.IsSelfForwardedEventAndAccepted(meetingMessage, itemStore, originalCalItem))
                {
                    flag2 = true;
                    OldMessageDeletion.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Marked the meeting request for deletion as sent to self", new object[]
                    {
                        TraceContext.Get()
                    });
                }
                if (flag2)
                {
                    this.DeleteMessage(itemStore, item);
                }
            }
            if (duplicates != null)
            {
                foreach (VersionedId versionedId in duplicates)
                {
                    itemStore.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                    {
                        versionedId
                    });
                    OldMessageDeletion.Tracer.TraceDebug <object, VersionedId>((long)this.GetHashCode(), "{0}: Deleted a duplicate item ID: {1}.", TraceContext.Get(), versionedId);
                }
            }
        }