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

Request sponsored peers in global search.

This commit is contained in:
John Preston
2025-03-20 10:26:39 +04:00
parent a2a16f3f23
commit 7f2545a9ef
6 changed files with 300 additions and 128 deletions

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "api/api_peer_search.h"
#include "base/timer.h"
#include "dialogs/dialogs_key.h"
#include "window/section_widget.h"
@@ -188,9 +189,7 @@ private:
const MTPmessages_Messages &result,
not_null<SearchProcessState*> process,
bool cacheResults = false);
void peerSearchReceived(
const MTPcontacts_Found &result,
mtpRequestId requestId);
void peerSearchReceived(Api::PeerSearchResult result);
void escape();
void submit();
void cancelSearchRequest();
@@ -213,7 +212,7 @@ private:
void collectStoriesUserpicsViews(Data::StorySourcesList list);
void storiesToggleExplicitExpand(bool expand);
void trackScroll(not_null<Ui::RpWidget*> widget);
[[nodiscard]] bool searchForPeersRequired(const QString &query) const;
[[nodiscard]] bool peerSearchRequired() const;
[[nodiscard]] bool searchForTopicsRequired(const QString &query) const;
// Child list may be unable to set specific search state.
@@ -267,11 +266,9 @@ private:
SearchRequestType type,
const MTP::Error &error,
not_null<SearchProcessState*> process);
void peerSearchFailed(const MTP::Error &error, mtpRequestId requestId);
void searchApplyEmpty(
SearchRequestType type,
not_null<SearchProcessState*> process);
void peerSearchApplyEmpty(mtpRequestId id);
void updateForceDisplayWide();
void scrollToDefault(bool verytop = false);
@@ -373,10 +370,6 @@ private:
base::Timer _searchTimer;
QString _peerSearchQuery;
bool _peerSearchFull = false;
mtpRequestId _peerSearchRequest = 0;
QString _topicSearchQuery;
TimeId _topicSearchOffsetDate = 0;
MsgId _topicSearchOffsetId = 0;
@@ -399,9 +392,8 @@ private:
SearchProcessState _postsProcess;
int _historiesRequest = 0; // Not real mtpRequestId.
Api::PeerSearch _peerSearch;
Api::SingleMessageSearch _singleMessageSearch;
base::flat_map<QString, MTPcontacts_Found> _peerSearchCache;
base::flat_map<mtpRequestId, QString> _peerSearchQueries;
QPixmap _widthAnimationCache;