Ejemplo n.º 1
0
        private void PathInsertedHandler(Node lastNodeInPath, TrackingAuthorityKind authorityKind)
        {
            RecipientTrackingEvent recipientTrackingEvent = (RecipientTrackingEvent)lastNodeInPath.Value;

            if (!string.IsNullOrEmpty(this.recipientPathFilter) && this.recipientPathFilter.Equals(recipientTrackingEvent.RecipientAddress.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                if (!this.hasRecipPathMatch)
                {
                    TraceWrapper.SearchLibraryTracer.TraceDebug <SmtpAddress>(this.GetHashCode(), "Clearing queue because last event in path with recipient {0} matches recipient path fitler.", recipientTrackingEvent.RecipientAddress);
                    this.referralQueue.Clear();
                }
                this.hasRecipPathMatch = true;
            }
            else if (this.hasRecipPathMatch)
            {
                return;
            }
            if (this.IsRemoteEventPotentialReferral(recipientTrackingEvent, authorityKind))
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <SmtpAddress, string>(this.GetHashCode(), "Getting authority for possible referral {0}, Original recip event={1}.", recipientTrackingEvent.RecipientAddress, Names <EventDescription> .Map[(int)recipientTrackingEvent.EventDescription]);
                TrackingAuthority trackingAuthority = this.getAuthorityAndRemapReferral(ref recipientTrackingEvent);
                TraceWrapper.SearchLibraryTracer.TraceDebug <string, string>(this.GetHashCode(), "Got authority {0}, Recip event is now {1}.", (trackingAuthority == null) ? "null" : Names <TrackingAuthorityKind> .Map[(int)trackingAuthority.TrackingAuthorityKind], Names <EventDescription> .Map[(int)recipientTrackingEvent.EventDescription]);
                if (trackingAuthority != null && !this.IsOutOfScopeTransfer(recipientTrackingEvent))
                {
                    TraceWrapper.SearchLibraryTracer.TraceDebug <SmtpAddress, string>(this.GetHashCode(), "Adding last event in path to referral queue address is {0}, the authority to follow is {1}.", recipientTrackingEvent.RecipientAddress, Names <TrackingAuthorityKind> .Map[(int)trackingAuthority.TrackingAuthorityKind]);
                    this.referralQueue.Enqueue(new ReferralQueue.ReferralData
                    {
                        Node      = lastNodeInPath,
                        Authority = trackingAuthority
                    });
                }
            }
        }
Ejemplo n.º 2
0
        public static string[] GetEventDataToTransmitForRtm(RecipientTrackingEvent recipEvent)
        {
            string[] array = recipEvent.EventData;
            int      num   = (array != null) ? array.Length : 0;

            if (recipEvent.EventDescription == EventDescription.TransferredToPartnerOrg && num != 1)
            {
                array = new string[]
                {
                    recipEvent.RecipientAddress.ToString()
                };
                num = 1;
            }
            int num2 = VersionConverter.eventDataToPropertyMapping.Count + num;

            string[] array2 = new string[num2];
            if (num > 0)
            {
                Array.Copy(array, array2, num);
            }
            int num3 = num;

            foreach (string text in VersionConverter.eventDataToPropertyMapping.Keys)
            {
                string arg = VersionConverter.eventDataToPropertyMapping[text].Getter(recipEvent);
                array2[num3++] = text + '=' + arg;
            }
            return(array2);
        }
Ejemplo n.º 3
0
        private List <RecipientTrackingEvent> ConvertNodesToEvents(ICollection <Node> nodes)
        {
            List <RecipientTrackingEvent> list = new List <RecipientTrackingEvent>(nodes.Count);

            foreach (Node node in nodes)
            {
                RecipientTrackingEvent item = (RecipientTrackingEvent)node.Value;
                list.Add(item);
            }
            return(list);
        }
Ejemplo n.º 4
0
        protected override int GetNodePriorities(Node node, out int secondaryPriority)
        {
            RecipientTrackingEvent      recipientTrackingEvent = (RecipientTrackingEvent)node.Value;
            EventDescriptionInformation eventDescriptionInformation;

            if (!EnumAttributeInfo <EventDescription, EventDescriptionInformation> .TryGetValue((int)recipientTrackingEvent.EventDescription, out eventDescriptionInformation))
            {
                throw new InvalidOperationException(string.Format("Value {0} was not annotated", Names <EventDescription> .Map[(int)recipientTrackingEvent.EventDescription]));
            }
            secondaryPriority = EventTree.GetSecondaryPriority(recipientTrackingEvent.BccRecipient, recipientTrackingEvent.HiddenRecipient, string.Equals(recipientTrackingEvent.RootAddress, (string)recipientTrackingEvent.RecipientAddress, StringComparison.OrdinalIgnoreCase));
            return(eventDescriptionInformation.EventPriority);
        }
Ejemplo n.º 5
0
 public void Evaluate(IEnumerable <List <RecipientTrackingEvent> > initialEvents, TrackingAuthorityKind authorityKind)
 {
     this.InsertPaths(null, initialEvents, authorityKind);
     ReferralQueue.ReferralData referralData;
     while (this.referralQueue.DeQueue(out referralData))
     {
         if (!this.directoryContext.TrackingBudget.IsUnderBudget())
         {
             TraceWrapper.SearchLibraryTracer.TraceError(this.GetHashCode(), "Over budget following referrals, stopping", new object[0]);
             return;
         }
         Node node = referralData.Node;
         if (node.HasChildren)
         {
             TraceWrapper.SearchLibraryTracer.TraceDebug(this.GetHashCode(), "Skipping referral, node already has child.", new object[0]);
         }
         else
         {
             this.referralsFollowed++;
             if (this.referralsFollowed > 5000)
             {
                 TraceWrapper.SearchLibraryTracer.TraceError <int>(this.GetHashCode(), "Processed {0} referrals.  Giving up.", this.referralsFollowed);
                 return;
             }
             ReferralQueue       referralQueue = this.referralQueue;
             ReferralQueue.State state2        = new ReferralQueue.State();
             state2.AuthorityKey = referralData.Authority.ToString();
             state2.WorkerState  = referralData;
             state2.WorkerMethod = delegate(object state)
             {
                 ReferralQueue.ReferralData referralData2 = (ReferralQueue.ReferralData)state;
                 Node node2 = referralData2.Node;
                 TrackingAuthority      authority = referralData2.Authority;
                 RecipientTrackingEvent recipientTrackingEvent = (RecipientTrackingEvent)referralData2.Node.Value;
                 IEnumerable <List <RecipientTrackingEvent> > paths;
                 if (this.tryProcessReferral(recipientTrackingEvent, authority, out paths))
                 {
                     TraceWrapper.SearchLibraryTracer.TraceDebug <SmtpAddress, string>(this.GetHashCode(), "Inserting paths after following referral for recipient {0} from {1}.", recipientTrackingEvent.RecipientAddress, Names <TrackingAuthorityKind> .Map[(int)authority.TrackingAuthorityKind]);
                     this.InsertPaths(node2, paths, authority.TrackingAuthorityKind);
                     return;
                 }
                 TraceWrapper.SearchLibraryTracer.TraceError <SmtpAddress>(this.GetHashCode(), "Did not get any results for referral to recipient {0}.", recipientTrackingEvent.RecipientAddress);
             };
             referralQueue.BeginWorker(state2);
         }
     }
 }
Ejemplo n.º 6
0
        private void ApplyInheritance(Node parent, Node child)
        {
            RecipientTrackingEvent recipientTrackingEvent = (RecipientTrackingEvent)child.Value;

            if (parent == base.Root)
            {
                return;
            }
            RecipientTrackingEvent recipientTrackingEvent2 = (RecipientTrackingEvent)parent.Value;

            if (recipientTrackingEvent2.HiddenRecipient)
            {
                recipientTrackingEvent.HiddenRecipient = true;
            }
            recipientTrackingEvent.BccRecipient = recipientTrackingEvent2.BccRecipient;
            recipientTrackingEvent.RootAddress  = recipientTrackingEvent2.RootAddress;
        }
Ejemplo n.º 7
0
        private static List <RecipientTrackingEvent> CreateEventList <T>(string domain, T[] wsRecipientTrackingEvents, InternalGetMessageTrackingReportResponse.RecipientEventConversionDelegate <T> conversionMethod)
        {
            if (wsRecipientTrackingEvents == null)
            {
                return(new List <RecipientTrackingEvent>(0));
            }
            List <RecipientTrackingEvent> list = new List <RecipientTrackingEvent>(wsRecipientTrackingEvents.Length);

            for (int i = 0; i < wsRecipientTrackingEvents.Length; i++)
            {
                RecipientTrackingEvent recipientTrackingEvent = conversionMethod(domain, wsRecipientTrackingEvents[i]);
                if (recipientTrackingEvent != null)
                {
                    list.Add(recipientTrackingEvent);
                }
            }
            return(list);
        }
Ejemplo n.º 8
0
 private bool IsRemoteEventPotentialReferral(RecipientTrackingEvent recipientTrackingEvent, TrackingAuthorityKind authorityKindFollowed)
 {
     TraceWrapper.SearchLibraryTracer.TraceDebug <SmtpAddress, string>(this.GetHashCode(), "Evaluating referral for recipient: {0}, authority kind followed is: {1}", recipientTrackingEvent.RecipientAddress, Names <TrackingAuthorityKind> .Map[(int)authorityKindFollowed]);
     if (recipientTrackingEvent.EventDescription != EventDescription.SmtpSendCrossSite && recipientTrackingEvent.EventDescription != EventDescription.SmtpSendCrossForest && recipientTrackingEvent.EventDescription != EventDescription.TransferredToForeignOrg && recipientTrackingEvent.EventDescription != EventDescription.TransferredToPartnerOrg && recipientTrackingEvent.EventDescription != EventDescription.PendingModeration && recipientTrackingEvent.EventDescription != EventDescription.SubmittedCrossSite)
     {
         TraceWrapper.SearchLibraryTracer.TraceDebug <string>(this.GetHashCode(), "Event: {0} does not indicate a referral", Names <EventDescription> .Map[(int)recipientTrackingEvent.EventDescription]);
         return(false);
     }
     if (recipientTrackingEvent.EventDescription == EventDescription.PendingModeration && (authorityKindFollowed == TrackingAuthorityKind.RemoteForest || authorityKindFollowed == TrackingAuthorityKind.RemoteTrustedOrg))
     {
         TraceWrapper.SearchLibraryTracer.TraceDebug <string>(this.GetHashCode(), "Pending moderation is not a referral for authority {0}.", Names <TrackingAuthorityKind> .Map[(int)authorityKindFollowed]);
         return(false);
     }
     if ((authorityKindFollowed == TrackingAuthorityKind.RemoteForest || authorityKindFollowed == TrackingAuthorityKind.RemoteTrustedOrg) && recipientTrackingEvent.EventDescription != EventDescription.SmtpSendCrossForest && recipientTrackingEvent.EventDescription != EventDescription.TransferredToForeignOrg && recipientTrackingEvent.EventDescription != EventDescription.TransferredToPartnerOrg)
     {
         TraceWrapper.SearchLibraryTracer.TraceDebug <string>(this.GetHashCode(), "Following {0} should result only in referrals to other orgs or forests.", Names <TrackingAuthorityKind> .Map[(int)authorityKindFollowed]);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 9
0
        private static void ParseRawEventData(string[] data, RecipientTrackingEvent trackingEvent)
        {
            if (data == null || data.Length == 0)
            {
                return;
            }
            List <string> list = new List <string>(data.Length);
            int           i    = 0;

            while (i < data.Length)
            {
                int num = data[i].IndexOf('=');
                if (num == -1)
                {
                    goto IL_90;
                }
                string key = data[i].Substring(0, num);
                VersionConverter.RawEventAccessor rawEventAccessor;
                if (!VersionConverter.eventDataToPropertyMapping.TryGetValue(key, out rawEventAccessor))
                {
                    goto IL_90;
                }
                if (string.IsNullOrEmpty(rawEventAccessor.Getter(trackingEvent)))
                {
                    string value = null;
                    if (num < data[i].Length - 1)
                    {
                        value = data[i].Substring(num + 1, data[i].Length - num - 1);
                    }
                    rawEventAccessor.Setter(trackingEvent, value);
                }
IL_99:
                i++;
                continue;
IL_90:
                list.Add(data[i]);
                goto IL_99;
            }
            trackingEvent.EventData = list.ToArray();
        }
 public static RecipientTrackingEvent Create(string domain, Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.RecipientTrackingEventType rdRecipientTrackingEvent)
 {
     return(RecipientTrackingEvent.Create(domain, (rdRecipientTrackingEvent.Recipient == null) ? null : rdRecipientTrackingEvent.Recipient.EmailAddress, (rdRecipientTrackingEvent.Recipient == null) ? null : rdRecipientTrackingEvent.Recipient.Name, rdRecipientTrackingEvent.DeliveryStatus, rdRecipientTrackingEvent.EventDescription, rdRecipientTrackingEvent.EventData, rdRecipientTrackingEvent.Server, rdRecipientTrackingEvent.Date, rdRecipientTrackingEvent.InternalId, rdRecipientTrackingEvent.UniquePathId, rdRecipientTrackingEvent.HiddenRecipient, new bool?(rdRecipientTrackingEvent.BccRecipient), rdRecipientTrackingEvent.RootAddress, MessageConverter.CopyTrackingProperties(rdRecipientTrackingEvent.Properties)));
 }
 public static RecipientTrackingEvent Create(string domain, Microsoft.Exchange.SoapWebClient.EWS.RecipientTrackingEventType wsRecipientTrackingEvent)
 {
     return(RecipientTrackingEvent.Create(domain, (wsRecipientTrackingEvent.Recipient == null) ? null : wsRecipientTrackingEvent.Recipient.EmailAddress, (wsRecipientTrackingEvent.Recipient == null) ? null : wsRecipientTrackingEvent.Recipient.Name, wsRecipientTrackingEvent.DeliveryStatus, wsRecipientTrackingEvent.EventDescription, wsRecipientTrackingEvent.EventData, wsRecipientTrackingEvent.Server, wsRecipientTrackingEvent.Date, wsRecipientTrackingEvent.InternalId, wsRecipientTrackingEvent.UniquePathId, wsRecipientTrackingEvent.HiddenRecipient, new bool?(wsRecipientTrackingEvent.BccRecipient), wsRecipientTrackingEvent.RootAddress, wsRecipientTrackingEvent.Properties));
 }
Ejemplo n.º 12
0
 private bool IsOutOfScopeTransfer(RecipientTrackingEvent recipEvent)
 {
     return((recipEvent.EventDescription == EventDescription.SmtpSendCrossSite && this.scope == SearchScope.Site) || (recipEvent.EventDescription == EventDescription.PendingModeration && this.scope == SearchScope.Site) || (recipEvent.EventDescription == EventDescription.SmtpSendCrossForest && (this.scope == SearchScope.Site || this.scope == SearchScope.Forest || this.scope == SearchScope.Organization)) || (recipEvent.EventDescription == EventDescription.TransferredToPartnerOrg && (this.scope == SearchScope.Site || this.scope == SearchScope.Forest || this.scope == SearchScope.Organization)) || recipEvent.EventDescription == EventDescription.TransferredToForeignOrg);
 }
Ejemplo n.º 13
0
 internal static void ConvertRawEventData(string[] rawEventData, RecipientTrackingEvent eventToConvert)
 {
     VersionConverter.ParseRawEventData(rawEventData, eventToConvert);
 }
Ejemplo n.º 14
0
 internal FindParameters(string messageId, RecipientTrackingEvent referralEvent, TrackingAuthority authority)
 {
     this.MessageId     = messageId;
     this.ReferralEvent = referralEvent;
     this.Authority     = authority;
 }