mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-01 12:00:48 +00:00
Support username.t.me links.
This commit is contained in:
parent
5530df8f2d
commit
010b5e3949
@ -876,6 +876,13 @@ QString TryConvertUrlToLocal(QString url) {
|
||||
|
||||
using namespace qthelp;
|
||||
auto matchOptions = RegExOption::CaseInsensitive;
|
||||
auto subdomainMatch = regex_match(qsl("^(https?://)?([a-zA-Z0-9\\_]+)\\.t\\.me/?(\\?.+)?"), url, matchOptions);
|
||||
if (subdomainMatch) {
|
||||
const auto name = subdomainMatch->captured(2);
|
||||
if (name.size() > 1 && name != "www") {
|
||||
url = subdomainMatch->captured(1) + "t.me/" + name + subdomainMatch->captured(3);
|
||||
}
|
||||
}
|
||||
auto telegramMeMatch = regex_match(qsl("^(https?://)?(www\\.)?(telegram\\.(me|dog)|t\\.me)/(.+)$"), url, matchOptions);
|
||||
if (telegramMeMatch) {
|
||||
auto query = telegramMeMatch->capturedView(5);
|
||||
|
Loading…
Reference in New Issue
Block a user