summaryrefslogtreecommitdiff
path: root/indra/llui/llurlregistry.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-05-09 06:42:28 +0800
committerErik Kundiman <erik@megapahit.org>2025-05-09 06:42:28 +0800
commitc06c7e0b0eb4b7a7aaa70a3559b08b18c73aea17 (patch)
tree1a460744fcb104f56cd28af927f4cb3d2a18cdc8 /indra/llui/llurlregistry.cpp
parent5ced1ff13ffce84e052500eb8fa898ba24bc5d93 (diff)
parent377d1b3813077619fc795f54f93b0d478cf03cbd (diff)
Merge tag 'Second_Life_Release#377d1b38-2025.04' into 2025.04
Diffstat (limited to 'indra/llui/llurlregistry.cpp')
-rw-r--r--indra/llui/llurlregistry.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 02d88c83fb..cb101d325d 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -327,3 +327,30 @@ void LLUrlRegistry::setKeybindingHandler(LLKeyBindingToStringHandler* handler)
LLUrlEntryKeybinding *entry = (LLUrlEntryKeybinding*)mUrlEntryKeybinding;
entry->setHandler(handler);
}
+
+bool LLUrlRegistry::containsAgentMention(const std::string& text)
+{
+ // avoid costly regexes if there is clearly no URL in the text
+ if (!stringHasUrl(text))
+ {
+ return false;
+ }
+
+ try
+ {
+ boost::sregex_iterator it(text.begin(), text.end(), mUrlEntryAgentMention->getPattern());
+ boost::sregex_iterator end;
+ for (; it != end; ++it)
+ {
+ if (mUrlEntryAgentMention->isAgentID(it->str()))
+ {
+ return true;
+ }
+ }
+ }
+ catch (boost::regex_error&)
+ {
+ LL_INFOS() << "Regex error for: " << text << LL_ENDL;
+ }
+ return false;
+}