diff options
| author | Cinder <cinder@sdf.org> | 2015-04-11 15:23:06 -0600 |
|---|---|---|
| committer | Cinder <cinder@sdf.org> | 2015-04-11 15:23:06 -0600 |
| commit | 5a282abe184323643f1a88f2aba662648059b4e2 (patch) | |
| tree | 7812f302365118cb017d71f768cb4583abc24f25 /indra/llui/llurlentry.cpp | |
| parent | 5c6cf3e7fb9f592e3a293921175b64b515bac23f (diff) | |
STORM-2113 - uri parsing cleanup and fixes
Diffstat (limited to 'indra/llui/llurlentry.cpp')
| -rwxr-xr-x | indra/llui/llurlentry.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 7e4104c49b..52e6965f33 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -39,8 +39,6 @@ #include "lluicolortable.h" #include "message.h" -#include "uriparser/Uri.h" - #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))" // Utility functions @@ -347,27 +345,36 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const // // LLUrlEntrySeconlifeURLs Describes *secondlife.com and *lindenlab.com urls to substitute icon 'hand.png' before link // -LLUrlEntrySeconlifeURL::LLUrlEntrySeconlifeURL() +LLUrlEntrySecondlifeURL::LLUrlEntrySecondlifeURL() { mPattern = boost::regex("\\b(https?://)?([-\\w\\.]*\\.)?(secondlife|lindenlab)\\.com(:\\d{1,5})?(/\\S*)?\\b", boost::regex::perl|boost::regex::icase); mIcon = "Hand"; mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); } -std::string LLUrlEntrySeconlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +/// Return the url from a string that matched the regex +std::string LLUrlEntrySecondlifeURL::getUrl(const std::string &string) const { - LLUriParser up(url); - up.extractParts(); - return up.host(); + if (string.find("://") == std::string::npos) + { + return "https://" + escapeUrl(string); + } + return escapeUrl(string); } -std::string LLUrlEntrySeconlifeURL::getTooltip(const std::string &url) const +std::string LLUrlEntrySecondlifeURL::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { return url; } +std::string LLUrlEntrySecondlifeURL::getTooltip(const std::string &url) const +{ + return mTooltip; +} + // // LLUrlEntryAgent Describes a Second Life agent Url, e.g., // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about |
