1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Display correclty what the user write and open correctly link with 'http://'

This commit is contained in:
TheNain38 2015-09-27 13:58:18 +02:00
parent 42c29c8b8f
commit c6c3150803

View File

@ -204,10 +204,12 @@ QString ChatMessage::detectAnchors(const QString &str)
offset += url.length();
continue;
}
QString htmledUrl;
// add scheme if not specified
if (exp.cap(2) == "www.")
url.prepend("http://");
QString htmledUrl = QString("<a href=\"%1\">%1</a>").arg(url);
htmledUrl = QString("<a href=\"http://%1\">%1</a>").arg(url);
else
htmledUrl = QString("<a href=\"%1\">%1</a>").arg(url);
out.replace(offset, exp.cap().length(), htmledUrl);
offset += htmledUrl.length();
}