From 0a2a48b42894a1bae7f956ac5eff685d439ad09b Mon Sep 17 00:00:00 2001
From: Cinders <cinder@cinderblocks.biz>
Date: Wed, 12 Aug 2015 08:05:14 -0600
Subject: [PATCH] Parse x-grid-location-info slurs in LLUrlEntrySLLabels too

---
 indra/llui/llurlentry.cpp            | 5 +++--
 indra/llui/tests/llurlentry_test.cpp | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index b11e645d20..45c8a6865f 100755
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -43,6 +43,7 @@
 #include <boost/format.hpp> // <alchemy/>
 
 #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+(:\\d+)?/app)|(secondlife:///app))"
+#define X_GRID_OR_SECONDLIFE_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+(:\\d+)?/)|(secondlife://))"
 
 // Utility functions
 std::string localize_slapp_label(const std::string& url, const std::string& full_name);
@@ -1243,7 +1244,7 @@ std::string LLUrlEntryTeleport::getLocation(const std::string &url) const
 //
 LLUrlEntrySL::LLUrlEntrySL()
 {
-	mPattern = boost::regex("secondlife://(\\w+)?(:\\d+)?/\\S+",
+	mPattern = boost::regex(X_GRID_OR_SECONDLIFE_HEADER_REGEX "(\\w+)?(:\\d+)?/\\S+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slapp.xml";
 	mTooltip = LLTrans::getString("TooltipSLAPP");
@@ -1260,7 +1261,7 @@ std::string LLUrlEntrySL::getLabel(const std::string &url, const LLUrlLabelCallb
 //
 LLUrlEntrySLLabel::LLUrlEntrySLLabel()
 {
-	mPattern = boost::regex("\\[secondlife://\\S+[ \t]+[^\\]]+\\]",
+	mPattern = boost::regex("\\[" X_GRID_OR_SECONDLIFE_HEADER_REGEX "\\S+[ \t]+[^\\]]+\\]",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slapp.xml";
 	mTooltip = LLTrans::getString("TooltipSLAPP");
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 8a68f00e98..60238ecf77 100755
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -684,6 +684,10 @@ namespace tut
 		testRegex("teleport slurl with label", url,
 				  "XXX [secondlife:///app/teleport/Ahern/50/50/50/ Teleport to Ahern] YYY",
 				  "secondlife:///app/teleport/Ahern/50/50/50/");
+		
+		testRegex("Standalone agent slurl with label", url,
+				  "[x-grid-location-info://my.grid.com:8002/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about  Profile]",
+				  "x-grid-location-info://my.grid.com:8002/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");
 	}
 
 	template<> template<>
-- 
GitLab