From 66599a9896e0cf69b58c0a73152aba4750d87af2 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 11 Mar 2024 21:10:53 +0100 Subject: 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. --- src/utils/stringutils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils/stringutils.h') 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 @@ -120,6 +120,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. */ -- cgit v1.2.3-70-g09d2