private void SendApprovalRequest(ApprovalRequestWriter writer, ICollection <RoutingAddress> p1DecisionMakers, CultureInfo cultureInfo, string messageId, byte[] corelationBlob) { IList <RoutingAddress> decisionMakers = this.initiationMessage.DecisionMakers; byte[] conversationIndex = this.initiationMessageItem.ConversationIndex; (string)this.initiationMessage.Requestor; using (MessageItemApprovalRequest messageItemApprovalRequest = this.requestCreate(this.mbxTransportMailItem)) { messageItemApprovalRequest.SetSender(this.approvalRequestSender); foreach (RoutingAddress routingAddress in decisionMakers) { bool flag = p1DecisionMakers == null || p1DecisionMakers.Contains(routingAddress); messageItemApprovalRequest.AddRecipient(routingAddress, flag); InitiationProcessor.diag.TraceDebug <RoutingAddress, bool>(0L, "Added recipient '{0}' with promote to P1={1}.", routingAddress, flag); } CultureInfo cultureInfo2; if (!writer.WriteSubjectAndBody(messageItemApprovalRequest, cultureInfo, out cultureInfo2)) { InitiationProcessor.diag.TraceError <ApprovalRequestWriter>(0L, "Approval request body cannot be written with writer {0}", writer); } messageItemApprovalRequest.ApprovalRequestor = this.initiationMessage.Requestor; messageItemApprovalRequest.MessageItem[ItemSchema.NormalizedSubject] = this.initiationMessageItem.ConversationTopic; messageItemApprovalRequest.MessageItem.Importance = this.initiationMessageItem.Importance; messageItemApprovalRequest.MessageItem.References = InitiationProcessor.ConstructApprovalRequestReferences(this.initiationMessageItem); ConversationIndex o = ConversationIndex.CreateFromParent(conversationIndex); if (!ConversationIndex.Empty.Equals(o)) { messageItemApprovalRequest.MessageItem.ConversationIndex = o.ToByteArray(); } if (cultureInfo2 != null) { InitiationProcessor.diag.TraceDebug <CultureInfo>(0L, "Approval request written in {0}", cultureInfo2); messageItemApprovalRequest.MessageItem[MessageItemSchema.MessageLocaleId] = cultureInfo2.LCID; } foreach (Attachment attachment in this.initiationMessage.EmailMessage.Attachments) { messageItemApprovalRequest.AddAttachment(attachment, this.mbxTransportMailItem.ADRecipientCache.ADSession); } if (this.initiationMessage.EmailMessage.RootPart != null && this.initiationMessage.EmailMessage.RootPart.Headers != null) { HeaderList headers = this.initiationMessage.EmailMessage.RootPart.Headers; Header[] array = headers.FindAll("X-MS-Exchange-Inbox-Rules-Loop"); if (array != null && array.Length > 0) { string[] array2 = new string[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = array[i].Value; } messageItemApprovalRequest.MessageItem.SafeSetProperty(MessageItemSchema.XLoop, array2); } } InitiationProcessor.AddVotingToApprovalRequest(messageItemApprovalRequest, this.initiationMessage.VotingActions, cultureInfo2); messageItemApprovalRequest.Send(messageId, corelationBlob, this.mbxTransportMailItem); } }
private void HandleResults(ApprovalEngine.ApprovalProcessResults resultInfo, MessageItem messageItem, MbxTransportMailItem rmi, MailRecipient recipient) { if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.InitiationMessageOk) { messageItem.VotingInfo.MessageCorrelationBlob = resultInfo.ApprovalTrackingBlob; messageItem[MessageItemSchema.ApprovalRequestMessageId] = resultInfo.ApprovalRequestMessageId; messageItem[MessageItemSchema.ApprovalDecisionMakersNdred] = NdrOofHandler.FormatNdrOofProperty(resultInfo.TotalDecisionMakers, 0, 0); messageItem[MessageItemSchema.ApprovalStatus] = ApprovalStatus.Unhandled; this.perfCounter.InitiationMessages.Increment(); return; } if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.UnauthorizedMessage) { throw new SmtpResponseException(AckReason.ApprovalUnAuthorizedMessage); } if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.InitiationMessageDuplicate) { recipient.DsnRequested = DsnRequestedFlags.Never; throw new SmtpResponseException(AckReason.ApprovalDuplicateInitiation, base.Name); } if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.DecisionMarked) { this.perfCounter.DecisionUsed.Increment(); this.perfCounter.DecisionMessages.Increment(); this.perfCounter.DecisionInitiationMessageSearchTimeMilliseconds.IncrementBy(resultInfo.InitiationMessageSearchTimeMilliseconds); recipient.DsnRequested = DsnRequestedFlags.Never; throw new SmtpResponseException(AckReason.ApprovalDecisionSuccsess, base.Name); } if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.InitiationNotFoundForDecision || resultInfo.ProcessResults == ApprovalEngine.ProcessResult.DecisionAlreadyMade) { byte[] conversationIndex = messageItem.ConversationIndex; string threadIndex = Convert.ToBase64String(ConversationIndex.CreateFromParent(conversationIndex).ToByteArray()); this.SendNotifications(recipient.Email, (RoutingAddress)rmi.Message.Sender.SmtpAddress, rmi, threadIndex, messageItem.ConversationTopic, resultInfo.ExistingDecisionMakerAddress, resultInfo.ExistingApprovalStatus, resultInfo.ExistingDecisionTime); this.perfCounter.DecisionMessages.Increment(); this.perfCounter.DecisionInitiationMessageSearchTimeMilliseconds.IncrementBy(resultInfo.InitiationMessageSearchTimeMilliseconds); recipient.DsnRequested = DsnRequestedFlags.Never; throw new SmtpResponseException(AckReason.ApprovalDecisionSuccsess, base.Name); } if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.NdrOrOofUpdated || resultInfo.ProcessResults == ApprovalEngine.ProcessResult.NdrOrOofUpdateSkipped || resultInfo.ProcessResults == ApprovalEngine.ProcessResult.InitiationNotFoundForNdrOrOof || resultInfo.ProcessResults == ApprovalEngine.ProcessResult.NdrOrOofInvalid) { this.perfCounter.TotalNdrOofHandled.Increment(); if (resultInfo.ProcessResults != ApprovalEngine.ProcessResult.NdrOrOofInvalid) { this.perfCounter.TotalSearchesForInitiationBasedOnNdrAndOof.Increment(); this.perfCounter.NdrOofInitiationMessageSearchTimeMilliseconds.IncrementBy(resultInfo.InitiationMessageSearchTimeMilliseconds); } if (resultInfo.ProcessResults == ApprovalEngine.ProcessResult.NdrOrOofUpdated) { this.perfCounter.TotalNdrOofUpdated.Increment(); } recipient.DsnRequested = DsnRequestedFlags.Never; throw new SmtpResponseException(AckReason.ApprovalNdrOofUpdateSuccess, base.Name); } throw new SmtpResponseException(AckReason.ApprovalInvalidMessage); }
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); }
// Token: 0x06000116 RID: 278 RVA: 0x00007164 File Offset: 0x00005364 private static void SaveSmsItem(MessageItem message, ConversationIndex conversationIndex) { try { message[ItemSchema.ConversationIndex] = conversationIndex.ToByteArray(); message[ItemSchema.ConversationIndexTracking] = true; message.Save(SaveMode.ResolveConflicts); } catch (QuotaExceededException ex) { SentItemsProcessor.Tracer.TraceDebug <string>(0L, "Saving failed because quota exceeded. Exception: {0}", ex.Message); } }
public void UpdateConversationMessages(ConversationIndex conversationIndex, byte[] conversationCreatorSid) { IConversation conversation = this.LoadConversation(conversationIndex); foreach (IConversationTreeNode conversationTreeNode in conversation.ConversationTree) { foreach (StoreObjectId id in conversationTreeNode.ToListStoreObjectId()) { using (IItem item = this.xsoFactory.BindToItem(this.mailboxSession, id, new PropertyDefinition[0])) { item.OpenAsReadWrite(); item.SetOrDeleteProperty(ItemSchema.ConversationCreatorSID, conversationCreatorSid); item.Save(SaveMode.ResolveConflicts); } } } }
// Token: 0x0600003C RID: 60 RVA: 0x00004230 File Offset: 0x00002430 private void StampCommonNotificationProperties(MessageItem notificationItem, MessageItem initMessageItem, ICollection <RoutingAddress> notificationReceivers, string originalMessageId, CultureInfo cultureInfo) { foreach (RoutingAddress routingAddress in notificationReceivers) { Participant participant = new Participant(string.Empty, routingAddress.ToString(), ProxyAddressPrefix.Smtp.ToString()); notificationItem.Recipients.Add(participant); } notificationItem.Sender = initMessageItem.Sender; notificationItem[MessageItemSchema.IsNonDeliveryReceiptRequested] = false; notificationItem[MessageItemSchema.IsDeliveryReceiptRequested] = false; notificationItem[MessageItemSchema.MessageLocaleId] = cultureInfo.LCID; byte[] conversationIndex = initMessageItem.ConversationIndex; notificationItem.ConversationIndex = ConversationIndex.CreateFromParent(conversationIndex).ToByteArray(); notificationItem[ItemSchema.NormalizedSubject] = initMessageItem.ConversationTopic; if (!string.IsNullOrEmpty(originalMessageId)) { notificationItem[ItemSchema.InReplyTo] = originalMessageId; } }
private bool TryCalculateConversationCreatorSid(ConversationIndex conversationIndex, ConversationCreatorSidCalculator.MessageType messageType, byte[] itemOwnerSid, out byte[] conversationCreatorSid) { switch (messageType) { case ConversationCreatorSidCalculator.MessageType.RootMessage: case ConversationCreatorSidCalculator.MessageType.OutOfOrderRootMessage: conversationCreatorSid = itemOwnerSid; break; case ConversationCreatorSidCalculator.MessageType.NonRootMessage: conversationCreatorSid = this.LoadConversation(conversationIndex).ConversationCreatorSID; break; default: conversationCreatorSid = null; break; } return(conversationCreatorSid != null); }
private ConversationAggregatorFactory.AggregationApproach IdentifyAggregationApproachForSave(CoreItemOperation saveOperation, ICoreItem item) { if (this.session.LogonType == LogonType.Transport) { return(ConversationAggregatorFactory.AggregationApproach.NoOp); } ICorePropertyBag propertyBag = item.PropertyBag; string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty); if (string.IsNullOrEmpty(valueOrDefault) || ConversationIdFromIndexProperty.CheckExclusionList(valueOrDefault) || propertyBag.GetValueOrDefault <bool>(InternalSchema.IsAssociated)) { return(ConversationAggregatorFactory.AggregationApproach.NoOp); } if (this.mailboxOwner.ThreadedConversationProcessingEnabled || this.mailboxOwner.SideConversationProcessingEnabled) { if (saveOperation == CoreItemOperation.Send || (item.Origin == Origin.New && !ConversationIndex.WasMessageEverProcessed(propertyBag))) { if (!this.mailboxOwner.ThreadedConversationProcessingEnabled) { return(ConversationAggregatorFactory.AggregationApproach.SideConversation); } return(ConversationAggregatorFactory.AggregationApproach.ThreadedConversation); } else { if (this.mailboxOwner.IsGroupMailbox && !propertyBag.GetValueOrDefault <bool>(InternalSchema.IsDraft)) { return(ConversationAggregatorFactory.AggregationApproach.SideConversation); } return(ConversationAggregatorFactory.AggregationApproach.NoOp); } } else { if (item.Origin == Origin.New && !ConversationIndex.WasMessageEverProcessed(propertyBag)) { return(ConversationAggregatorFactory.AggregationApproach.SameConversation); } return(ConversationAggregatorFactory.AggregationApproach.NoOp); } }
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); }
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; } } }
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)); }
// Token: 0x06000115 RID: 277 RVA: 0x0000710C File Offset: 0x0000530C private static void CloneSmsItem(MailboxSession session, MessageItem source, MailboxData mailboxData, Recipient recipient, ConversationIndex conversationIndex) { using (MessageItem messageItem = MessageItem.CloneMessage(session, StoreObjectId.FromProviderSpecificId(mailboxData.SentItemsFolderId), source)) { RecipientCollection recipients = messageItem.Recipients; recipients.Clear(); recipients.Add(recipient); SentItemsProcessor.SaveSmsItem(messageItem, conversationIndex); } }
internal static IDictionary <string, string> ExtractDeliveryDetails(StoreSession session, Item item) { IDictionary <string, string> customProperties = null; ActivityLogHelper.CatchNonFatalExceptions(delegate { MessageItem messageItem = item as MessageItem; if (messageItem == null) { return; } bool flag = false; bool flag2 = false; string value = null; ConversationId conversationId = null; string value2 = null; bool?flag3 = null; if (((IDirectPropertyBag)messageItem.PropertyBag).IsLoaded(InternalSchema.InferenceClassificationResult)) { InferenceClassificationResult?valueAsNullable = messageItem.GetValueAsNullable <InferenceClassificationResult>(InternalSchema.InferenceClassificationResult); flag3 = new bool?(valueAsNullable != null && valueAsNullable.Value.HasFlag(InferenceClassificationResult.IsClutterFinal)); } string value3 = string.Empty; if (flag3 != null) { value3 = (flag3.Value ? bool.TrueString : bool.FalseString); } bool?flag4 = new bool?(messageItem.IsGroupEscalationMessage); string value4 = string.Empty; if (flag4 != null) { value4 = (flag4.Value ? bool.TrueString : bool.FalseString); } StoreObjectId parentId = messageItem.ParentId; DefaultFolderType defaultFolderType = DefaultFolderType.None; bool flag5 = false; if (parentId != null) { StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Inbox); flag = parentId.Equals(defaultFolderId); StoreObjectId defaultFolderId2 = session.GetDefaultFolderId(DefaultFolderType.Clutter); flag2 = (defaultFolderId2 != null && parentId.Equals(defaultFolderId2)); MailboxSession mailboxSession = session as MailboxSession; if (mailboxSession != null) { defaultFolderType = mailboxSession.IsDefaultFolderType(parentId); flag5 = true; } } value = messageItem.InternetMessageId; ConversationIndex index; if (ConversationIndex.TryCreate(messageItem.ConversationIndex, out index)) { conversationId = ConversationId.Create(index); } string value5 = string.Empty; if (((IDirectPropertyBag)messageItem.PropertyBag).IsLoaded(InternalSchema.InferenceMessageIdentifier)) { value5 = messageItem.GetValueAsNullable <Guid>(InternalSchema.InferenceMessageIdentifier).ToString(); } if (messageItem.Sender != null) { value2 = messageItem.Sender.SmtpEmailAddress; } List <string> list = null; List <string> list2 = null; foreach (Recipient recipient in messageItem.Recipients) { if (recipient.Participant != null) { if (recipient.IsDistributionList() == true) { if (list == null) { list = new List <string>(2); } list.Add(recipient.SmtpAddress()); } else if (recipient.IsGroupMailbox() == true) { if (list2 == null) { list2 = new List <string>(2); } list2.Add(recipient.SmtpAddress()); } } } Dictionary <string, string> dictionary = new Dictionary <string, string> { { "IsClutter", value3 }, { "DeliveredToInbox", flag ? bool.TrueString : bool.FalseString }, { "DeliveredToClutter", flag2 ? bool.TrueString : bool.FalseString }, { "IsGroupEscalationMessage", value4 }, { "InternetMessageId", value }, { "ConversationId", (conversationId == null) ? string.Empty : conversationId.ToString() }, { "MessageGuid", value5 }, { "SenderSmtpAddress", value2 } }; if (list != null && list.Count > 0) { dictionary.Add("DLRecipients", string.Join(";", list)); } if (list2 != null) { dictionary.Add("GMRecipients", string.Join(";", list2)); } if (flag5) { Dictionary <string, string> dictionary2 = dictionary; string key = "DeliveredFolderType"; int num = (int)defaultFolderType; dictionary2.Add(key, num.ToString()); if (defaultFolderType == DefaultFolderType.None && parentId != null) { dictionary.Add("DeliveredFolderId", parentId.ToString()); } } customProperties = dictionary; }, null); return(customProperties); }
// Token: 0x06000114 RID: 276 RVA: 0x00006EAC File Offset: 0x000050AC private static void HandleSmsMessage(MailboxSession session, Item item, MailboxData mailboxData, ConversationIndexTrackingEx indexTrackingEx) { MessageItem messageItem = item as MessageItem; if (messageItem == null) { SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: the SMS message is not MessageItem", new object[] { TraceContext.Get() }); return; } RecipientCollection recipients = messageItem.Recipients; if (recipients.Count == 0) { return; } using (SmsRecipientInfoCache smsRecipientInfoCache = SmsRecipientInfoCache.Create(session, SentItemsProcessor.Tracer)) { Dictionary <ConversationIndex, Recipient> dictionary = new Dictionary <ConversationIndex, Recipient>(recipients.Count); for (int i = recipients.Count - 1; i >= 0; i--) { Recipient recipient = recipients[i]; Participant participant = recipient.Participant; if (!(participant == null) && !string.IsNullOrEmpty(participant.EmailAddress)) { string text = null; if (string.Equals(participant.RoutingType, "MOBILE", StringComparison.OrdinalIgnoreCase)) { text = participant.EmailAddress; smsRecipientInfoCache.AddRecipient(participant); } else if (string.Equals(participant.RoutingType, "SMTP", StringComparison.OrdinalIgnoreCase)) { ProxyAddress proxyAddress; if (SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress) && string.Equals(proxyAddress.PrefixString, "MOBILE", StringComparison.OrdinalIgnoreCase)) { text = proxyAddress.AddressString; } smsRecipientInfoCache.AddRecipient(new Participant(participant.DisplayName, text, "MOBILE")); } if (text != null) { ConversationIndex conversationIndex = ConversationIndex.GenerateFromPhoneNumber(text); if (!(conversationIndex == ConversationIndex.Empty)) { recipients.RemoveAt(i); if (!dictionary.ContainsKey(conversationIndex)) { dictionary.Add(conversationIndex, recipient); } } } } } if (recipients.Count > 0) { messageItem.Save(SaveMode.ResolveConflicts); messageItem.Load(); } int num = 0; foreach (KeyValuePair <ConversationIndex, Recipient> keyValuePair in dictionary) { num++; AggregationBySmsItemClassProcessor.ChunkSmsConversation(XSOFactory.Default, session, keyValuePair.Key, indexTrackingEx); if (num < dictionary.Count || recipients.Count > 0) { SentItemsProcessor.CloneSmsItem(session, messageItem, mailboxData, keyValuePair.Value, keyValuePair.Key); } else { recipients.Add(keyValuePair.Value); SentItemsProcessor.SaveSmsItem(messageItem, keyValuePair.Key); messageItem.Load(); } } smsRecipientInfoCache.Commit(); } }
public void OnPromotedMessageHandler(StoreDriverEventSource source, StoreDriverDeliveryEventArgs args) { ConversationsProcessingAgent.tracer.TraceDebug(0L, "Called ConversationsProcessingAgent.OnPromotedMessageHandler"); if (args == null) { return; } StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args; if (ConversationsProcessingAgent.ShouldSkipMessageProcessing(storeDriverDeliveryEventArgsImpl)) { return; } if (storeDriverDeliveryEventArgsImpl.MailboxOwner == null) { return; } MailboxSession mailboxSession = storeDriverDeliveryEventArgsImpl.MailboxSession; if (mailboxSession.MailboxOwner.MailboxInfo.Location.ServerVersion <= 1937801369) { if (ConversationsProcessingAgent.tracer.IsTraceEnabled(TraceType.DebugTrace)) { ConversationsProcessingAgent.tracer.TraceDebug <string, string>((long)this.GetHashCode(), "Backend server version (0x{0}) is less than minimum required (0x{1})", mailboxSession.MailboxOwner.MailboxInfo.Location.ServerVersion.ToString("X"), 1937801369.ToString("X")); } return; } ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Processing incoming message"); Stopwatch stopwatch = Stopwatch.StartNew(); try { if (storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies == null) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies = new Dictionary <PropertyDefinition, object>(); } ConversationIndexTrackingEx conversationIndexTrackingEx = ConversationIndexTrackingEx.Create(); this.performanceContext = ConversationsProcessingAgent.conversationLatencyDetectionContextFactory.CreateContext("15.00.1497.012", "FIXUP", new IPerformanceDataProvider[0]); if (!this.isBodyTagCalculated) { ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Calculating body tag"); Stopwatch stopwatch2 = Stopwatch.StartNew(); if (storeDriverDeliveryEventArgsImpl.ReplayItem.IsRestricted) { if (!this.TryCalculateIrmBodyTag(storeDriverDeliveryEventArgsImpl)) { this.bodyTag = null; } } else if (PropertyError.IsPropertyNotFound(storeDriverDeliveryEventArgsImpl.ReplayItem.TryGetProperty(ItemSchema.BodyTag))) { this.bodyTag = storeDriverDeliveryEventArgsImpl.ReplayItem.Body.CalculateBodyTag(out this.latestMessageWordCount); } else { this.bodyTag = storeDriverDeliveryEventArgsImpl.ReplayItem.GetValueOrDefault <byte[]>(ItemSchema.BodyTag); this.latestMessageWordCount = storeDriverDeliveryEventArgsImpl.ReplayItem.GetValueOrDefault <int>(MessageItemSchema.LatestMessageWordCount, int.MinValue); } stopwatch2.Stop(); conversationIndexTrackingEx.Trace("BT", stopwatch2.ElapsedMilliseconds.ToString()); this.isBodyTagCalculated = true; } if (this.bodyTag != null) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.BodyTag] = this.bodyTag; if (this.latestMessageWordCount >= 0) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[MessageItemSchema.LatestMessageWordCount] = this.latestMessageWordCount; storeDriverDeliveryEventArgsImpl.ReplayItem.SafeSetProperty(MessageItemSchema.LatestMessageWordCount, this.latestMessageWordCount); } } if (this.forceAllAttachmentsHidden) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[MessageItemSchema.AllAttachmentsHidden] = true; } if (!ConversationIndex.CompareTopics(storeDriverDeliveryEventArgsImpl.ReplayItem.TryGetProperty(ItemSchema.ConversationTopic) as string, storeDriverDeliveryEventArgsImpl.ReplayItem.TryGetProperty(ItemSchema.NormalizedSubject) as string)) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationTopic] = ((storeDriverDeliveryEventArgsImpl.ReplayItem.TryGetProperty(ItemSchema.NormalizedSubject) as string) ?? string.Empty); } if (!storeDriverDeliveryEventArgsImpl.MessageClass.Equals("IPM.WorkingSet.Signal", StringComparison.InvariantCulture)) { ConversationAggregationResult conversationAggregationResult = new ConversationAggregationResult(); ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Fixing up the conversation id"); try { IConversationAggregator conversationAggregator; if (ConversationAggregatorFactory.TryInstantiateAggregatorForDelivery(mailboxSession, storeDriverDeliveryEventArgsImpl.MailboxOwner, conversationIndexTrackingEx, out conversationAggregator)) { conversationAggregationResult = conversationAggregator.Aggregate(storeDriverDeliveryEventArgsImpl.ReplayItem.CoreItem); } else { ConversationsProcessingAgent.tracer.TraceError((long)this.GetHashCode(), "Not able to identify a valid conversationAggregator"); conversationAggregationResult.ConversationIndex = ConversationIndex.CreateNew(); conversationAggregationResult.Stage = ConversationIndex.FixupStage.Error; } } catch (ObjectNotFoundException arg) { ConversationsProcessingAgent.tracer.TraceError <ObjectNotFoundException>((long)this.GetHashCode(), "Exception - {0}", arg); conversationAggregationResult.ConversationIndex = ConversationIndex.CreateNew(); conversationAggregationResult.Stage = ConversationIndex.FixupStage.Error; } this.performanceContext.StopAndFinalizeCollection(); conversationIndexTrackingEx.Trace("FIXUP", this.performanceContext.Elapsed.TotalMilliseconds.ToString()); ConversationsProcessingAgent.tracer.TraceDebug <int>((long)this.GetHashCode(), "FixupStage = {0}", (int)conversationAggregationResult.Stage); ConversationId conversationId = ConversationId.Create(conversationAggregationResult.ConversationIndex); ConversationsProcessingAgent.tracer.TraceDebug <ConversationId>((long)this.GetHashCode(), "ConversationId (CID) for item: {0}", conversationId); storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationIndex] = conversationAggregationResult.ConversationIndex.ToByteArray(); storeDriverDeliveryEventArgsImpl.ReplayItem.SafeSetProperty(ItemSchema.ConversationIndex, storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationIndex]); storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationFamilyId] = conversationAggregationResult.ConversationFamilyId; storeDriverDeliveryEventArgsImpl.ReplayItem.SafeSetProperty(ItemSchema.ConversationFamilyId, storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationFamilyId]); storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.SupportsSideConversation] = conversationAggregationResult.SupportsSideConversation; storeDriverDeliveryEventArgsImpl.ReplayItem.SafeSetProperty(ItemSchema.SupportsSideConversation, storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.SupportsSideConversation]); byte[] value; if (this.TryCalculateConversationCreatorSid(mailboxSession, storeDriverDeliveryEventArgsImpl.MailboxOwner, conversationAggregationResult, storeDriverDeliveryEventArgsImpl.ReplayItem.PropertyBag, out value)) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationCreatorSID] = value; storeDriverDeliveryEventArgsImpl.ReplayItem.SafeSetProperty(ItemSchema.ConversationCreatorSID, storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationCreatorSID]); } conversationIndexTrackingEx.TraceVersionAndHeuristics(conversationAggregationResult.Stage.ToString()); storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationIndexTrackingEx] = conversationIndexTrackingEx.ToString(); if (conversationAggregationResult.Stage != ConversationIndex.FixupStage.L1) { storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationIndexTracking] = true; storeDriverDeliveryEventArgsImpl.ReplayItem.SafeSetProperty(ItemSchema.ConversationIndexTracking, storeDriverDeliveryEventArgsImpl.PropertiesForAllMessageCopies[ItemSchema.ConversationIndexTracking]); } ConversationsProcessingAgent.tracer.TraceDebug <ConversationIndexTrackingEx>((long)this.GetHashCode(), "Time Spent in different stages - {0}", conversationIndexTrackingEx); ConversationsProcessingAgent.tracer.TraceDebug((long)this.GetHashCode(), "Processing conversation actions"); if (!ConversationIndex.IsFixUpCreatingNewConversation(conversationAggregationResult.Stage)) { this.ProcessConversationActions(conversationId, storeDriverDeliveryEventArgsImpl); } if (ConversationIndex.IsFixupAddingOutOfOrderMessageToConversation(conversationAggregationResult.Stage)) { if (storeDriverDeliveryEventArgsImpl.SharedPropertiesBetweenAgents == null) { storeDriverDeliveryEventArgsImpl.SharedPropertiesBetweenAgents = new Dictionary <PropertyDefinition, object>(); } storeDriverDeliveryEventArgsImpl.SharedPropertiesBetweenAgents[ItemSchema.ConversationLoadRequiredByInference] = true; } } } finally { stopwatch.Stop(); MSExchangeConversationsProcessing.LastMessageProcessingTime.RawValue = stopwatch.ElapsedMilliseconds; ConversationsProcessingAgent.averageMessageProcessingTime.Update(stopwatch.ElapsedMilliseconds); ConversationsProcessingAgent.tracer.TraceDebug <long>((long)this.GetHashCode(), "Exiting ConversationsProcessing.ProcessMessage. Total execution time = {0} ms.", stopwatch.ElapsedMilliseconds); } }
public bool FirstTimeSync(Dictionary <ISyncItemId, FolderSync.ClientStateInformation> clientManifest, FirstTimeSyncWatermark minWatermark, QueryFilter filter, int numOperations, Dictionary <ISyncItemId, ServerManifestEntry> newServerManifest) { ExDateTime receivedDateUtc = minWatermark.ReceivedDateUtc; if (numOperations < 0 && numOperations != -1) { throw new ArgumentException("numOperations is not valid, value = " + numOperations); } AirSyncDiagnostics.TraceInfo <int, QueryFilter>(ExTraceGlobals.SyncProcessTracer, this, "FirstTimeSyncProvider.FirstTimeSync. numOperations = {0} filter = {1}", numOperations, filter); ExDateTime? filterTypeBoundary = this.GetFilterTypeBoundary(filter); MailboxSyncPropertyBag mailboxSyncPropertyBag = new MailboxSyncPropertyBag(FirstTimeSyncProvider.newQueryProps); if (filter != null) { mailboxSyncPropertyBag.AddColumnsFromFilter(filter); } int num; using (QueryResult positionedQueryResult = this.GetPositionedQueryResult(minWatermark, filterTypeBoundary, mailboxSyncPropertyBag.Columns, out num)) { bool flag = false; while (!flag) { if (newServerManifest.Count >= numOperations && numOperations > 0) { return(!flag); } int num2; if (numOperations == -1) { num2 = 10000; } else { int num3 = numOperations - newServerManifest.Count; num2 = num3 + 1; } if (num2 < 0) { throw new InvalidOperationException(ServerStrings.ExNumberOfRowsToFetchInvalid(num2.ToString())); } bool flag2 = false; if (num >= 0 && num < num2) { AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvier.FirstTimeSync] Limiting rows to fetch based on end filter. Original value: {0}, Filter Based Value: {1}", num2, num + 1); num2 = num; flag2 = true; } if (num2 <= 0) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] No more rows to fetch. Bailing out."); flag = true; return(false); } AirSyncDiagnostics.TraceInfo <int>(ExTraceGlobals.SyncProcessTracer, this, "FirstTimeSyncProvider.FirstTimeSync. Asking queryResult for {0} rows", num2); IStorePropertyBag[] propertyBags = positionedQueryResult.GetPropertyBags(num2); AirSyncDiagnostics.TraceInfo <int>(ExTraceGlobals.SyncProcessTracer, this, "FirstTimeSyncProvider.FirstTimeSync. Retrieved {0} rows", propertyBags.Length); if (num > -1) { num -= propertyBags.Length; } flag = (propertyBags.Length == 0 || (flag2 && num == 0)); if (propertyBags.Length < num2) { flag |= (positionedQueryResult.CurrentRow == positionedQueryResult.EstimatedRowCount); } for (int i = 0; i < propertyBags.Length; i++) { VersionedId versionedId = null; IStorePropertyBag storePropertyBag = propertyBags[i]; try { if (numOperations != -1 && newServerManifest.Count >= numOperations) { return(true); } if (!this.TryGetPropertyFromBag <VersionedId>(storePropertyBag, ItemSchema.Id, out versionedId)) { AirSyncDiagnostics.TraceError(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] Could not get versioned Id from property bag. Skipping item."); } else { ExDateTime exDateTime; bool flag3 = this.TryGetPropertyFromBag <ExDateTime>(storePropertyBag, ItemSchema.ReceivedTime, out exDateTime); if (!flag3 && filterTypeBoundary != null) { AirSyncDiagnostics.TraceDebug <string, string>(ExTraceGlobals.SyncProcessTracer, this, "FirstTimeSyncProvider.FirstTimeSync. Found item with missing/corrupt DateTimeReceived. Bailing out of FirstTimeSync mode. Mailbox: {0} ItemId: {1}", this.folder.Session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), versionedId.ObjectId.ToBase64String()); flag = true; return(false); } ExDateTime value = exDateTime; if (!flag3 && !this.TryGetPropertyFromBag <ExDateTime>(storePropertyBag, StoreObjectSchema.CreationTime, out value)) { AirSyncDiagnostics.TraceDebug <string, string>(ExTraceGlobals.SyncProcessTracer, this, "FirstTimeSyncProvider.FirstTimeSync. Found item with missing/corrupt CreationDate. Will use DateTime.MinValue instead. Mailbox: {0}, ItemId: {1}", this.folder.Session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), versionedId.ObjectId.ToBase64String()); } if (filterTypeBoundary != null && exDateTime < filterTypeBoundary) { AirSyncDiagnostics.TraceDebug <ExDateTime>(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] Passed our sync cutoff date of {0}. All rows fetched.", filterTypeBoundary.Value); flag = true; return(false); } int num4; if (!this.TryGetPropertyFromBag <int>(storePropertyBag, ItemSchema.ArticleId, out num4)) { AirSyncDiagnostics.TraceDebug <VersionedId>(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] Unable to get articleId from property bag item. Id: {0}", versionedId); } else { ISyncItemId syncItemId = MailboxSyncItemId.CreateForNewItem(versionedId.ObjectId); FolderSync.ClientStateInformation clientStateInformation; if (clientManifest != null && clientManifest.TryGetValue(syncItemId, out clientStateInformation) && clientStateInformation.ClientHasItem) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] Skipping item {0} because it is already in client manifest.", syncItemId.NativeId.ToString()); minWatermark.ChangeNumber = num4; minWatermark.ReceivedDateUtc = exDateTime; } else if (filter != null && !EvaluatableFilter.Evaluate(filter, storePropertyBag)) { AirSyncDiagnostics.TraceInfo <StoreObjectId, ExDateTime, int>(ExTraceGlobals.SyncTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] Dropping item '{0}' because it failed to match our filter. ReceivedDateUtc: {1}, ChangeNumber: {2}", versionedId.ObjectId, exDateTime, num4); minWatermark.ChangeNumber = num4; minWatermark.ReceivedDateUtc = exDateTime; } else { bool read; if (!this.TryGetPropertyFromBag <bool>(storePropertyBag, MessageItemSchema.IsRead, out read)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.SyncProcessTracer, this, "[FirstTimeSyncProvider.FirstTimeSync] Unabled to get read flag from property bag. Default to false."); read = false; } MailboxSyncWatermark mailboxSyncWatermark = MailboxSyncWatermark.Create(); mailboxSyncWatermark.UpdateWithChangeNumber(num4, read); AirSyncDiagnostics.TraceInfo(ExTraceGlobals.SyncTracer, this, "FirstTimeSyncProvider.FirstTimeSync. Adding Sync'd item {0} to manifest", new object[] { syncItemId.NativeId }); ServerManifestEntry serverManifestEntry = base.CreateItemChangeManifestEntry(syncItemId, mailboxSyncWatermark); ConversationId conversationId = null; if (this.TryGetPropertyFromBag <ConversationId>(storePropertyBag, ItemSchema.ConversationId, out conversationId)) { serverManifestEntry.ConversationId = conversationId; } byte[] bytes; ConversationIndex index; if (this.TryGetPropertyFromBag <byte[]>(storePropertyBag, ItemSchema.ConversationIndex, out bytes) && ConversationIndex.TryCreate(bytes, out index) && index != ConversationIndex.Empty && index.Components != null && index.Components.Count == 1) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.SyncTracer, this, "FirstTimeSyncProvider.FirstTimeSync. First message in conversation.", new object[] { syncItemId.NativeId }); serverManifestEntry.FirstMessageInConversation = true; } serverManifestEntry.FilterDate = new ExDateTime?(value); string text; if (this.TryGetPropertyFromBag <string>(storePropertyBag, StoreObjectSchema.ItemClass, out text)) { serverManifestEntry.MessageClass = (storePropertyBag[StoreObjectSchema.ItemClass] as string); } newServerManifest[serverManifestEntry.Id] = serverManifestEntry; minWatermark.ChangeNumber = num4; minWatermark.ReceivedDateUtc = exDateTime; } } } } catch (Exception arg) { AirSyncDiagnostics.TraceError <string, Exception>(ExTraceGlobals.SyncTracer, this, "FirstTimeSyncProvider.FirstTimeSync. Caught exception processing item: {0}. Exception: {1}", (versionedId == null) ? "<NULL>" : versionedId.ToBase64String(), arg); throw; } } } } return(false); }
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 SearchByTopic(IXSOFactory xsoFactory, IMailboxSession session, ICorePropertyBag persistPropertyBag, ConversationIndexTrackingEx indexTrackingEx, out IStorePropertyBag foundPropertyBag, out bool didConversationIdMatch, out bool didReferencesMatch, params PropertyDefinition[] propsToReturn) { foundPropertyBag = null; didConversationIdMatch = false; didReferencesMatch = false; Util.ThrowOnNullArgument(session, "session"); Util.ThrowOnNullArgument(persistPropertyBag, "persistPropertyBag"); Util.ThrowOnNullArgument(propsToReturn, "propsToReturn"); ICollection <PropertyDefinition> properties = InternalSchema.Combine <PropertyDefinition>(propsToReturn, new PropertyDefinition[] { ItemSchema.ConversationTopicHash }); string incomingConversationTopic = persistPropertyBag.GetValueOrDefault <string>(ItemSchema.ConversationTopic); ConversationIndex conversationIndex; bool isValidIncomingIndex = ConversationIndex.TryCreate(persistPropertyBag.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex); ConversationId incomingConversationId = isValidIncomingIndex ? ConversationId.Create(conversationIndex.Guid) : null; if (incomingConversationTopic == null) { return(false); } bool didConversationIdMatchLocal = false; bool didReferencesMatchLocal = false; int incomingConversationTopicHash = (int)AllItemsFolderHelper.GetHashValue(incomingConversationTopic); Stopwatch stopwatch = Stopwatch.StartNew(); IStorePropertyBag storePropertyBag = xsoFactory.RunQueryOnAllItemsFolder <IStorePropertyBag>(session, AllItemsFolderHelper.SupportedSortBy.ConversationTopicHash, incomingConversationTopicHash, null, delegate(QueryResult queryResult) { bool flag = queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ConversationTopicHash, incomingConversationTopicHash)); if (flag) { IStorePropertyBag storePropertyBag2 = null; for (int i = 0; i < 5; i++) { IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(1); if (propertyBags.Length != 1) { break; } int?num = propertyBags[0].TryGetProperty(ItemSchema.ConversationTopicHash) as int?; if (num == null || num.Value != incomingConversationTopicHash) { break; } string foundTopic = propertyBags[0].TryGetProperty(ItemSchema.ConversationTopic) as string; if (ConversationIndex.CompareTopics(incomingConversationTopic, foundTopic)) { if (storePropertyBag2 == null) { storePropertyBag2 = propertyBags[0]; } ConversationIndex conversationIndex2; bool flag2 = ConversationIndex.TryCreate(propertyBags[0].TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex2); if (flag2) { if (isValidIncomingIndex) { ConversationId conversationId = ConversationId.Create(conversationIndex2.Guid); if (conversationId.Equals(incomingConversationId)) { didConversationIdMatchLocal = true; return(propertyBags[0]); } } else if (AggregationByItemClassReferencesSubjectProcessor.MatchMessageIdWithReferences(persistPropertyBag, propertyBags[0])) { didReferencesMatchLocal = true; return(propertyBags[0]); } } } if (!queryResult.SeekToCondition(SeekReference.OriginCurrent, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ConversationTopicHash, incomingConversationTopicHash))) { break; } } if (storePropertyBag2 != null) { return(storePropertyBag2); } } return(null); }, properties); stopwatch.Stop(); if (indexTrackingEx != null) { indexTrackingEx.Trace("SBT", stopwatch.ElapsedMilliseconds.ToString()); } if (storePropertyBag != null) { foundPropertyBag = storePropertyBag; didConversationIdMatch = didConversationIdMatchLocal; didReferencesMatch = didReferencesMatchLocal; return(true); } return(false); }
// Token: 0x06000C14 RID: 3092 RVA: 0x0004EBBC File Offset: 0x0004CDBC private void SendExpiryOrUpdateMessage(MessageItem initiationMessage, MailboxSession session, string decisionMakerAddress, ApprovalStatus status, ExDateTime handledTime) { if (status != ApprovalStatus.Expired && status != ApprovalStatus.Approved && status != ApprovalStatus.Rejected) { throw new ArgumentException("Unexpected status"); } StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Outbox); using (MessageItem messageItem = MessageItem.Create(session, defaultFolderId)) { messageItem.ClassName = "IPM.Note.Microsoft.Approval.Request.Recall"; string valueOrDefault = initiationMessage.GetValueOrDefault <string>(MessageItemSchema.ApprovalAllowedDecisionMakers); if (string.IsNullOrEmpty(valueOrDefault)) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "No list of decisionmakers. No updates"); } else { string valueOrDefault2 = initiationMessage.GetValueOrDefault <string>(MessageItemSchema.ApprovalRequestMessageId); if (string.IsNullOrEmpty(valueOrDefault2)) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "The approval request message id is not found."); } else { Participant valueOrDefault3 = initiationMessage.GetValueOrDefault <Participant>(MessageItemSchema.ReceivedBy); if (valueOrDefault3 == null) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "Cannot get the arbitration mailbox information."); } else { messageItem.Sender = valueOrDefault3; RoutingAddress[] routingAddresses; if (!ApprovalUtils.TryGetDecisionMakers(valueOrDefault, out routingAddresses)) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "initiation message has invalid decision makers."); } else { IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, session.GetADSessionSettings(), 555, "SendExpiryOrUpdateMessage", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\Approval\\ApprovalAssistant.cs"); string text; RoutingAddress[] array = this.FilterByServerVersionAndLookupDisplayName(routingAddresses, tenantOrRootOrgRecipientSession, decisionMakerAddress, out text); if (array.Length == 0) { ApprovalAssistant.GeneralTracer.TraceDebug((long)this.GetHashCode(), "There is no E14 or later moderator in the list."); } else { foreach (RoutingAddress address in array) { Participant participant = new Participant(string.Empty, (string)address, "SMTP"); messageItem.Recipients.Add(participant, RecipientItemType.To); } messageItem[MessageItemSchema.ApprovalDecisionTime] = handledTime; messageItem[MessageItemSchema.ApprovalRequestMessageId] = valueOrDefault2; messageItem[MessageItemSchema.IsNonDeliveryReceiptRequested] = false; messageItem[MessageItemSchema.IsDeliveryReceiptRequested] = false; byte[] conversationIndex = initiationMessage.ConversationIndex; messageItem.ConversationIndex = ConversationIndex.CreateFromParent(conversationIndex).ToByteArray(); messageItem[ItemSchema.NormalizedSubject] = initiationMessage.ConversationTopic; DsnHumanReadableWriter defaultDsnHumanReadableWriter = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter; ApprovalInformation approvalInformation; if (status != ApprovalStatus.Expired) { if (string.IsNullOrEmpty(text)) { text = decisionMakerAddress; } messageItem[MessageItemSchema.ApprovalDecision] = ((status == ApprovalStatus.Approved) ? 1 : 2); messageItem[MessageItemSchema.ApprovalDecisionMaker] = text; bool?decision = new bool?(status == ApprovalStatus.Approved); approvalInformation = defaultDsnHumanReadableWriter.GetDecisionUpdateInformation(initiationMessage.Subject, text, decision, new ExDateTime?(handledTime)); } else { messageItem[MessageItemSchema.ApprovalDecision] = 0; approvalInformation = defaultDsnHumanReadableWriter.GetApprovalRequestExpiryInformation(initiationMessage.Subject); } messageItem.Subject = approvalInformation.Subject; BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, approvalInformation.MessageCharset.Name); using (Stream stream = messageItem.Body.OpenWriteStream(configuration)) { defaultDsnHumanReadableWriter.WriteHtmlModerationBody(stream, approvalInformation); stream.Flush(); } messageItem.SendWithoutSavingMessage(); } } } } } } }
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)); }
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); }
public void UpdateConversationMessages(ConversationIndex conversationIndex, byte[] conversationCreatorSid) { ConversationCreatorHelper.FixupConversationMessagesCreatorSid(this.mailboxSession as MailboxSession, conversationIndex, conversationCreatorSid); }
public bool TryCalculateOnReply(ConversationIndex conversationIndex, out byte[] conversationCreatorSid) { return(ConversationCreatorHelper.TryCalculateConversationCreatorSidOnReplying(this.mailboxSession as MailboxSession, conversationIndex, out conversationCreatorSid)); }
protected abstract ConversationAggregationResult ConstructResult(ConversationIndex.FixupStage bySubjectResultingStage, ConversationIndex bySubjectResultingIndex, IStorePropertyBag parentItem, bool participantRemoved);
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); }
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); }
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); }
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 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; } }