2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Support t.me/+phonenumber links.

This commit is contained in:
John Preston
2022-03-01 14:44:29 +03:00
parent f7957a8903
commit bea2cfd363
6 changed files with 81 additions and 21 deletions

View File

@@ -914,6 +914,18 @@ void Session::unregisterInvitedToCallUser(
}
}
UserData *Session::userByPhone(const QString &phone) const {
const auto pname = phone.trimmed();
for (const auto &[peerId, peer] : _peers) {
if (const auto user = peer->asUser()) {
if (user->phone() == pname) {
return user;
}
}
}
return nullptr;
}
PeerData *Session::peerByUsername(const QString &username) const {
const auto uname = username.trimmed();
for (const auto &[peerId, peer] : _peers) {