summaryrefslogtreecommitdiff
path: root/patches/telegram-desktop-no-ads.patch
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-13 10:40:41 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-13 10:40:41 +0300
commita3f9fde2a2d43dd477f402bd4b8df2a1cd29ca43 (patch)
treecbd0c2457daa6865eb33b5389ec40309e60868a9 /patches/telegram-desktop-no-ads.patch
parent011c1632f3762e1bc1ecfdee9d9f3b3f44be74e5 (diff)
2023-11-13
Diffstat (limited to 'patches/telegram-desktop-no-ads.patch')
-rw-r--r--patches/telegram-desktop-no-ads.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/telegram-desktop-no-ads.patch b/patches/telegram-desktop-no-ads.patch
new file mode 100644
index 0000000..d066066
--- /dev/null
+++ b/patches/telegram-desktop-no-ads.patch
@@ -0,0 +1,45 @@
+diff --git i/Telegram/SourceFiles/data/data_sponsored_messages.cpp w/Telegram/SourceFiles/data/data_sponsored_messages.cpp
+index fa21af469..263ea3e61 100644
+--- i/Telegram/SourceFiles/data/data_sponsored_messages.cpp
++++ w/Telegram/SourceFiles/data/data_sponsored_messages.cpp
+@@ -179,39 +179,7 @@ bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
+ }
+
+ void SponsoredMessages::request(not_null<History*> history, Fn<void()> done) {
+- if (!canHaveFor(history)) {
+- return;
+- }
+- auto &request = _requests[history];
+- if (request.requestId || TooEarlyForRequest(request.lastReceived)) {
+- return;
+- }
+- {
+- const auto it = _data.find(history);
+- if (it != end(_data)) {
+- auto &list = it->second;
+- // Don't rebuild currently displayed messages.
+- const auto proj = [](const Entry &e) {
+- return e.item != nullptr;
+- };
+- if (ranges::any_of(list.entries, proj)) {
+- return;
+- }
+- }
+- }
+- const auto channel = history->peer->asChannel();
+- Assert(channel != nullptr);
+- request.requestId = _session->api().request(
+- MTPchannels_GetSponsoredMessages(
+- channel->inputChannel)
+- ).done([=](const MTPmessages_sponsoredMessages &result) {
+- parse(history, result);
+- if (done) {
+- done();
+- }
+- }).fail([=] {
+- _requests.remove(history);
+- }).send();
++ return;
+ }
+
+ void SponsoredMessages::parse(