public bool TryCalculateOnDelivery(ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage stage, ConversationIndex conversationIndex, out byte[] conversationCreatorSid, out bool updateAllConversationMessages) { ConversationCreatorSidCalculator.MessageType messageType = this.CalculateMessageTypeOnDelivery(conversationIndex, itemPropertyBag, stage); updateAllConversationMessages = (messageType == ConversationCreatorSidCalculator.MessageType.OutOfOrderRootMessage); byte[] valueOrDefault = itemPropertyBag.GetValueOrDefault <byte[]>(InternalSchema.SenderSID, null); return(this.TryCalculateConversationCreatorSid(conversationIndex, messageType, valueOrDefault, out conversationCreatorSid)); }
public static bool CheckStageValue(ConversationIndex.FixupStage fixupStage, ConversationIndex.FixupStage expectedStage) { if (expectedStage == ConversationIndex.FixupStage.Unknown) { return(fixupStage == ConversationIndex.FixupStage.Unknown); } return((fixupStage & expectedStage) == expectedStage); }
protected virtual ConversationAggregationResult ConstructResult(ConversationIndex.FixupStage bySubjectResultingStage, ConversationIndex bySubjectResultingIndex, IStorePropertyBag parentItem) { return(new ConversationAggregationResult { Stage = bySubjectResultingStage, ConversationIndex = bySubjectResultingIndex, SupportsSideConversation = false, ConversationFamilyId = ConversationId.Create(bySubjectResultingIndex) }); }
public bool TryCalculateOnSave(ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage stage, ConversationIndex conversationIndex, CoreItemOperation operation, out byte[] conversationCreatorSid) { conversationCreatorSid = null; if (operation != CoreItemOperation.Save) { return(false); } byte[] itemOwnerSid = ValueConvertor.ConvertValueToBinary(this.mailboxSession.MailboxOwner.Sid, null); ConversationCreatorSidCalculator.MessageType messageType = this.CalculateMessageTypeOnSave(stage); return(this.TryCalculateConversationCreatorSid(conversationIndex, messageType, itemOwnerSid, out conversationCreatorSid)); }
protected override ConversationAggregationResult ConstructResult(ConversationIndex.FixupStage bySubjectResultingStage, ConversationIndex bySubjectResultingIndex, IStorePropertyBag parentItem, bool participantRemoved) { ConversationAggregationResult conversationAggregationResult = this.ConstructResult(bySubjectResultingStage, bySubjectResultingIndex, parentItem); if (participantRemoved) { conversationAggregationResult.Stage |= ConversationIndex.FixupStage.TC; conversationAggregationResult.ConversationFamilyId = ConversationId.Create(Guid.NewGuid()); } return(conversationAggregationResult); }
protected override ConversationAggregationResult ConstructResult(ConversationIndex.FixupStage bySubjectResultingStage, ConversationIndex bySubjectResultingIndex, IStorePropertyBag parentItem) { ConversationAggregationResult conversationAggregationResult = base.ConstructResult(bySubjectResultingStage, bySubjectResultingIndex, parentItem); if (AudienceBasedConversationAggregator.IsMessageCreatingNewConversation(parentItem, bySubjectResultingStage)) { conversationAggregationResult.SupportsSideConversation = true; conversationAggregationResult.ConversationFamilyId = ConversationId.Create(bySubjectResultingIndex); } else { conversationAggregationResult.SupportsSideConversation = AudienceBasedConversationAggregator.SupportsSideConversation(parentItem); conversationAggregationResult.ConversationFamilyId = parentItem.GetValueOrDefault <ConversationId>(ItemSchema.ConversationFamilyId, null); } return(conversationAggregationResult); }
private static bool FixupMeetingMessage(IXSOFactory xsoFactory, IMailboxSession session, AggregationByItemClassReferencesSubjectProcessor.PropertyDefinitionListConstructorDelegate propertyDefinitionListConstructorDelegate, ICorePropertyBag corePropertyBag, ref ConversationIndex newIndex, ref ConversationIndex.FixupStage stage, out IStorePropertyBag parentItemPropertyBag) { corePropertyBag.Load(propertyDefinitionListConstructorDelegate(new PropertyDefinition[] { CalendarItemBaseSchema.GlobalObjectId, CalendarItemBaseSchema.CleanGlobalObjectId, CalendarItemBaseSchema.OwnerCriticalChangeTime, InternalSchema.AppointmentSequenceNumber })); byte[] array = corePropertyBag.TryGetProperty(CalendarItemBaseSchema.GlobalObjectId) as byte[]; if (array == null) { parentItemPropertyBag = null; return(false); } GlobalObjectId globalObjectId; GlobalObjectId globalObjectId3; try { globalObjectId = new GlobalObjectId(array); globalObjectId3 = new GlobalObjectId(array); } catch (CorruptDataException) { parentItemPropertyBag = null; return(false); } globalObjectId3.Date = ExDateTime.MinValue; string valueOrDefault = corePropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty); bool isRequest = ObjectClass.IsMeetingRequest(valueOrDefault); object fixupStage = null; ExDateTime ownerCriticalChangeTime = corePropertyBag.GetValueOrDefault <ExDateTime>(CalendarItemBaseSchema.OwnerCriticalChangeTime, ExDateTime.MaxValue); int sequenceNumber = corePropertyBag.GetValueOrDefault <int>(InternalSchema.AppointmentSequenceNumber, -1); if (sequenceNumber == -1) { parentItemPropertyBag = null; return(false); } parentItemPropertyBag = xsoFactory.RunQueryOnAllItemsFolder <IStorePropertyBag>(session, AllItemsFolderHelper.SupportedSortBy.CleanGlobalObjectId, globalObjectId3.Bytes, null, delegate(QueryResult queryResult) { IStorePropertyBag result = null; bool flag2 = false; while (!flag2) { IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(50); flag2 = (propertyBags.Length == 0); IStorePropertyBag[] array2 = propertyBags; int i = 0; while (i < array2.Length) { IStorePropertyBag storePropertyBag = array2[i]; VersionedId versionedId = (VersionedId)storePropertyBag.TryGetProperty(ItemSchema.Id); byte[] array3 = (storePropertyBag.TryGetProperty(CalendarItemBaseSchema.GlobalObjectId) as byte[]) ?? (storePropertyBag.TryGetProperty(CalendarItemBaseSchema.CleanGlobalObjectId) as byte[]); if (array3 != null && GlobalObjectId.CompareCleanGlobalObjectIds(array3, globalObjectId.Bytes)) { GlobalObjectId globalObjectId2 = new GlobalObjectId(array3); if (versionedId.ObjectId.ObjectType == StoreObjectType.MeetingRequest) { ConversationId conversationId = storePropertyBag.TryGetProperty(ConversationItemSchema.ConversationId) as ConversationId; if (conversationId != null) { if (isRequest) { fixupStage = ConversationIndex.FixupStage.M1; return(storePropertyBag); } if (AggregationByItemClassReferencesSubjectProcessor.IsMatchForMeetingResponse(globalObjectId, ownerCriticalChangeTime, sequenceNumber, storePropertyBag)) { if (globalObjectId.Date != ExDateTime.MinValue && globalObjectId.Date == globalObjectId2.Date) { fixupStage = ConversationIndex.FixupStage.M3; return(storePropertyBag); } if (globalObjectId.Date == ExDateTime.MinValue) { fixupStage = ConversationIndex.FixupStage.M2; return(storePropertyBag); } fixupStage = ConversationIndex.FixupStage.M4; result = storePropertyBag; } } } i++; continue; } return(result); } } return(result); }, propertyDefinitionListConstructorDelegate(new PropertyDefinition[] { CalendarItemBaseSchema.GlobalObjectId, CalendarItemBaseSchema.CleanGlobalObjectId, InternalSchema.AppointmentSequenceNumber, CalendarItemBaseSchema.OwnerCriticalChangeTime, ConversationItemSchema.ConversationId })); if (parentItemPropertyBag == null) { return(false); } ConversationIndex conversationIndex; if (!ConversationIndex.TryCreate(parentItemPropertyBag.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex)) { return(false); } bool?flag = parentItemPropertyBag.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?; stage = ((flag == null || !flag.Value) ? ConversationIndex.FixupStage.L1 : ((ConversationIndex.FixupStage)fixupStage)); if (isRequest) { byte[] valueOrDefault2 = corePropertyBag.GetValueOrDefault <byte[]>(ItemSchema.ConversationIndex); ConversationIndex conversationIndex2; if (valueOrDefault2 != null && ConversationIndex.TryCreate(valueOrDefault2, out conversationIndex2)) { newIndex = conversationIndex.UpdateHeader(conversationIndex2.Components[0]); } else { newIndex = ConversationIndex.Create(conversationIndex.Guid); } } else { newIndex = ConversationIndex.CreateFromParent(conversationIndex.Bytes); } return(true); }
private bool CalculateBasedOnReferenceMessage(ICorePropertyBag message, IStorePropertyBag referenceItem, out ConversationIndex.FixupStage stage, out ConversationIndex newIndex) { bool result = true; newIndex = ConversationIndex.Empty; stage = ConversationIndex.FixupStage.Unknown; if (this.indexTrackingEx != null) { string text = referenceItem.TryGetProperty(ItemSchema.InternetMessageId) as string; if (text != null) { this.indexTrackingEx.Trace("S1", text); } } string text2 = message.TryGetProperty(ItemSchema.NormalizedSubject) as string; ConversationIndex conversationIndex; bool flag = ConversationIndex.TryCreate(referenceItem.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex); ConversationIndex conversationIndex2; bool flag2 = ConversationIndex.TryCreate(message.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex2); bool?flag3 = referenceItem.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?; bool flag4 = flag3 == null || !flag3.Value; if (flag) { string value = referenceItem.TryGetProperty(ItemSchema.ConversationTopic) as string; if (string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(text2) && text2.EndsWith(value, StringComparison.OrdinalIgnoreCase))) { string text3 = message.TryGetProperty(ItemSchema.InReplyTo) as string; string text4 = referenceItem.TryGetProperty(ItemSchema.InternetMessageId) as string; if (!string.IsNullOrEmpty(text3) && !string.IsNullOrEmpty(text4) && string.Compare(text3, text4, StringComparison.OrdinalIgnoreCase) == 0) { if (conversationIndex.IsParentOf(conversationIndex2)) { newIndex = conversationIndex2; stage = (flag4 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H1); result = false; } else { ExDateTime?valueAsNullable = message.GetValueAsNullable <ExDateTime>(ItemSchema.SentTime); if (valueAsNullable != null) { newIndex = ConversationIndex.CreateFromParent(conversationIndex.Bytes, valueAsNullable.Value); } else { newIndex = ConversationIndex.CreateFromParent(conversationIndex.Bytes); } stage = (flag4 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H2); } } else if (flag2) { if (conversationIndex.IsAncestorOf(conversationIndex2)) { newIndex = conversationIndex2; stage = (flag4 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H1); result = false; } else { newIndex = conversationIndex2.UpdateGuid(conversationIndex.Guid); newIndex = newIndex.UpdateHeader(conversationIndex.Header); stage = (flag4 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H10); } } else { newIndex = ConversationIndex.CreateFromParent(conversationIndex.Bytes); stage = (flag4 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H2); } } else { newIndex = ConversationIndex.CreateNew(); stage = ConversationIndex.FixupStage.H3; } } return(result); }
private void CalculateBasedOnMessageWithSameInternetMessageId(ICorePropertyBag message, IStorePropertyBag referenceItem, out ConversationIndex.FixupStage stage, out ConversationIndex newIndex) { string text = message.TryGetProperty(ItemSchema.NormalizedSubject) as string; newIndex = ConversationIndex.Empty; stage = ConversationIndex.FixupStage.Unknown; ConversationIndex conversationIndex; bool flag = ConversationIndex.TryCreate(referenceItem.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex); bool valueOrDefault = referenceItem.GetValueOrDefault <bool>(InternalSchema.IsDraft, false); if (flag && !valueOrDefault) { string value = referenceItem.TryGetProperty(ItemSchema.ConversationTopic) as string; if (string.IsNullOrEmpty(value) || (!string.IsNullOrEmpty(text) && text.Equals(value, StringComparison.OrdinalIgnoreCase))) { bool?flag2 = referenceItem.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?; stage = ((flag2 == null || !flag2.Value) ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H13); newIndex = conversationIndex; } } }
public bool TryCalculateOnSave(ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage stage, ConversationIndex conversationIndex, CoreItemOperation operation, out byte[] conversationCreatorSid) { return(ConversationCreatorHelper.TryCalculateConversationCreatorSidOnSaving(this.mailboxSession as MailboxSession, itemPropertyBag, stage, conversationIndex, out conversationCreatorSid)); }
public bool TryCalculateOnDelivery(ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage stage, ConversationIndex conversationIndex, out byte[] conversationCreatorSid, out bool updateAllConversationMessages) { return(ConversationCreatorHelper.TryCalculateConversationCreatorSidOnDeliveryProcessing(this.mailboxSession as MailboxSession, itemPropertyBag, stage, conversationIndex, out conversationCreatorSid, out updateAllConversationMessages)); }
private static bool TryCalculateConversationCreatorSid(MailboxSession mailboxSession, ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage fixupStage, ConversationIndex conversationIndex, byte[] itemOwnerSID, out byte[] conversationCreatorSid, out bool updateAllConversationMessages) { ConversationCreatorHelper.ConversationCreatorDefinitionData definitionData = new ConversationCreatorHelper.ConversationCreatorDefinitionData(mailboxSession, conversationIndex); ConversationCreatorHelper.MessageDeliveryScenario messageDeliveryScenario = ConversationCreatorHelper.CalculateConversationDeliveryScenario(definitionData, itemPropertyBag, fixupStage); return(ConversationCreatorHelper.TryCalculateConversationCreatorSid(definitionData, messageDeliveryScenario, itemOwnerSID, out conversationCreatorSid, out updateAllConversationMessages)); }
public void Aggregate(ICorePropertyBag item, bool shouldSearchForDuplicatedMessage, out IStorePropertyBag parentItem, out ConversationIndex newIndex, out ConversationIndex.FixupStage stage) { newIndex = ConversationIndex.Empty; stage = ConversationIndex.FixupStage.Unknown; string valueOrDefault = item.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty); parentItem = null; if (!string.IsNullOrEmpty(valueOrDefault)) { if (ObjectClass.IsMeetingMessage(valueOrDefault)) { if (AggregationByItemClassReferencesSubjectProcessor.FixupMeetingMessage(this.xsoFactory, this.session, new AggregationByItemClassReferencesSubjectProcessor.PropertyDefinitionListConstructorDelegate(this.GetSearchPropertyDefinitions), item, ref newIndex, ref stage, out parentItem)) { return; } } else if (ObjectClass.IsSmsMessage(valueOrDefault)) { AggregationBySmsItemClassProcessor aggregationBySmsItemClassProcessor = new AggregationBySmsItemClassProcessor(this.xsoFactory, this.session, this.indexTrackingEx); aggregationBySmsItemClassProcessor.Aggregate(item, out newIndex, out stage); return; } } ConversationIndex conversationIndex; bool flag = ConversationIndex.TryCreate(item.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex); if (this.indexTrackingEx != null) { if (flag) { this.indexTrackingEx.Trace(conversationIndex); } else { this.indexTrackingEx.Trace("II", "<invalid>"); } } if (AggregationByItemClassReferencesSubjectProcessor.SearchByReferences(this.xsoFactory, this.session, item, this.indexTrackingEx, shouldSearchForDuplicatedMessage, out parentItem, this.GetSearchPropertyDefinitions(null))) { bool flag2 = false; if (shouldSearchForDuplicatedMessage) { string a = item.TryGetProperty(ItemSchema.InternetMessageId) as string; string text = parentItem.TryGetProperty(ItemSchema.InternetMessageId) as string; flag2 = (!string.IsNullOrEmpty(text) && string.Equals(a, text, StringComparison.OrdinalIgnoreCase)); } if (flag2) { this.CalculateBasedOnMessageWithSameInternetMessageId(item, parentItem, out stage, out newIndex); } else { this.CalculateBasedOnReferenceMessage(item, parentItem, out stage, out newIndex); } } string text2 = item.TryGetProperty(ItemSchema.NormalizedSubject) as string; if (stage == ConversationIndex.FixupStage.Unknown) { if (string.IsNullOrEmpty(item.GetValueOrDefault <string>(ItemSchema.SubjectPrefix)) && flag) { if (conversationIndex.Components.Count > 1) { byte[] incomingConversationIdBytes = ConversationId.Create(conversationIndex.Guid).GetBytes(); int conversationIdHash = (int)AllItemsFolderHelper.GetHashValue(incomingConversationIdBytes); Stopwatch stopwatch = Stopwatch.StartNew(); parentItem = this.xsoFactory.RunQueryOnAllItemsFolder <IStorePropertyBag>(this.session, AllItemsFolderHelper.SupportedSortBy.ConversationIdHash, conversationIdHash, null, delegate(QueryResult queryResult) { IStorePropertyBag[] propertyBags; byte[] array; do { propertyBags = queryResult.GetPropertyBags(1); if (propertyBags == null || propertyBags.Length != 1) { goto IL_69; } int?num = propertyBags[0].TryGetProperty(ItemSchema.ConversationIdHash) as int?; if (num == null || num.Value != conversationIdHash) { goto IL_69; } array = (propertyBags[0].TryGetProperty(InternalSchema.MapiConversationId) as byte[]); }while (array == null || !Util.CompareByteArray(incomingConversationIdBytes, array)); return(propertyBags[0]); IL_69: return(null); }, this.GetSearchPropertyDefinitions(new StorePropertyDefinition[] { InternalSchema.MapiConversationId, ItemSchema.ConversationIdHash })); stopwatch.Stop(); if (this.indexTrackingEx != null) { this.indexTrackingEx.Trace("SBCID", stopwatch.ElapsedMilliseconds.ToString()); } if (parentItem != null && !ConversationIndex.CompareTopics(parentItem.TryGetProperty(ItemSchema.ConversationTopic) as string, text2)) { newIndex = ConversationIndex.CreateNew(); stage = ConversationIndex.FixupStage.H11; if (this.indexTrackingEx != null) { string text3 = parentItem.TryGetProperty(ItemSchema.InternetMessageId) as string; if (text3 != null) { this.indexTrackingEx.Trace("S3", text3); } } } } if (stage == ConversationIndex.FixupStage.Unknown) { newIndex = conversationIndex; bool flag3 = parentItem != null; if (flag3) { bool?flag4 = parentItem.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?; stage = ((flag4 == null || !flag4.Value) ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H14); } else { stage = ConversationIndex.FixupStage.H4; } } } else { if (string.IsNullOrEmpty(item.GetValueOrDefault <string>(ItemSchema.InReplyTo, string.Empty)) && string.IsNullOrEmpty(item.GetValueOrDefault <string>(ItemSchema.InternetReferences, string.Empty)) && string.IsNullOrEmpty(item.GetValueOrDefault <string>(ItemSchema.SubjectPrefix)) && !flag) { TopicHashCache topicHashCache = TopicHashCache.Load(this.xsoFactory, this.session, 50); if (string.IsNullOrEmpty(text2) || !topicHashCache.Contains(AllItemsFolderHelper.GetHashValue(text2))) { newIndex = ConversationIndex.CreateNew(); stage = ConversationIndex.FixupStage.H12; } } bool flag5; bool flag6; if (stage == ConversationIndex.FixupStage.Unknown && AggregationByItemClassReferencesSubjectProcessor.SearchByTopic(this.xsoFactory, this.session, item, this.indexTrackingEx, out parentItem, out flag5, out flag6, this.GetSearchPropertyDefinitions(new StorePropertyDefinition[] { ItemSchema.ReceivedTime, ItemSchema.InReplyTo, ItemSchema.InternetReferences }))) { if (this.indexTrackingEx != null) { string text4 = parentItem.TryGetProperty(ItemSchema.InternetMessageId) as string; if (text4 != null) { this.indexTrackingEx.Trace("S2", text4); } } bool?flag7 = parentItem.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?; bool flag8 = flag7 == null || !flag7.Value; if (flag5) { newIndex = conversationIndex; stage = (flag8 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H5); } else { ConversationIndex conversationIndex2; bool flag9 = ConversationIndex.TryCreate(parentItem.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex2); if (flag6) { ExDateTime?valueAsNullable = item.GetValueAsNullable <ExDateTime>(ItemSchema.SentTime); newIndex = ((valueAsNullable != null) ? ConversationIndex.Create(conversationIndex2.Guid, valueAsNullable.Value) : ConversationIndex.Create(conversationIndex2.Guid)); stage = (flag8 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H6); } else { object obj = parentItem.TryGetProperty(ItemSchema.ReceivedTime); string valueOrDefault2 = item.GetValueOrDefault <string>(ItemSchema.SubjectPrefix); if (obj != null && obj is ExDateTime) { ExDateTime dt = (ExDateTime)obj; TimeSpan timeSpan = ExDateTime.Now - dt; if (timeSpan.TotalHours >= -72.0 && timeSpan.TotalHours <= 72.0 && flag9) { if (flag) { newIndex = conversationIndex.UpdateGuid(conversationIndex2.Guid); stage = (flag8 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H9); } else if (!string.IsNullOrEmpty(valueOrDefault2)) { ExDateTime?valueAsNullable2 = item.GetValueAsNullable <ExDateTime>(ItemSchema.SentTime); if (valueAsNullable2 != null) { newIndex = ConversationIndex.Create(conversationIndex2.Guid, valueAsNullable2.Value); } else { newIndex = ConversationIndex.Create(conversationIndex2.Guid); } stage = (flag8 ? ConversationIndex.FixupStage.L1 : ConversationIndex.FixupStage.H6); } } } } } } } } if (stage == ConversationIndex.FixupStage.Unknown) { if (!string.IsNullOrEmpty(item.GetValueOrDefault <string>(ItemSchema.SubjectPrefix))) { TopicHashCache topicHashCache2 = TopicHashCache.Load(this.xsoFactory, this.session, 50); uint hashValue = AllItemsFolderHelper.GetHashValue(text2); topicHashCache2.Add(hashValue); TopicHashCache.Save(topicHashCache2, this.xsoFactory, this.session); if (this.indexTrackingEx != null) { this.indexTrackingEx.Trace("THA", hashValue.ToString()); } } if (flag) { newIndex = conversationIndex; stage = ConversationIndex.FixupStage.H7; return; } newIndex = ConversationIndex.CreateNew(); stage = ConversationIndex.FixupStage.H8; } }
public static bool TryCalculateConversationCreatorSidOnDeliveryProcessing(MailboxSession mailboxSession, ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage fixupStage, ConversationIndex conversationIndex, out byte[] conversationCreatorSid, out bool updateAllConversationMessages) { conversationCreatorSid = null; updateAllConversationMessages = false; if (!ConversationCreatorHelper.SupportsConversationCreator(mailboxSession)) { return(false); } byte[] valueOrDefault = itemPropertyBag.GetValueOrDefault <byte[]>(InternalSchema.SenderSID, null); return(ConversationCreatorHelper.TryCalculateConversationCreatorSid(mailboxSession, itemPropertyBag, fixupStage, conversationIndex, valueOrDefault, out conversationCreatorSid, out updateAllConversationMessages)); }
private static ConversationCreatorHelper.MessageDeliveryScenario CalculateConversationDeliveryScenario(ConversationCreatorHelper.ConversationCreatorDefinitionData definitionData, ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage fixupStage) { if (ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.Error)) { return(ConversationCreatorHelper.MessageDeliveryScenario.Unknown); } if (ConversationIndex.IsFixUpCreatingNewConversation(fixupStage)) { return(ConversationCreatorHelper.MessageDeliveryScenario.DeliveringRootMessage); } if (definitionData.Conversation.RootMessageId == null) { ExTraceGlobals.StorageTracer.TraceDebug <string, string>(0L, "ConversationCreatorHelper::CalculateConversationDeliveryScenario : On some corner cases, the conversation is loaded without nodes and then root node is null. MessageClassConversationID:{0} FixupStage:{1}", definitionData.Conversation.ConversationId.ToString(), fixupStage.ToString()); return(ConversationCreatorHelper.MessageDeliveryScenario.DeliveringRootMessage); } if (ConversationIndex.IsFixupAddingOutOfOrderMessageToConversation(fixupStage) && ConversationCreatorHelper.IsRootMessage(definitionData.Conversation, itemPropertyBag)) { return(ConversationCreatorHelper.MessageDeliveryScenario.DeliveringOutOfOrderRootMessage); } return(ConversationCreatorHelper.MessageDeliveryScenario.Unknown); }
public static bool TryCalculateConversationCreatorSidOnSaving(MailboxSession mailboxSession, ICorePropertyBag itemPropertyBag, ConversationIndex.FixupStage fixupStage, ConversationIndex conversationIndex, out byte[] conversationCreatorSid) { conversationCreatorSid = null; if (!ConversationCreatorHelper.SupportsConversationCreator(mailboxSession) || itemPropertyBag.GetValueOrDefault <bool>(InternalSchema.DeleteAfterSubmit, false)) { return(false); } conversationCreatorSid = ConversationCreatorHelper.CalculateConversationCreatorSid(mailboxSession, itemPropertyBag, fixupStage, conversationIndex, ValueConvertor.ConvertValueToBinary(mailboxSession.MailboxOwner.Sid, null)); return(conversationCreatorSid != null); }
private ConversationCreatorSidCalculator.MessageType CalculateMessageTypeOnSave(ConversationIndex.FixupStage fixupStage) { if (ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.Error)) { return(ConversationCreatorSidCalculator.MessageType.Unknown); } if (ConversationIndex.IsFixUpCreatingNewConversation(fixupStage)) { return(ConversationCreatorSidCalculator.MessageType.RootMessage); } return(ConversationCreatorSidCalculator.MessageType.NonRootMessage); }
private ConversationCreatorSidCalculator.MessageType CalculateMessageTypeOnDelivery(ConversationIndex conversationIndex, ICorePropertyBag itemBag, ConversationIndex.FixupStage fixupStage) { if (ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.Error)) { return(ConversationCreatorSidCalculator.MessageType.Unknown); } if (ConversationIndex.IsFixUpCreatingNewConversation(fixupStage)) { return(ConversationCreatorSidCalculator.MessageType.RootMessage); } IConversation conversation = this.LoadConversation(conversationIndex); if (conversation.RootMessageNode == null) { ExTraceGlobals.StorageTracer.TraceDebug <string, string>(0L, "ConversationCreatorHelper::CalculateConversationDeliveryScenario : On some corner cases, the conversation is loaded without nodes and then root node is null. MessageClassConversationID:{0} FixupStage:{1}", this.LoadConversation(conversationIndex).ConversationId.ToString(), fixupStage.ToString()); return(ConversationCreatorSidCalculator.MessageType.RootMessage); } if (ConversationIndex.IsFixupAddingOutOfOrderMessageToConversation(fixupStage) && this.IsRootMessage(conversation, itemBag)) { return(ConversationCreatorSidCalculator.MessageType.OutOfOrderRootMessage); } return(ConversationCreatorSidCalculator.MessageType.NonRootMessage); }
public static bool IsMessageCreatingNewConversation(IStorePropertyBag parentItemPropertyBag, ConversationIndex.FixupStage stage) { return(parentItemPropertyBag == null || ConversationIndex.IsFixUpCreatingNewConversation(stage)); }
public static bool IsFixUpCreatingNewConversation(ConversationIndex.FixupStage fixupStage) { ConversationIndex.FixupStage fixupStage2 = ConversationIndex.FixupStage.H3 | ConversationIndex.FixupStage.H4 | ConversationIndex.FixupStage.H8 | ConversationIndex.FixupStage.H11 | ConversationIndex.FixupStage.H12 | ConversationIndex.FixupStage.SC; return(ConversationIndex.CheckStageValue(fixupStage2, fixupStage)); }
protected abstract ConversationAggregationResult ConstructResult(ConversationIndex.FixupStage bySubjectResultingStage, ConversationIndex bySubjectResultingIndex, IStorePropertyBag parentItem, bool participantRemoved);
public static bool IsFixupAddingOutOfOrderMessageToConversation(ConversationIndex.FixupStage fixupStage) { return(ConversationIndex.CheckStageValue(fixupStage, ConversationIndex.FixupStage.H6)); }
public bool Aggregate(ICorePropertyBag propertyBag, out ConversationIndex newIndex, out ConversationIndex.FixupStage stage) { newIndex = ConversationIndex.Empty; Participant valueOrDefault = propertyBag.GetValueOrDefault <Participant>(InternalSchema.From); if (valueOrDefault != null && string.Equals("MOBILE", valueOrDefault.RoutingType, StringComparison.OrdinalIgnoreCase)) { newIndex = ConversationIndex.GenerateFromPhoneNumber(valueOrDefault.EmailAddress); } if (newIndex != ConversationIndex.Empty) { stage = ConversationIndex.FixupStage.S1; AggregationBySmsItemClassProcessor.ChunkSmsConversation(this.xsoFactory, this.session, newIndex, this.indexTrackingEx); } else { newIndex = ConversationIndex.CreateNew(); stage = ConversationIndex.FixupStage.S2; } return(false); }
public bool ShouldAggregate(ICorePropertyBag message, IStorePropertyBag parentMessage, ConversationIndex.FixupStage previousStage) { if (AudienceBasedConversationAggregator.IsMessageCreatingNewConversation(parentMessage, previousStage)) { return(false); } if (!AudienceBasedConversationAggregator.SupportsSideConversation(parentMessage)) { return(false); } if (!this.IsSupportedItem(message) || !this.IsSupportedItem(parentMessage)) { return(false); } if (previousStage <= ConversationIndex.FixupStage.H13) { if (previousStage != ConversationIndex.FixupStage.Unknown && previousStage != ConversationIndex.FixupStage.H13) { return(true); } } else if (previousStage != ConversationIndex.FixupStage.Error && previousStage != ConversationIndex.FixupStage.S1 && previousStage != ConversationIndex.FixupStage.S2) { return(true); } return(false); }