summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-11 21:10:53 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-11 21:10:53 +0100
commit66599a9896e0cf69b58c0a73152aba4750d87af2 (patch)
tree034b6b4a05ea1b4fc87887f48734f630e757e6f7 /src/utils
parent0694d89c4147882561ff44c6d0d80e7414dcb24a (diff)
downloadmana-66599a9896e0cf69b58c0a73152aba4750d87af2.tar.gz
mana-66599a9896e0cf69b58c0a73152aba4750d87af2.tar.bz2
mana-66599a9896e0cf69b58c0a73152aba4750d87af2.tar.xz
mana-66599a9896e0cf69b58c0a73152aba4750d87af2.zip
Implemented ability to open external links in news and chat
* Use ConfirmDialog to confirm the opening of the external link. * ConfirmDialog now centers on its parent window when provided. * Reset hovered link when mouse exits the BrowserBox.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index cd80b60f..8e5f1102 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -121,6 +121,14 @@ std::string removeColors(std::string msg);
int compareStrI(const std::string &a, const std::string &b);
/**
+ * Returns whether a string starts with a given prefix.
+ */
+inline bool startsWith(const std::string &str, const char *prefix)
+{
+ return str.rfind(prefix, 0) == 0;
+}
+
+/**
* Tells wether the character is a word separator.
*/
bool isWordSeparator(char chr);