diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 08b56d0996..fa91490036 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2638,7 +2638,10 @@ void LLTextBase::appendTextImpl(const std::string& new_text, const LLStyle::Para
LLUrlMatch match;
std::string text = new_text;
while (LLUrlRegistry::instance().findUrl(text, match,
- boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3), isContentTrusted() || mAlwaysShowIcons, force_slurl))
+ // Pass nearby-chat flag for labeled-link masking
+ // boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3), isContentTrusted() || mAlwaysShowIcons, force_slurl))
+ boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3), isContentTrusted() || mAlwaysShowIcons, force_slurl, mNearbyChatContent))
+ //
{
start = match.getStart();
end = match.getEnd()+1;
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index debe440205..4947d52a5a 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -478,6 +478,10 @@ public:
bool isContentTrusted() const { return mTrustedContent; }
void setContentTrusted(bool trusted_content) { mTrustedContent = trusted_content; }
+ // Selects the nearby-chat labeled-link setting (FSDisableLabeledChatLinksNearbyChat) for this editor's content
+ void setNearbyChatContent(bool nearby_chat_content) { mNearbyChatContent = nearby_chat_content; }
+ //
+
// TODO: move into LLTextSegment?
void createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url
@@ -826,6 +830,7 @@ protected:
bool mClip; // clip text to widget rect
bool mClipPartial; // false if we show lines that are partially inside bounding rect
bool mTrustedContent; // if false, does not allow to execute SURL links from this editor
+ bool mNearbyChatContent { false }; // if true, labeled-link masking uses the nearby chat setting
bool mPlainText; // didn't use Image or Icon segments
bool mAutoIndent;
S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 816e9bb22f..176afb57f7 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -225,7 +225,10 @@ static bool stringHasJira(const std::string &text)
text.find("WEB") != std::string::npos);
}
-bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted, bool skip_non_mentions)
+// Option to disable bracket links needs is_nearby_chat here
+// bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted, bool skip_non_mentions)
+bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted, bool skip_non_mentions, bool is_nearby_chat)
+//
{
// avoid costly regexes if there is clearly no URL in the text
if (! (stringHasUrl(text) || stringHasJira(text)))
@@ -253,7 +256,8 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
// Option to disable square-bracket links (intentionally ignores secondlife:// and hop://)
static LLUICachedControl sDisableLabeledLinks("FSDisableLabeledChatLinks", false);
- if (!is_content_trusted && (mUrlEntryHTTPLabel == *it) && sDisableLabeledLinks)
+ static LLUICachedControl sDisableLabeledLinksNearby("FSDisableLabeledChatLinksNearbyChat", false);
+ if (!is_content_trusted && (mUrlEntryHTTPLabel == *it) && (is_nearby_chat ? sDisableLabeledLinksNearby : sDisableLabeledLinks))
{
continue;
}
diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h
index 783b9e55cc..30003af1a1 100644
--- a/indra/llui/llurlregistry.h
+++ b/indra/llui/llurlregistry.h
@@ -75,7 +75,8 @@ public:
/// your callback is invoked if the matched Url's label changes in the future
bool findUrl(const std::string &text, LLUrlMatch &match,
const LLUrlLabelCallback &cb = &LLUrlRegistryNullCallback,
- bool is_content_trusted = false, bool skip_non_mentions = false);
+ bool is_content_trusted = false, bool skip_non_mentions = false,
+ bool is_nearby_chat = false); // Option to disable bracket links needs is_nearby_chat here
/// a slightly less efficient version of findUrl for wide strings
bool findUrl(const LLWString &text, LLUrlMatch &match,
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 1740bfab8f..f6b23882a0 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -19658,7 +19658,18 @@ Change of this parameter will affect the layout of buttons in notification toast
FSDisableLabeledChatLinks
+ FSDisableLabeledChatLinksNearbyChat
+