Exemplo n.º 1
0
        // Token: 0x06000EE8 RID: 3816 RVA: 0x00054A58 File Offset: 0x00052C58
        internal override Command.ExecutionState ExecuteCommand()
        {
            this.ReadXmlRequest();
            this.InitializeResponseXmlDocument();
            CertificateManager certificateManager = new CertificateManager(base.User.ExchangePrincipal, base.MailboxSession, base.Context.Request.Culture.LCID, this.maxCertificates, this.SmimeConfiguration, base.User.OrganizationId);
            bool searchADFirst            = this.ShouldResolveToADFirst();
            List <ResolvedRecipient> list = null;

            if (this.availabilityOptions != null)
            {
                list = new List <ResolvedRecipient>(Math.Min(this.recipientsList.Count, Configuration.MaximumIdentityArraySize));
            }
            if (this.pictureOptions != null)
            {
                this.photoRetriever = new AirSyncPhotoRetriever(base.Context);
            }
            using (AnrManager anrManager = new AnrManager(base.User, base.MailboxSession, base.Context.Request.Culture.LCID, this.maxAmbiguousRecipients))
            {
                foreach (AmbiguousRecipientToResolve ambiguousRecipientToResolve in this.recipientsList)
                {
                    anrManager.ResolveOneRecipient(ambiguousRecipientToResolve.Name, searchADFirst, ambiguousRecipientToResolve);
                    if (ambiguousRecipientToResolve.ResolvedTo.Count != 0)
                    {
                        if (!ambiguousRecipientToResolve.ExactMatchFound)
                        {
                            goto IL_1C8;
                        }
                        ambiguousRecipientToResolve.Status = StatusCode.Success;
                        if (this.certificateRetrieval != ResolveRecipientsCommand.CertificateRetrievalType.None)
                        {
                            foreach (ResolvedRecipient resolvedRecipient in ambiguousRecipientToResolve.ResolvedTo)
                            {
                                resolvedRecipient.CertificateRetrieval = this.certificateRetrieval;
                            }
                            certificateManager.GetRecipientCerts(ambiguousRecipientToResolve);
                        }
                        if (this.availabilityOptions != null)
                        {
                            using (List <ResolvedRecipient> .Enumerator enumerator3 = ambiguousRecipientToResolve.ResolvedTo.GetEnumerator())
                            {
                                while (enumerator3.MoveNext())
                                {
                                    ResolvedRecipient resolvedRecipient2 = enumerator3.Current;
                                    if (list.Count < Configuration.MaximumIdentityArraySize)
                                    {
                                        list.Add(resolvedRecipient2);
                                    }
                                    else
                                    {
                                        resolvedRecipient2.AvailabilityStatus = StatusCode.AvailabilityTooManyRecipients;
                                    }
                                }
                                goto IL_1DC;
                            }
                            goto IL_1C8;
                        }
IL_1DC:
                        ambiguousRecipientToResolve.PictureOptions = this.pictureOptions;
                        continue;
IL_1C8:
                        ambiguousRecipientToResolve.Status = (ambiguousRecipientToResolve.CompleteList ? StatusCode.Sync_ProtocolVersionMismatch : StatusCode.Sync_InvalidSyncKey);
                        goto IL_1DC;
                    }
                    ambiguousRecipientToResolve.Status = StatusCode.Sync_ProtocolError;
                }
            }
            if (this.pictureOptions != null && base.Context.User.Features.IsEnabled(EasFeature.HDPhotos) && base.Context.Request.Version >= 160)
            {
                List <string> recipients = new List <string>();
                this.recipientsList.ForEach(delegate(AmbiguousRecipientToResolve recipient)
                {
                    if (recipient.Status == StatusCode.Success)
                    {
                        recipients.AddRange(from s in recipient.ResolvedTo
                                            select s.ResolvedTo.SmtpAddress);
                    }
                });
                this.photoRetriever.BeginGetThumbnailPhotoFromMailbox(recipients, this.pictureOptions.PhotoSize);
            }
            if (this.availabilityOptions != null && list.Count > 0)
            {
                AvailabilityQuery       availabilityQuery = this.CreateAvailabilityQuery(list);
                AvailabilityQueryResult result;
                if (this.QueryAvailability(availabilityQuery, list, out result))
                {
                    this.FillInAvailabilityData(list, result);
                }
            }
            this.BuildXmlResponse();
            return(Command.ExecutionState.Complete);
        }