Ejemplo n.º 1
0
        // Token: 0x06000C20 RID: 3104 RVA: 0x00053828 File Offset: 0x00051A28
        private static void ProcessRecipients(MessageItem mailToMessage, string value, RecipientItemType recipientItemType)
        {
            if (string.IsNullOrEmpty(value))
            {
                return;
            }
            value = HttpUtility.UrlDecode(value);
            Participant participant;
            bool        flag = Participant.TryParse(value, out participant);

            if (flag)
            {
                ProxyAddress proxyAddress;
                if (ImceaAddress.IsImceaAddress(participant.EmailAddress) && SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress))
                {
                    participant = new Participant((participant.DisplayName != participant.EmailAddress) ? participant.DisplayName : proxyAddress.AddressString, proxyAddress.AddressString, proxyAddress.PrefixString);
                }
                mailToMessage.Recipients.Add(participant, recipientItemType);
            }
        }
Ejemplo n.º 2
0
        // Token: 0x0600251F RID: 9503 RVA: 0x000D67BC File Offset: 0x000D49BC
        internal static bool Render(TextWriter writer, UserContext userContext, string displayName, string smtpAddress, string routingAddress, string routingType, string alias, AddressOrigin addressOrigin, int recipientFlags, StoreObjectId storeObjectId, EmailAddressIndex emailAddressIndex, ADObjectId adObjectId, RecipientWellNode.RenderFlags flags, string sipUri, string mobilePhoneNumber)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (string.CompareOrdinal(routingType, "SMTP") == 0 && ImceaAddress.IsImceaAddress(routingAddress) && Utilities.TryDecodeImceaAddress(routingAddress, ref routingType, ref routingAddress))
            {
                smtpAddress = null;
            }
            bool   flag  = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None;
            bool   flag2 = false;
            string text  = "rwRR";

            if (string.CompareOrdinal(routingType, "MAPIPDL") != 0 && (string.IsNullOrEmpty(routingAddress) || string.IsNullOrEmpty(routingType)))
            {
                if (string.IsNullOrEmpty(displayName))
                {
                    ExTraceGlobals.MailDataTracer.TraceDebug(0L, "Found recipient without an email address or display name");
                    return(false);
                }
                text           = "rwUR";
                flag2          = true;
                routingAddress = null;
                smtpAddress    = null;
                routingType    = null;
            }
            else if (string.IsNullOrEmpty(displayName))
            {
                if (!string.IsNullOrEmpty(smtpAddress))
                {
                    displayName = smtpAddress;
                }
                else if (!string.IsNullOrEmpty(routingAddress))
                {
                    displayName = routingAddress;
                }
            }
            if (flag)
            {
                text = (flag2 ? "rwURO" : "rwRRO");
            }
            if ((recipientFlags & 1) != 0)
            {
                text += " rwDL";
            }
            if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None)
            {
                writer.Write(userContext.DirectionMark);
                writer.Write("; ");
            }
            if ((flags & RecipientWellNode.RenderFlags.RenderSkinnyHtml) != RecipientWellNode.RenderFlags.None)
            {
                if (!flag)
                {
                    writer.Write("<span>");
                }
                writer.Write("<span class=\"");
            }
            else if (flag)
            {
                writer.Write("<span id=\"spnR\" ");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "oncontextmenu", "onRwCm(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "ondblclick", "onDblClkReadRcp(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "onclick", "onClkRcp(event);");
                writer.Write(" class=\"");
            }
            else
            {
                writer.Write("<span tabindex=\"-1\" contenteditable=\"false\">");
                if (userContext.BrowserType == BrowserType.IE)
                {
                    writer.Write("<span tabindex=\"-1\" contenteditable=\"true\" id=\"spnR\" ");
                }
                else
                {
                    writer.Write("<span tabindex=\"-1\" contenteditable=\"false\" id=\"spnR\" ");
                }
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "oncontextmenu", "onContextMenuSpnRw(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "onclick", "onClkRcp(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "onkeydown", "onKDRcp(event);");
                writer.Write(" ");
                Utilities.RenderScriptHandler(writer, "ondblclick", "onDblClkRcp(event);");
                writer.Write(" ondrop=\"return(false);\" class=\"");
            }
            writer.Write(text);
            writer.Write("\" _ao=\"{0}\" _rf=\"{1}\" _rt=\"", (int)addressOrigin, recipientFlags);
            if (routingType != null)
            {
                Utilities.SanitizeHtmlEncode(routingType, writer);
            }
            writer.Write("\" _em=\"");
            if (routingAddress != null)
            {
                Utilities.SanitizeHtmlEncode(routingAddress, writer);
            }
            if (storeObjectId != null)
            {
                writer.Write("\" _id=\"");
                Utilities.SanitizeHtmlEncode(storeObjectId.ToBase64String(), writer);
                writer.Write("\" _ei=\"");
                writer.Write((int)emailAddressIndex);
            }
            else if (adObjectId != null)
            {
                writer.Write("\" _id=\"");
                Utilities.SanitizeHtmlEncode(Convert.ToBase64String(adObjectId.ObjectGuid.ToByteArray()), writer);
            }
            writer.Write("\" title=\"");
            if (smtpAddress != null)
            {
                Utilities.SanitizeHtmlEncode(smtpAddress, writer);
            }
            if (!flag || addressOrigin == AddressOrigin.OneOff || (addressOrigin == AddressOrigin.Directory && !userContext.IsFeatureEnabled(Feature.GlobalAddressList)))
            {
                if (smtpAddress != null)
                {
                    writer.Write("\" _sa=\"");
                    Utilities.SanitizeHtmlEncode(smtpAddress, writer);
                }
                else if (routingType != null && routingAddress != null)
                {
                    writer.Write("\" _imcea=\"");
                    Utilities.SanitizeHtmlEncode(ImceaAddress.Encode(routingType, routingAddress, OwaConfigurationManager.Configuration.DefaultAcceptedDomain.DomainName.ToString()), writer);
                }
            }
            if (userContext.IsInstantMessageEnabled() && userContext.InstantMessagingType == InstantMessagingTypeOptions.Ocs && sipUri != null)
            {
                writer.Write("\" ");
                if (adObjectId == null)
                {
                    writer.Write("_sipTrsp=1 ");
                }
                writer.Write("_uri=\"");
                Utilities.SanitizeHtmlEncode(sipUri, writer);
            }
            if (userContext.IsSmsEnabled && mobilePhoneNumber != null)
            {
                writer.Write("\" _mo=\"");
                Utilities.SanitizeHtmlEncode(mobilePhoneNumber, writer);
            }
            if ((smtpAddress != null || routingAddress != null || mobilePhoneNumber != null || Utilities.IsMapiPDL(routingType)) && (!flag || addressOrigin == AddressOrigin.OneOff || (addressOrigin == AddressOrigin.Store && (!userContext.IsFeatureEnabled(Feature.Contacts) || userContext.IsSmsEnabled)) || (addressOrigin == AddressOrigin.Directory && (!userContext.IsFeatureEnabled(Feature.GlobalAddressList) || userContext.IsSmsEnabled))) && displayName != null)
            {
                writer.Write("\" _dn=\"");
                Utilities.SanitizeHtmlEncode(displayName, writer);
            }
            if (!flag && alias != null)
            {
                writer.Write("\" _al=\"");
                Utilities.SanitizeHtmlEncode(alias, writer);
            }
            writer.Write("\">");
            if (userContext.IsInstantMessageEnabled() && flag && !string.IsNullOrEmpty(routingType) && ((string.CompareOrdinal(routingType, "EX") == 0 && (recipientFlags & 1) == 0) || string.CompareOrdinal(routingType, "SMTP") == 0))
            {
                RenderingUtilities.RenderPresenceJellyBean(writer, userContext, true, "onRwCmJb(event);", false, null);
            }
            if (displayName != null)
            {
                Utilities.SanitizeHtmlEncode(displayName, writer);
            }
            RecipientWellNode.RenderFormattedAddress(writer, userContext, displayName, smtpAddress, routingAddress, routingType);
            writer.Write("</span>");
            if (!flag)
            {
                writer.Write("</span>");
            }
            return(true);
        }
Ejemplo n.º 3
0
        public static void RemoveInvalidRecipientsFromSmsMessage(MessageItem message)
        {
            Dictionary <RecipientItemType, List <string> > dictionary = null;
            int i = message.Recipients.Count - 1;

            while (i >= 0)
            {
                Participant participant  = message.Recipients[i].Participant;
                string      routingType  = participant.RoutingType;
                string      emailAddress = participant.EmailAddress;
                if (string.Equals(routingType, "SMTP", StringComparison.OrdinalIgnoreCase) && ImceaAddress.IsImceaAddress(emailAddress))
                {
                    Utilities.TryDecodeImceaAddress(participant.EmailAddress, ref routingType, ref emailAddress);
                }
                if (Utilities.IsMobileRoutingType(routingType))
                {
                    if (string.IsNullOrEmpty(Utilities.NormalizePhoneNumber(emailAddress)))
                    {
                        goto IL_D3;
                    }
                }
                else
                {
                    if (string.Equals(routingType, "EX", StringComparison.OrdinalIgnoreCase))
                    {
                        if (dictionary == null)
                        {
                            dictionary = new Dictionary <RecipientItemType, List <string> >(3);
                        }
                        RecipientItemType recipientItemType = message.Recipients[i].RecipientItemType;
                        if (!dictionary.ContainsKey(recipientItemType))
                        {
                            dictionary[recipientItemType] = new List <string>(message.Recipients.Count - 1);
                        }
                        dictionary[recipientItemType].Add(emailAddress);
                        goto IL_D3;
                    }
                    goto IL_D3;
                }
IL_DF:
                i--;
                continue;
IL_D3:
                message.Recipients.RemoveAt(i);
                goto IL_DF;
            }
            if (dictionary == null || dictionary.Count == 0)
            {
                return;
            }
            IRecipientSession recipientSession = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, UserContextManager.GetUserContext());

            foreach (KeyValuePair <RecipientItemType, List <string> > keyValuePair in dictionary)
            {
                Result <ADRawEntry>[] array = recipientSession.FindByLegacyExchangeDNs(keyValuePair.Value.ToArray(), new PropertyDefinition[]
                {
                    ADRecipientSchema.DisplayName,
                    ADOrgPersonSchema.MobilePhone
                });
                if (array != null && array.Length != 0)
                {
                    foreach (Result <ADRawEntry> result in array)
                    {
                        if (result.Data != null)
                        {
                            string text  = result.Data[ADRecipientSchema.DisplayName] as string;
                            string text2 = Utilities.NormalizePhoneNumber(result.Data[ADOrgPersonSchema.MobilePhone] as string);
                            if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2))
                            {
                                message.Recipients.Add(new Participant(text, text2, "MOBILE"), keyValuePair.Key);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected override void OnLoad(EventArgs e)
        {
            if (Redir.IsUrlRefererFBALogonPage(base.Request.UrlReferrer))
            {
                Utilities.EndResponse(this.Context, HttpStatusCode.Forbidden);
            }
            string queryStringParameter;
            bool   signedUrl = Redir.GetSignedUrl(base.Request, base.UserContext.Key.Canary.UserContextIdGuid, base.UserContext.Key.Canary.LogonUniqueKey, out queryStringParameter);

            if (!signedUrl)
            {
                queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "URL");
            }
            string queryStringParameter2 = Utilities.GetQueryStringParameter(base.Request, "TranslatedURL", false);
            bool   flag  = !string.IsNullOrEmpty(queryStringParameter2);
            bool   flag2 = string.IsNullOrEmpty(Utilities.GetQueryStringParameter(base.Request, "NoDocLnkCls", false));

            if (Redir.IsSafeUrl(queryStringParameter, base.Request))
            {
                ErrorInformation errorInformation = null;
                Uri uri;
                if (null == (uri = Utilities.TryParseUri(queryStringParameter)))
                {
                    Utilities.EndResponse(this.Context, HttpStatusCode.Forbidden);
                }
                string scheme = uri.Scheme;
                if (CultureInfo.InvariantCulture.CompareInfo.Compare(scheme, "mailto", CompareOptions.IgnoreCase) == 0)
                {
                    StringBuilder stringBuilder = new StringBuilder(512);
                    stringBuilder.Append(OwaUrl.ApplicationRoot.GetExplicitUrl(base.OwaContext));
                    stringBuilder.Append("?ae=Item&a=New&t=");
                    string value = "IPM.Note";
                    if (base.UserContext.IsSmsEnabled)
                    {
                        int length = "mailto:".Length;
                        if (queryStringParameter.Length > length)
                        {
                            string       inputString = queryStringParameter.Substring(length);
                            Participant  participant;
                            ProxyAddress proxyAddress;
                            if (Participant.TryParse(inputString, out participant) && ImceaAddress.IsImceaAddress(participant.EmailAddress) && SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress) && Utilities.IsMobileRoutingType(proxyAddress.PrefixString))
                            {
                                value = "IPM.Note.Mobile.SMS";
                            }
                        }
                    }
                    stringBuilder.Append(value);
                    stringBuilder.Append('&');
                    stringBuilder.Append("email");
                    stringBuilder.Append('=');
                    stringBuilder.Append(Utilities.UrlEncode(queryStringParameter));
                    this.safeUrl = stringBuilder.ToString();
                    this.isNewMailLinkCreated = true;
                    return;
                }
                if (flag2)
                {
                    this.safeUrl = this.TryNavigateToInternalWssUnc(queryStringParameter, out errorInformation);
                }
                if (this.safeUrl == null)
                {
                    if (flag && Redir.IsSafeUrl(queryStringParameter2, base.Request))
                    {
                        this.safeUrl = queryStringParameter2;
                    }
                    else
                    {
                        if (errorInformation != null)
                        {
                            Utilities.TransferToErrorPage(base.OwaContext, errorInformation);
                            return;
                        }
                        this.safeUrl = queryStringParameter;
                    }
                }
            }
            else if (flag && Redir.IsSafeUrl(queryStringParameter2, base.Request))
            {
                this.safeUrl = queryStringParameter2;
            }
            else
            {
                Utilities.EndResponse(this.Context, HttpStatusCode.Forbidden);
            }
            if (!signedUrl)
            {
                throw new OwaInvalidCanary14Exception(null, "Invalid canary in redir.aspx query.");
            }
        }