diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llurlentry.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 20 | ||||
-rw-r--r-- | indra/llui/llurlregistry.h | 4 |
3 files changed, 25 insertions, 1 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 95dc2ce027..983f0a2d49 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -80,7 +80,7 @@ std::string LLUrlEntryBase::escapeUrl(const std::string &url) const "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" - "-._~!$?&()*+,@:;=/%"; + "-._~!$?&()*+,@:;=/%#"; std::sort(no_escape_chars.begin(), no_escape_chars.end()); initialized = true; diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index afcff0d409..ad5c0911f8 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -223,3 +223,23 @@ bool LLUrlRegistry::hasUrl(const LLWString &text) LLUrlMatch match; return findUrl(text, match); } + +bool LLUrlRegistry::isUrl(const std::string &text) +{ + LLUrlMatch match; + if (findUrl(text, match)) + { + return (match.getStart() == 0 && match.getEnd() >= text.size()-1); + } + return false; +} + +bool LLUrlRegistry::isUrl(const LLWString &text) +{ + LLUrlMatch match; + if (findUrl(text, match)) + { + return (match.getStart() == 0 && match.getEnd() >= text.size()-1); + } + return false; +} diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index d7800d8cfc..399ee0a988 100644 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h @@ -85,6 +85,10 @@ public: bool hasUrl(const std::string &text); bool hasUrl(const LLWString &text); + // return true if the given string is a URL that findUrl would match + bool isUrl(const std::string &text); + bool isUrl(const LLWString &text); + private: LLUrlRegistry(); friend class LLSingleton<LLUrlRegistry>; |