MAINT-5019 FIXED Additional cases
parent
ca6a9d1635
commit
078612e292
|
|
@ -293,11 +293,7 @@ std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string) const
|
|||
LLUrlEntryHTTPNoProtocol::LLUrlEntryHTTPNoProtocol()
|
||||
: LLUrlEntryBase()
|
||||
{
|
||||
mPattern = boost::regex("("
|
||||
"\\bwww\\.\\S+\\.\\S+" // i.e. www.FOO.BAR
|
||||
"|" // or
|
||||
"(?<!@)\\b[^[:space:]:@/>]+\\.(?:com|net|edu|org)([/:][^[:space:]<]*)?\\b" // i.e. FOO.net
|
||||
")",
|
||||
mPattern = boost::regex("\\bwww\\.\\S+\\.\\S+", // i.e. www.FOO.BAR
|
||||
boost::regex::perl|boost::regex::icase);
|
||||
mMenuName = "menu_url_http.xml";
|
||||
mTooltip = LLTrans::getString("TooltipHttpUrl");
|
||||
|
|
@ -1401,6 +1397,40 @@ std::string LLUrlEntryIcon::getIcon(const std::string &url)
|
|||
return mIcon;
|
||||
}
|
||||
|
||||
//
|
||||
// LLUrlEntryEmail Describes a generic mailto: Urls
|
||||
//
|
||||
LLUrlEntryEmail::LLUrlEntryEmail()
|
||||
: LLUrlEntryBase()
|
||||
{
|
||||
mPattern = boost::regex("(mailto:)?[\\w\\.\\-]+@[\\w\\.\\-]+\\.[a-z]{2,6}",
|
||||
boost::regex::perl | boost::regex::icase);
|
||||
mMenuName = "menu_url_email.xml";
|
||||
mTooltip = LLTrans::getString("TooltipEmail");
|
||||
}
|
||||
|
||||
std::string LLUrlEntryEmail::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
|
||||
{
|
||||
int pos = url.find("mailto:");
|
||||
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
return escapeUrl(url);
|
||||
}
|
||||
|
||||
std::string ret = escapeUrl(url.substr(pos + 7, url.length() - pos + 8));
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string LLUrlEntryEmail::getUrl(const std::string &string) const
|
||||
{
|
||||
if (string.find("mailto:") == std::string::npos)
|
||||
{
|
||||
return "mailto:" + escapeUrl(string);
|
||||
}
|
||||
return escapeUrl(string);
|
||||
}
|
||||
|
||||
LLUrlEntryExperienceProfile::LLUrlEntryExperienceProfile()
|
||||
{
|
||||
mPattern = boost::regex(APP_HEADER_REGEX "/experience/[\\da-f-]+/\\w+\\S*",
|
||||
|
|
|
|||
|
|
@ -506,5 +506,16 @@ public:
|
|||
/*virtual*/ std::string getIcon(const std::string &url);
|
||||
};
|
||||
|
||||
///
|
||||
/// LLUrlEntryEmail Describes a generic mailto: Urls
|
||||
///
|
||||
class LLUrlEntryEmail : public LLUrlEntryBase
|
||||
{
|
||||
public:
|
||||
LLUrlEntryEmail();
|
||||
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
|
||||
/*virtual*/ std::string getUrl(const std::string &string) const;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -76,9 +76,10 @@ LLUrlRegistry::LLUrlRegistry()
|
|||
registerUrl(new LLUrlEntrySL());
|
||||
mUrlEntrySLLabel = new LLUrlEntrySLLabel();
|
||||
registerUrl(mUrlEntrySLLabel);
|
||||
// most common pattern is a URL without any protocol,
|
||||
// e.g., "secondlife.com"
|
||||
// most common pattern is a URL without any protocol starting with "www",
|
||||
// e.g., "www.secondlife.com"
|
||||
registerUrl(new LLUrlEntryHTTPNoProtocol());
|
||||
registerUrl(new LLUrlEntryEmail());
|
||||
}
|
||||
|
||||
LLUrlRegistry::~LLUrlRegistry()
|
||||
|
|
@ -155,11 +156,9 @@ static bool stringHasUrl(const std::string &text)
|
|||
return (text.find("://") != std::string::npos ||
|
||||
text.find("www.") != std::string::npos ||
|
||||
text.find(".com") != std::string::npos ||
|
||||
text.find(".net") != std::string::npos ||
|
||||
text.find(".edu") != std::string::npos ||
|
||||
text.find(".org") != std::string::npos ||
|
||||
text.find("<nolink>") != std::string::npos ||
|
||||
text.find("<icon") != std::string::npos);
|
||||
text.find("<icon") != std::string::npos ||
|
||||
text.find("@") != std::string::npos);
|
||||
}
|
||||
|
||||
bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted)
|
||||
|
|
@ -218,7 +217,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
|
|||
// did we find a match? if so, return its details in the match object
|
||||
if (match_entry)
|
||||
{
|
||||
// Skip if link is an email. See MAINT-5371.
|
||||
// Skip if link is an email with an empty username (starting with @). See MAINT-5371.
|
||||
if (match_start > 0 && text.substr(match_start - 1, 1) == "@")
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ LLSplashScreen *gSplashScreenp = NULL;
|
|||
BOOL gDebugClicks = FALSE;
|
||||
BOOL gDebugWindowProc = FALSE;
|
||||
|
||||
const S32 gURLProtocolWhitelistCount = 4;
|
||||
const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:" };
|
||||
const S32 gURLProtocolWhitelistCount = 5;
|
||||
const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:", "mailto:" };
|
||||
|
||||
// CP: added a handler list - this is what's used to open the protocol and is based on registry entry
|
||||
// only meaningful difference currently is that file: protocols are opened using http:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<context_menu
|
||||
layout="topleft"
|
||||
name="Email Popup">
|
||||
<menu_item_call
|
||||
label="Compose Email in an External client"
|
||||
layout="topleft"
|
||||
name="email_open_external">
|
||||
<menu_item_call.on_click
|
||||
function="Url.OpenExternal" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
layout="topleft" />
|
||||
<menu_item_call
|
||||
label="Copy Email to clipboard"
|
||||
layout="topleft"
|
||||
name="email_copy">
|
||||
<menu_item_call.on_click
|
||||
function="Url.CopyLabel" />
|
||||
</menu_item_call>
|
||||
</context_menu>
|
||||
|
|
@ -271,6 +271,7 @@ Please try logging in again in a minute.</string>
|
|||
<string name="TooltipMapUrl">Click to view this location on a map</string>
|
||||
<string name="TooltipSLAPP">Click to run the secondlife:// command</string>
|
||||
<string name="CurrentURL" value=" CurrentURL: [CurrentURL]" />
|
||||
<string name="TooltipEmail">Click to compose an email</string>
|
||||
|
||||
<!-- text for SLURL labels -->
|
||||
<string name="SLurlLabelTeleport">Teleport to</string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue