about summary refs log tree commit diff
path: root/packages/telegram-no-ads.patch
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-01-14 13:27:50 +0300
committerazahi <azat@bahawi.net>2025-01-14 13:27:50 +0300
commitb8ea365ca8eb801f8c8442f2f9ab439343ed8b8f (patch)
treefe46f6e8f0da8d8525e486290cca3079679b363d /packages/telegram-no-ads.patch
parent2025-01-06 (diff)
2025-01-14
Diffstat (limited to '')
-rw-r--r--packages/telegram-no-ads.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/packages/telegram-no-ads.patch b/packages/telegram-no-ads.patch
new file mode 100644
index 0000000..1b34920
--- /dev/null
+++ b/packages/telegram-no-ads.patch
@@ -0,0 +1,61 @@
+diff --git i/Telegram/SourceFiles/data/components/sponsored_messages.cpp w/Telegram/SourceFiles/data/components/sponsored_messages.cpp
+index 5ae9d8b2c..f116246b5 100644
+--- i/Telegram/SourceFiles/data/components/sponsored_messages.cpp
++++ w/Telegram/SourceFiles/data/components/sponsored_messages.cpp
+@@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
+ namespace Data {
+ namespace {
+ 
+-constexpr auto kRequestTimeLimit = 5 * 60 * crl::time(1000);
++constexpr auto kRequestTimeLimit = 9999999 * 60 * crl::time(1000);
+ 
+ [[nodiscard]] bool TooEarlyForRequest(crl::time received) {
+ 	return (received > 0) && (received + kRequestTimeLimit > crl::now());
+@@ -74,6 +74,9 @@ void SponsoredMessages::clearOldRequests() {
+ 
+ SponsoredMessages::AppendResult SponsoredMessages::append(
+ 		not_null<History*> history) {
++	if (1) {
++		return;
++	}
+ 	if (isTopBarFor(history)) {
+ 		return SponsoredMessages::AppendResult::None;
+ 	}
+@@ -110,6 +113,9 @@ void SponsoredMessages::inject(
+ 		MsgId injectAfterMsgId,
+ 		int betweenHeight,
+ 		int fallbackWidth) {
++	if (1) {
++		return;
++	}
+ 	if (!canHaveFor(history)) {
+ 		return;
+ 	}
+@@ -210,24 +216,17 @@ void SponsoredMessages::inject(
+ }
+ 
+ bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
+-	if (history->peer->isChannel()) {
+-		return true;
+-	} else if (const auto user = history->peer->asUser()) {
+-		return user->isBot();
+-	}
+ 	return false;
+ }
+ 
+ bool SponsoredMessages::isTopBarFor(not_null<History*> history) const {
+-	if (peerIsUser(history->peer->id)) {
+-		if (const auto user = history->peer->asUser()) {
+-			return user->isBot();
+-		}
+-	}
+ 	return false;
+ }
+ 
+ void SponsoredMessages::request(not_null<History*> history, Fn<void()> done) {
++	if (1) {
++		return;
++	}
+ 	if (!canHaveFor(history)) {
+ 		return;
+ 	}

Consider giving Nix/NixOS a try! <3