2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Extract username from t.me/username searches.

This commit is contained in:
John Preston
2019-08-06 15:54:44 +01:00
parent 10e28913ca
commit f48732f813
4 changed files with 28 additions and 9 deletions

View File

@@ -812,17 +812,18 @@ bool Widget::onSearchMessages(bool searchCache) {
}
_searchQueries.insert(_searchRequest, _searchQuery);
}
if (searchForPeersRequired(q)) {
const auto query = Api::ConvertPeerSearchQuery(q);
if (searchForPeersRequired(query)) {
if (searchCache) {
auto i = _peerSearchCache.constFind(q);
auto i = _peerSearchCache.constFind(query);
if (i != _peerSearchCache.cend()) {
_peerSearchQuery = q;
_peerSearchQuery = query;
_peerSearchRequest = 0;
peerSearchReceived(i.value(), 0);
result = true;
}
} else if (_peerSearchQuery != q) {
_peerSearchQuery = q;
} else if (_peerSearchQuery != query) {
_peerSearchQuery = query;
_peerSearchFull = false;
_peerSearchRequest = MTP::send(
MTPcontacts_Search(
@@ -833,7 +834,7 @@ bool Widget::onSearchMessages(bool searchCache) {
_peerSearchQueries.insert(_peerSearchRequest, _peerSearchQuery);
}
} else {
_peerSearchQuery = q;
_peerSearchQuery = query;
_peerSearchFull = true;
peerSearchReceived(
MTP_contacts_found(