public override ICollection <Node> GetPathToLeaf(string leafId) { this.deprioritizeHa = false; ICollection <Node> pathToLeaf = base.GetPathToLeaf(leafId); if (pathToLeaf.Count == 0) { return(pathToLeaf); } MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)pathToLeaf.Last <Node>().Value; if (messageTrackingLogEntry.EventId != MessageTrackingEvent.HAREDIRECT) { return(pathToLeaf); } this.deprioritizeHa = true; ICollection <Node> pathToLeaf2 = base.GetPathToLeaf(leafId); if (pathToLeaf2.Count == 0) { MessageTrackingLogEntry messageTrackingLogEntry2 = (MessageTrackingLogEntry)pathToLeaf2.Last <Node>().Value; if (messageTrackingLogEntry2 != messageTrackingLogEntry) { pathToLeaf2.Add(pathToLeaf.Last <Node>()); } } return(pathToLeaf2); }
private static bool TryEnqueueNextHopAfterHAResubmit(MessageTrackingLogEntry haResubmitEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { if (haResubmitEvent.Source != MessageTrackingSource.REDUNDANCY) { return(false); } ServerInfo server = ServerCache.Instance.FindMailboxOrHubServer(haResubmitEvent.Server, 32UL); if (LogDataAnalyzer.ShouldSkipTracker(server, haResubmitEvent, context)) { return(false); } ILogReader logReader = RpcLogReader.GetLogReader(haResubmitEvent.Server, context.DirectoryContext); if (logReader == null) { return(false); } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, haResubmitEvent.MessageId, haResubmitEvent.InternalMessageId); List <MessageTrackingLogEntry> list = messageLog.FindAll((MessageTrackingLogEntry entry) => entry.Source != MessageTrackingSource.REDUNDANCY); if (list.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceError <string, long>(0, "Could not find any events following resubmission matching MessageId={0}, and InternalId={1}.", haResubmitEvent.MessageId, haResubmitEvent.InternalMessageId); return(false); } MailItemTracker item = new MailItemTracker(list, context.Tree); remainingTrackers.Enqueue(item); return(true); }
public List <List <MessageTrackingLogEntry> > GetHandedOffRecipPaths() { EventTree tree = this.context.Tree; ICollection <Node> leafNodes = tree.GetLeafNodes(); if (leafNodes == null || leafNodes.Count == 0) { return(null); } List <List <MessageTrackingLogEntry> > list = null; foreach (Node node in leafNodes) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)node.Value; if ((messageTrackingLogEntry.EventId == MessageTrackingEvent.SEND && messageTrackingLogEntry.Source == MessageTrackingSource.SMTP) || (messageTrackingLogEntry.EventId == MessageTrackingEvent.EXPAND && messageTrackingLogEntry.FederatedDeliveryAddress != null) || messageTrackingLogEntry.EventId == MessageTrackingEvent.INITMESSAGECREATED) { ICollection <Node> pathToLeaf = tree.GetPathToLeaf(node.Key); List <MessageTrackingLogEntry> list2 = new List <MessageTrackingLogEntry>(pathToLeaf.Count); foreach (Node node2 in pathToLeaf) { MessageTrackingLogEntry messageTrackingLogEntry2 = (MessageTrackingLogEntry)node2.Value; messageTrackingLogEntry2.RecipientAddress = node2.Key; list2.Add(messageTrackingLogEntry2); } if (list == null) { list = new List <List <MessageTrackingLogEntry> >(); } list.Add(list2); } } return(list); }
protected override int GetNodePriorities(Node node, out int secondaryPriority) { MessageTrackingLogEntry logEntry = (MessageTrackingLogEntry)node.Value; secondaryPriority = EventTree.GetSecondaryPriority(node, true); return(EventTree.GetEventPriorityForBestResultLeaf(logEntry, this.deprioritizeHa)); }
private static long GetCheckReceiveEventAfterModerationApproval(List <MessageTrackingLogEntry> possibleReceiveMatches, TrackingContext context, ILogReader reader) { MessageTrackingLogEntry messageTrackingLogEntry = possibleReceiveMatches[possibleReceiveMatches.Count - 1]; foreach (MessageTrackingLogEntry messageTrackingLogEntry2 in possibleReceiveMatches) { if (messageTrackingLogEntry2.ProcessedBy == null) { messageTrackingLogEntry = messageTrackingLogEntry2; break; } } long serverLogKeyMailItemId = messageTrackingLogEntry.ServerLogKeyMailItemId; List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, reader, TrackingLogPrefix.MSGTRK, messageTrackingLogEntry.MessageId, serverLogKeyMailItemId); if (messageLog.Count != 0) { if (!messageLog.TrueForAll((MessageTrackingLogEntry receiveEntry) => receiveEntry.Source != MessageTrackingSource.APPROVAL)) { TraceWrapper.SearchLibraryTracer.TraceDebug <string, long>(0, "Last Receive event for message {0} InternalMessageId {1} doesn't indicate resubmission after approval because contains APPROVAL event in the path.", messageTrackingLogEntry.MessageId, serverLogKeyMailItemId); return(0L); } } return(serverLogKeyMailItemId); }
private static bool TryEnqueueNextHopAfterTransfer(MessageTrackingLogEntry transferEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { ServerInfo server = ServerCache.Instance.FindMailboxOrHubServer(transferEvent.Server, 32UL); if (LogDataAnalyzer.ShouldSkipTracker(server, transferEvent, context)) { return(false); } ILogReader logReader = RpcLogReader.GetLogReader(transferEvent.Server, context.DirectoryContext); if (logReader == null) { return(false); } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, transferEvent.MessageId, transferEvent.InternalMessageId); if (messageLog.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceError <string, long>(0, "Could not find any events matching MessageId={0}, and InternalId={1}.", transferEvent.MessageId, transferEvent.ServerLogKeyMailItemId); return(false); } MailItemTracker item = new MailItemTracker(messageLog, context.Tree); remainingTrackers.Enqueue(item); return(true); }
private static int GetSecondaryPriority(Node node, bool forPathPicking) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)node.Value; bool recipientMatchesRoot = !forPathPicking || string.Equals(node.Key, messageTrackingLogEntry.RootAddress, StringComparison.OrdinalIgnoreCase); return(EventTree.GetSecondaryPriority(messageTrackingLogEntry.BccRecipient == null || messageTrackingLogEntry.BccRecipient.Value, messageTrackingLogEntry.HiddenRecipient, recipientMatchesRoot)); }
private int LogEntryComparer(MessageTrackingLogEntry left, MessageTrackingLogEntry right) { if (left == null) { if (right == null) { return(0); } return(1); } else { if (right == null) { return(-1); } if ((MailItemTracker.InitialSubmitEvents.Contains(left.EventId) && !MailItemTracker.InitialSubmitEvents.Contains(right.EventId)) || (!MailItemTracker.TerminalDeliveryEvents.Contains(left.EventId) && MailItemTracker.TerminalDeliveryEvents.Contains(right.EventId))) { return(-1); } if ((MailItemTracker.InitialSubmitEvents.Contains(right.EventId) && !MailItemTracker.InitialSubmitEvents.Contains(left.EventId)) || (!MailItemTracker.TerminalDeliveryEvents.Contains(right.EventId) && MailItemTracker.TerminalDeliveryEvents.Contains(left.EventId))) { return(1); } if (left.EventId == MessageTrackingEvent.TRANSFER && right.EventId == MessageTrackingEvent.EXPAND) { return(1); } if (left.EventId == MessageTrackingEvent.EXPAND && right.EventId == MessageTrackingEvent.TRANSFER) { return(-1); } return(left.Time.CompareTo(right.Time)); } }
private bool ShouldSkipEvent(MessageTrackingLogEntry entry) { if (this.tree == entry.ProcessedBy) { return(true); } string text = entry.SourceContext; if (!string.IsNullOrEmpty(text)) { text = text.Trim(); } if ("Federated Delivery Encryption Agent".Equals(text, StringComparison.OrdinalIgnoreCase) && entry.EventId == MessageTrackingEvent.DEFER) { return(true); } if (entry.EventId == MessageTrackingEvent.REDIRECT && MessageTrackingSource.AGENT == entry.Source) { string relatedRecipientAddress = entry.RelatedRecipientAddress; if (string.IsNullOrEmpty(relatedRecipientAddress) || !SmtpAddress.IsValidSmtpAddress(relatedRecipientAddress)) { TraceWrapper.SearchLibraryTracer.TraceDebug <string>(this.GetHashCode(), "Ignoring REDIRECT event with non-SMTP RelatedRecipientAddress: {0}. Probably EHF agent.", relatedRecipientAddress); return(true); } } return(false); }
private void SetPerRecipientProperties(Node newNode, int recipIndex, bool entryIsStoreDriverReceiveEvent, bool entryIsAgentReceiveEvent) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)newNode.Value; if (messageTrackingLogEntry.RecipientStatuses != null && messageTrackingLogEntry.RecipientStatuses.Length > recipIndex) { messageTrackingLogEntry.RecipientStatus = messageTrackingLogEntry.RecipientStatuses[recipIndex]; } if (!entryIsStoreDriverReceiveEvent) { if (entryIsAgentReceiveEvent) { this.SetHideRecipientAndBccPropertiesForAgentEvent(messageTrackingLogEntry); } return; } MimeRecipientType mimeRecipientType; if (!MessageTrackingLogEntry.RecipientAddressTypeGetter.TryGetValue(messageTrackingLogEntry.RecipientStatus, out mimeRecipientType)) { mimeRecipientType = MimeRecipientType.Unknown; } if (mimeRecipientType == MimeRecipientType.Unknown || mimeRecipientType == MimeRecipientType.Bcc) { messageTrackingLogEntry.BccRecipient = new bool?(true); return; } messageTrackingLogEntry.BccRecipient = new bool?(false); }
private static bool TryEnqueueNextHopAfterHARedirect(MessageTrackingLogEntry haRedirectEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { ServerInfo nextHopServer = haRedirectEvent.GetNextHopServer(); if (LogDataAnalyzer.ShouldSkipTracker(nextHopServer, haRedirectEvent, context)) { return(false); } ILogReader logReader = RpcLogReader.GetLogReader(haRedirectEvent.NextHopFqdnOrName, context.DirectoryContext); if (logReader == null) { return(false); } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, haRedirectEvent.MessageId, null, SearchMessageTrackingReportImpl.HAReceiveOrResubmitEventsFilterSet); if (messageLog.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceError <MessageTrackingLogEntry, string>(0, "Could not find any HA receive events to match {0} on {1}.", haRedirectEvent, haRedirectEvent.NextHopFqdnOrName); return(false); } MailItemTracker item = new MailItemTracker(messageLog, context.Tree); remainingTrackers.Enqueue(item); return(true); }
private List <MessageTrackingLogEntry> ReadLogsFromCursor(LogSearchCursor cursor, TrackingEventBudget eventBudget) { List <MessageTrackingLogEntry> list = new List <MessageTrackingLogEntry>(); while (cursor.MoveNext()) { MessageTrackingLogEntry messageTrackingLogEntry; if (MessageTrackingLogEntry.TryCreateFromCursor(cursor, this.server, this.context.Errors, out messageTrackingLogEntry)) { if (list.Count % ServerCache.Instance.RowsBeforeTimeBudgetCheck == 0) { eventBudget.TestDelayOperation("GetRpcsBeforeDelay"); eventBudget.CheckTimeBudget(); } list.Add(messageTrackingLogEntry); if (messageTrackingLogEntry.RecipientAddresses != null) { eventBudget.IncrementBy((uint)messageTrackingLogEntry.RecipientAddresses.Length); } else { eventBudget.IncrementBy(1U); } } } return(list); }
private static bool ShouldSkipTracker(ServerInfo server, MessageTrackingLogEntry logEntry, TrackingContext context) { if (!server.IsSearchable || logEntry.IsNextHopCrossSite(context.DirectoryContext)) { TraceWrapper.SearchLibraryTracer.TraceDebug <string, string>(0, "Skipping search logs on {0}: {1}", logEntry.NextHopFqdnOrName, server.IsSearchable ? "Server is in remote site" : "Server is not searchable"); return(true); } return(false); }
public static bool TryCreateFromCursor(LogSearchCursor cursor, string server, TrackingErrorCollection errors, out MessageTrackingLogEntry entry) { entry = null; MessageTrackingLogRow messageTrackingLogRow; if (MessageTrackingLogRow.TryRead(server, cursor, MessageTrackingLogEntry.allRows, errors, out messageTrackingLogRow)) { entry = new MessageTrackingLogEntry(messageTrackingLogRow); return(true); } return(false); }
private Node FindParentMatchingParameters(MessageTrackingLogEntry childEntryValue, long?mailItemId, MessageTrackingEvent[] eventTypes, EventTree.EventMatchingCondition eventMatchingCondition, MessageTrackingSource?source, LinkedList <Node> possibleParents) { Node node = null; foreach (Node node2 in possibleParents) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)node2.Value; if (messageTrackingLogEntry != childEntryValue && !messageTrackingLogEntry.SharesRowDataWithEntry(childEntryValue) && string.IsNullOrEmpty(messageTrackingLogEntry.FederatedDeliveryAddress)) { if (mailItemId != null) { long num; if (messageTrackingLogEntry.EventId == MessageTrackingEvent.TRANSFER || messageTrackingLogEntry.EventId == MessageTrackingEvent.RESUBMIT) { num = messageTrackingLogEntry.InternalMessageId; } else { num = messageTrackingLogEntry.ServerLogKeyMailItemId; } if (mailItemId != num) { continue; } } if (eventTypes != null) { bool flag = eventMatchingCondition == EventTree.EventMatchingCondition.MustMatch; bool flag2 = !flag; foreach (MessageTrackingEvent messageTrackingEvent in eventTypes) { if (messageTrackingEvent == messageTrackingLogEntry.EventId) { flag2 = flag; break; } } if (!flag2) { continue; } } if ((source == null || source.Value == messageTrackingLogEntry.Source) && (node == null || EventTree.GetSecondaryPriority(node, false) >= EventTree.GetSecondaryPriority(node2, false))) { node = node2; } } } return(node); }
private static int GetEventPriorityForBestResultLeaf(MessageTrackingLogEntry logEntry, bool deprioritizeHa) { int result; bool flag; if (!deprioritizeHa) { flag = EventTree.EventPrioritiesForBestResultLeafHa.TryGetValue(logEntry.EventId, out result); } else { flag = EventTree.EventPrioritiesForBestResultLeaf.TryGetValue(logEntry.EventId, out result); } if (!flag) { return(int.MaxValue); } return(result); }
private static MessageTrackingLogEntry LocateModeratorResponse(MessageTrackingLogEntry initMessageEvent, TrackingContext context, out ILogReader reader) { ServerInfo serverInfo = LogDataAnalyzer.IdentifyArbitrationMailboxServer(initMessageEvent.ArbitrationMailboxAddress, context.DirectoryContext); if (serverInfo.ServerSiteId.Equals(ServerCache.Instance.GetLocalServerSiteId(context.DirectoryContext))) { reader = null; return(null); } if (serverInfo.AdminDisplayVersion.ToInt() > Constants.E14SP1ModerationReferralSupportVersion) { IEnumerable <ServerInfo> casServers = ServerCache.Instance.GetCasServers(serverInfo.ServerSiteId); foreach (ServerInfo serverInfo2 in casServers) { if (serverInfo2.AdminDisplayVersion.ToInt() > Constants.E14SP1ModerationReferralSupportVersion) { TraceWrapper.SearchLibraryTracer.TraceError <ADObjectId>(0, "Cas in site {0} can handle x-site moderation init message referral. Init message will be handled as a referral later.", serverInfo.ServerSiteId); reader = null; return(null); } } } if (!serverInfo.IsSearchable) { TraceWrapper.SearchLibraryTracer.TraceError <string, ServerStatus>(0, "Could not search mailbox server for arbitration mailbox {0}: {1}.", serverInfo.Key, serverInfo.Status); reader = null; return(null); } reader = RpcLogReader.GetLogReader(serverInfo.Key, context.DirectoryContext); if (reader == null) { return(null); } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, reader, TrackingLogPrefix.MSGTRK, initMessageEvent.InitMessageId, null, LogDataAnalyzer.validModeratorResponseTypes); if (messageLog.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceError <string, string>(0, "No moderator responses found for Initiation Message {0} on {1}", initMessageEvent.InitMessageId, serverInfo.Key); return(null); } return(messageLog[0]); }
private static bool TryEnqueueNextHopAfterSubmitInternal(MessageTrackingLogEntry submitEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers, bool searchAfterModerationApproval) { ServerInfo nextHopServer = submitEvent.GetNextHopServer(); if (LogDataAnalyzer.ShouldSkipTracker(nextHopServer, submitEvent, context)) { return(false); } ILogReader logReader = RpcLogReader.GetLogReader(submitEvent.NextHopFqdnOrName, context.DirectoryContext); if (logReader == null) { return(false); } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, submitEvent.MessageId, new MessageTrackingSource?((logReader.MtrSchemaVersion >= MtrSchemaVersion.E15RTM) ? MessageTrackingSource.SMTP : MessageTrackingSource.STOREDRIVER), SearchMessageTrackingReportImpl.ReceiveEventFilterSet); if (messageLog.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceDebug <string, string, MessageTrackingLogEntry>(0, "No {0} Receive event found on {1} to match {2}.", (logReader.MtrSchemaVersion >= MtrSchemaVersion.E15RTM) ? "SMTP" : "StoreDriver", submitEvent.NextHopFqdnOrName, submitEvent); return(false); } long num; if (!searchAfterModerationApproval) { num = messageLog[0].ServerLogKeyMailItemId; } else { num = LogDataAnalyzer.GetCheckReceiveEventAfterModerationApproval(messageLog, context, logReader); if (num == 0L) { return(false); } } foreach (MessageTrackingLogEntry messageTrackingLogEntry in messageLog) { LogDataAnalyzer.CreateAndEnqueueTracker(context, remainingTrackers, logReader, TrackingLogPrefix.MSGTRK, messageTrackingLogEntry.MessageId, num); } return(true); }
private static bool CheckRecipientListEquality(MessageTrackingLogEntry firstEntry, MessageTrackingLogEntry secondEntry) { if (firstEntry.RecipientAddresses == null || secondEntry.RecipientAddresses == null) { return(false); } if (firstEntry.RecipientAddresses.Length != secondEntry.RecipientAddresses.Length) { return(false); } int num = firstEntry.RecipientAddresses.Length; for (int i = 0; i < num; i++) { if (!firstEntry.RecipientAddresses[i].Equals(secondEntry.RecipientAddresses[i], StringComparison.OrdinalIgnoreCase)) { return(false); } } return(true); }
private static bool TryEnqueueNextHopAfterInitMessage(MessageTrackingLogEntry initMessageEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { ILogReader logReader; MessageTrackingLogEntry messageTrackingLogEntry = LogDataAnalyzer.LocateModeratorResponse(initMessageEvent, context, out logReader); if (messageTrackingLogEntry == null) { return(false); } if (messageTrackingLogEntry.RecipientAddresses == null) { messageTrackingLogEntry.RecipientAddresses = initMessageEvent.RecipientAddresses; } MailItemTracker item = new MailItemTracker(new List <MessageTrackingLogEntry>(1) { messageTrackingLogEntry }, context.Tree); remainingTrackers.Enqueue(item); return(true); }
private Node DoPostInsertionProcessing(Node parent, Node child) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)child.Value; if (parent == base.Root) { messageTrackingLogEntry.RootAddress = child.Key; return(child); } MessageTrackingLogEntry messageTrackingLogEntry2 = (MessageTrackingLogEntry)parent.Value; messageTrackingLogEntry.RootAddress = messageTrackingLogEntry2.RootAddress; if (messageTrackingLogEntry2.HiddenRecipient) { messageTrackingLogEntry.HiddenRecipient = true; } if (messageTrackingLogEntry2.BccRecipient != null && messageTrackingLogEntry.BccRecipient == null) { messageTrackingLogEntry.BccRecipient = messageTrackingLogEntry2.BccRecipient; } return(child); }
private List <MessageTrackingLogEntry> ApplyReportTemplateToTree() { ICollection <Node> collection; if (this.context.ReportTemplate == ReportTemplate.RecipientPath) { collection = this.context.Tree.GetPathToLeaf(this.context.SelectedRecipient); } else { collection = this.context.Tree.GetLeafNodes(); } List <MessageTrackingLogEntry> list = new List <MessageTrackingLogEntry>(collection.Count); foreach (Node node in collection) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)node.Value; messageTrackingLogEntry.RecipientAddress = node.Key; list.Add(messageTrackingLogEntry); } return(list); }
private static bool TryEnqueueNextHopAfterSend(MessageTrackingLogEntry sendEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { ServerInfo nextHopServer = sendEvent.GetNextHopServer(); if (LogDataAnalyzer.ShouldSkipTracker(nextHopServer, sendEvent, context)) { return(false); } ILogReader logReader = RpcLogReader.GetLogReader(sendEvent.NextHopFqdnOrName, context.DirectoryContext); if (logReader == null) { return(false); } MessageTrackingSource? sourceFilter = null; HashSet <MessageTrackingEvent> eventIdFilterSet = SearchMessageTrackingReportImpl.ReceiveOrDeliverEventsFilterSet; if (logReader.MtrSchemaVersion < MtrSchemaVersion.E15RTM) { sourceFilter = new MessageTrackingSource?(MessageTrackingSource.SMTP); eventIdFilterSet = SearchMessageTrackingReportImpl.ReceiveEventFilterSet; } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, sendEvent.MessageId, sourceFilter, eventIdFilterSet); if (messageLog.Count == 0) { return(false); } foreach (MessageTrackingLogEntry messageTrackingLogEntry in messageLog) { if (LogDataAnalyzer.CheckRecipientListEquality(sendEvent, messageTrackingLogEntry)) { LogDataAnalyzer.CreateAndEnqueueTracker(context, remainingTrackers, logReader, TrackingLogPrefix.MSGTRK, messageTrackingLogEntry.MessageId, messageTrackingLogEntry.ServerLogKeyMailItemId); return(true); } } TraceWrapper.SearchLibraryTracer.TraceError <MessageTrackingLogEntry, string>(0, "Could not find any receive events to match {0} on {1}.", sendEvent, sendEvent.NextHopFqdnOrName); return(false); }
private void SetHideRecipientAndBccPropertiesForAgentEvent(MessageTrackingLogEntry logEntry) { bool flag = true; bool flag2 = false; KeyValuePair <string, object>[] customData = logEntry.CustomData; if (customData == null || customData.Length == 0) { TraceWrapper.SearchLibraryTracer.TraceDebug(this.GetHashCode(), "Agent added recipient does not have value in CustomData field, hide recipient.", new object[0]); } else { foreach (KeyValuePair <string, object> keyValuePair in customData) { if ("RecipientType".Equals(keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { string text = keyValuePair.Value as string; if (!string.IsNullOrEmpty(text)) { flag = (!"To".Equals(text, StringComparison.OrdinalIgnoreCase) && !"Cc".Equals(text, StringComparison.OrdinalIgnoreCase) && !"Redirect".Equals(text, StringComparison.OrdinalIgnoreCase)); if ("Bcc".Equals(text, StringComparison.OrdinalIgnoreCase) || "Unknown".Equals(text, StringComparison.OrdinalIgnoreCase)) { flag2 = true; } TraceWrapper.SearchLibraryTracer.TraceDebug <string, bool, bool>(this.GetHashCode(), "Tracking log entry contained '{0}' for RecipientType property. hiddenRecip={1}, bccRecip={2}", text, flag, flag2); break; } TraceWrapper.SearchLibraryTracer.TraceDebug(this.GetHashCode(), "Tracking log entry contained null or invalid value for RecipientTypePropertyName property: {0}.", new object[] { keyValuePair.Value }); } } } TraceWrapper.SearchLibraryTracer.TraceDebug <bool, bool>(this.GetHashCode(), "Hidden recipient is {0} and bccRecip is {1}", flag, flag2); logEntry.BccRecipient = new bool?(flag2); logEntry.HiddenRecipient = flag; }
private static bool TryEnqueueNextHopAfterModeratorApprove(MessageTrackingLogEntry approvalEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { ILogReader logReader = RpcLogReader.GetLogReader(approvalEvent.Server, context.DirectoryContext); if (logReader == null) { return(false); } List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, approvalEvent.MessageId, new MessageTrackingSource?(MessageTrackingSource.STOREDRIVER), SearchMessageTrackingReportImpl.SubmitEventFilterSet); if (messageLog.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Moderator approval event found, but no matching submission of the message back into transport was found on mailbox server {0}.", approvalEvent.Server); return(false); } MessageTrackingLogEntry messageTrackingLogEntry = null; foreach (MessageTrackingLogEntry messageTrackingLogEntry2 in messageLog) { if (!LogDataAnalyzer.IsEntryProcessed(messageTrackingLogEntry2, context.Tree)) { messageTrackingLogEntry = messageTrackingLogEntry2; messageTrackingLogEntry.ProcessedBy = context.Tree; break; } } if (messageTrackingLogEntry == null) { TraceWrapper.SearchLibraryTracer.TraceError(0, "All submission events found after processing moderator approval had already been processed.", new object[0]); return(false); } ILogReader logReader2 = RpcLogReader.GetLogReader(messageTrackingLogEntry.NextHopFqdnOrName, context.DirectoryContext); if (logReader2 == null) { return(false); } List <MessageTrackingLogEntry> messageLog2 = context.Cache.GetMessageLog(RpcReason.None, logReader2, TrackingLogPrefix.MSGTRK, approvalEvent.OrigMessageId, new MessageTrackingSource?(MessageTrackingSource.APPROVAL), SearchMessageTrackingReportImpl.ReceiveEventFilterSet); if (messageLog2.Count == 0) { TraceWrapper.SearchLibraryTracer.TraceError(0, "No Approval Received events found", new object[0]); return(false); } foreach (MessageTrackingLogEntry messageTrackingLogEntry3 in messageLog2) { if (!LogDataAnalyzer.IsEntryProcessed(messageTrackingLogEntry3, context.Tree) && approvalEvent.MessageId.Equals(messageTrackingLogEntry3.InitMessageId, StringComparison.Ordinal)) { if (logReader.MtrSchemaVersion >= MtrSchemaVersion.E15RTM) { if (!LogDataAnalyzer.TryEnqueueNextHopAfterSubmitInternal(messageTrackingLogEntry3, context, remainingTrackers, true)) { continue; } } else { List <MessageTrackingLogEntry> messageLog3 = context.Cache.GetMessageLog(RpcReason.None, logReader2, TrackingLogPrefix.MSGTRK, approvalEvent.OrigMessageId, messageTrackingLogEntry3.ServerLogKeyMailItemId); if (messageLog3.Count == 0) { continue; } MailItemTracker item = new MailItemTracker(messageLog3, context.Tree); remainingTrackers.Enqueue(item); } return(true); } } TraceWrapper.SearchLibraryTracer.TraceError(0, "No unprocessed Approval Received events found", new object[0]); return(false); }
protected override bool IsNodeRootChildCandidate(Node node) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)node.Value; return(messageTrackingLogEntry.EventId == MessageTrackingEvent.SUBMIT || messageTrackingLogEntry.EventId == MessageTrackingEvent.RECEIVE || (messageTrackingLogEntry.EventId == MessageTrackingEvent.FAIL && messageTrackingLogEntry.Source == MessageTrackingSource.SMTP) || (messageTrackingLogEntry.EventId == MessageTrackingEvent.MODERATORAPPROVE && messageTrackingLogEntry.Source == MessageTrackingSource.APPROVAL) || (messageTrackingLogEntry.EventId == MessageTrackingEvent.MODERATORREJECT && messageTrackingLogEntry.Source == MessageTrackingSource.APPROVAL) || messageTrackingLogEntry.EventId == MessageTrackingEvent.REDIRECT || messageTrackingLogEntry.EventId == MessageTrackingEvent.HAREDIRECT || messageTrackingLogEntry.EventId == MessageTrackingEvent.HARECEIVE || messageTrackingLogEntry.EventId == MessageTrackingEvent.DELIVER || messageTrackingLogEntry.EventId == MessageTrackingEvent.DUPLICATEDELIVER); }
public List <MessageTrackingLogEntry> AnalyzeLogData(string messageId, long internalId, out MessageTrackingLogEntry rootEvent) { rootEvent = null; List <MessageTrackingLogEntry> startingMailItemEntries = this.GetStartingMailItemEntries(messageId, internalId); this.CreateInitialTracker(startingMailItemEntries); this.ProcessAllTrackers(); if (this.context.Tree.Root == null) { return(new List <MessageTrackingLogEntry>(0)); } rootEvent = (MessageTrackingLogEntry)this.context.Tree.Root.Value; return(this.ApplyReportTemplateToTree()); }
private static bool IsEntryProcessed(MessageTrackingLogEntry entry, EventTree tree) { return(entry.ProcessedBy == tree); }
protected override Node DisambiguateParentRecord(LinkedList <Node> possibleParents, Node node) { MessageTrackingLogEntry messageTrackingLogEntry = (MessageTrackingLogEntry)node.Value; if (possibleParents == null || possibleParents.Count == 0) { return(null); } MessageTrackingEvent eventId = messageTrackingLogEntry.EventId; if (eventId <= MessageTrackingEvent.REDIRECT) { switch (eventId) { case MessageTrackingEvent.RECEIVE: return(this.FindParentMatchingParameters(messageTrackingLogEntry, null, EventTree.receiveEventMatchingTypes, EventTree.EventMatchingCondition.MustMatch, null, possibleParents)); case MessageTrackingEvent.SEND: break; case MessageTrackingEvent.FAIL: return(this.FindParentMatchingParameters(messageTrackingLogEntry, new long?(messageTrackingLogEntry.InternalMessageId), EventTree.beginModerationEventType, EventTree.EventMatchingCondition.MustNotMatch, null, possibleParents)); default: if (eventId == MessageTrackingEvent.REDIRECT) { if (messageTrackingLogEntry.RecipientAddresses == null || messageTrackingLogEntry.RecipientAddresses.Length == 0) { return(null); } foreach (Node node2 in possibleParents) { MessageTrackingLogEntry messageTrackingLogEntry2 = (MessageTrackingLogEntry)node2.Value; if (messageTrackingLogEntry2.EventId == MessageTrackingEvent.REDIRECT && messageTrackingLogEntry2.RelatedRecipientAddress != null && !messageTrackingLogEntry2.RelatedRecipientAddress.Equals(messageTrackingLogEntry2.RecipientAddresses[0])) { return(node2); } } return(this.FindParentMatchingParameters(messageTrackingLogEntry, null, EventTree.redirectEventType, EventTree.EventMatchingCondition.MustNotMatch, null, possibleParents)); } break; } } else { switch (eventId) { case MessageTrackingEvent.DUPLICATEDELIVER: return(this.FindParentMatchingParameters(messageTrackingLogEntry, new long?(messageTrackingLogEntry.ServerLogKeyMailItemId), EventTree.deliveryEventTypes, EventTree.EventMatchingCondition.MustNotMatch, null, possibleParents)); case MessageTrackingEvent.RESUBMIT: if (messageTrackingLogEntry.Source == MessageTrackingSource.REDUNDANCY) { return(this.FindParentMatchingParameters(messageTrackingLogEntry, null, EventTree.haResubmitEventMatchingTypes, EventTree.EventMatchingCondition.MustMatch, null, possibleParents)); } break; case MessageTrackingEvent.INITMESSAGECREATED: break; case MessageTrackingEvent.MODERATORREJECT: return(this.FindParentMatchingParameters(messageTrackingLogEntry, null, EventTree.beginModerationEventType, EventTree.EventMatchingCondition.MustMatch, null, possibleParents)); case MessageTrackingEvent.MODERATORAPPROVE: return(this.FindParentMatchingParameters(messageTrackingLogEntry, null, EventTree.beginModerationEventType, EventTree.EventMatchingCondition.MustMatch, null, possibleParents)); default: if (eventId == MessageTrackingEvent.HAREDIRECT) { return(null); } if (eventId == MessageTrackingEvent.HARECEIVE) { return(this.FindParentMatchingParameters(messageTrackingLogEntry, null, EventTree.haReceiveEventMatchingTypes, EventTree.EventMatchingCondition.MustMatch, null, possibleParents)); } break; } } return(this.FindParentMatchingParameters(messageTrackingLogEntry, new long?(messageTrackingLogEntry.ServerLogKeyMailItemId), null, EventTree.EventMatchingCondition.MustMatch, null, possibleParents)); }
private static bool TryEnqueueNextHopAfterSubmit(MessageTrackingLogEntry submitEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers) { return(LogDataAnalyzer.TryEnqueueNextHopAfterSubmitInternal(submitEvent, context, remainingTrackers, false)); }