--- a/QTfrontend/ui/widget/chatwidget.cpp Wed Jul 18 01:35:59 2018 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp Wed Jul 18 02:05:05 2018 +0200
@@ -381,7 +381,10 @@
return QString("<span class=\"nick\">%1</span>").arg(nickname.toHtmlEscaped());
}
-const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)");
+// Regex to make some URLs clickable for selected domains:
+// - hedgewars.org (official website)
+// - hh.unit22.org (community addon server)
+const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((([^/:?&#]+\\.)?hedgewars\\.org|hh\\.unit22\\.org)(/[^ ]*)?)");
bool HWChatWidget::containsHighlight(const QString & sender, const QString & message)
{
@@ -401,7 +404,7 @@
QString HWChatWidget::messageToHTML(const QString & message)
{
QString formattedStr = message.toHtmlEscaped();
- // link some urls
+ // link some URLs
formattedStr = formattedStr.replace(URLREGEXP, "<a href=\"http\\2://\\4\">\\4</a>");
return formattedStr;
}