diff --git a/net-im/telegram-desktop/files/patches/0/0001_stdafx.patch b/net-im/telegram-desktop/files/patches/0/0001_stdafx.patch index 816840a7..4c34e3d4 100644 --- a/net-im/telegram-desktop/files/patches/0/0001_stdafx.patch +++ b/net-im/telegram-desktop/files/patches/0/0001_stdafx.patch @@ -9,11 +9,3 @@ #include #include -@@ -119,6 +121,7 @@ - - #include "base/basic_types.h" - #include "logs.h" -+#include "scheme.h" - #include "core/utils.h" - #include "config.h" - diff --git a/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch index f7d6a593..6d395a8f 100644 --- a/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch +++ b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch @@ -1,34 +1,46 @@ -diff -ru a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp ---- a/Telegram/SourceFiles/history/history_item_components.cpp 1970-01-01 06:00:00.000000000 +0600 -+++ b/Telegram/SourceFiles/history/history_item_components.cpp 2023-09-22 19:55:06.414790851 +0600 -@@ -552,7 +552,10 @@ - const auto pausedSpoiler = context.paused - || On(PowerSaving::kChatSpoiler); - if (w > st::msgReplyBarSkip) { -- if (replyToMsg || replyToStory) { -+ auto blocked = replyToMsg -+ && replyToMsg->from()->isUser() -+ && replyToMsg->from()->asUser()->isBlocked(); -+ if ((replyToMsg && (!blocked)) || replyToStory) { - const auto media = replyToMsg ? replyToMsg->media() : nullptr; - auto hasPreview = (replyToStory && replyToStory->hasReplyPreview()) || (media && media->hasReplyPreview()); - if (hasPreview && w < st::msgReplyBarSkip + st::msgReplyBarSize.height()) { -@@ -645,7 +648,10 @@ - } - - QString HistoryMessageReply::statePhrase() const { -- return (replyToMsgId || replyToStoryId) -+ auto blocked = replyToMsg -+ && replyToMsg->from()->isUser() -+ && replyToMsg->from()->asUser()->isBlocked(); -+ return ((replyToMsgId && (!blocked)) || replyToStoryId) - ? tr::lng_profile_loading(tr::now) - : storyReply - ? tr::lng_deleted_story(tr::now) -diff -ru a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp ---- a/Telegram/SourceFiles/history/history_widget.cpp 1970-01-01 06:00:00.000000000 +0600 -+++ b/Telegram/SourceFiles/history/history_widget.cpp 2023-09-22 20:00:03.007374659 +0600 -@@ -829,6 +829,21 @@ +diff -ur a/Telegram/SourceFiles/history/view/history_view_reply.cpp b/Telegram/SourceFiles/history/view/history_view_reply.cpp +--- a/Telegram/SourceFiles/history/view/history_view_reply.cpp 2023-11-07 08:54:22.057455500 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_reply.cpp 2023-11-09 19:43:28.914523641 +0600 +@@ -475,9 +475,12 @@ + + std::min(_text.maxWidth(), st::maxSignatureSize)), + st::normalFont->height); + _maxWidth = std::max(nameMaxWidth, optimalTextSize.width()); +- if (!data->displaying()) { ++ auto blocked = message ++ && message->from()->isUser() ++ && message->from()->asUser()->isBlocked(); ++ if (!data->displaying() || blocked) { + const auto unavailable = data->unavailable(); +- _stateText = ((fields.messageId || fields.storyId) && !unavailable) ++ _stateText = (((fields.messageId && (!blocked)) || fields.storyId) && !unavailable) + ? tr::lng_profile_loading(tr::now) + : fields.storyId + ? tr::lng_deleted_story(tr::now) +@@ -666,12 +669,15 @@ + + st::historyReplyPadding.top() + + (st::msgServiceNameFont->height * (_nameTwoLines ? 2 : 1)); + if (w > st::historyReplyPadding.left()) { +- if (_displaying) { ++ const auto data = view->data()->Get(); ++ const auto message = data ++ ? data->resolvedMessage.get() ++ : nullptr; ++ auto blocked = message ++ && message->from()->isUser() ++ && message->from()->asUser()->isBlocked(); ++ if (_displaying && (!blocked)) { + if (hasPreview) { +- const auto data = view->data()->Get(); +- const auto message = data +- ? data->resolvedMessage.get() +- : nullptr; + const auto media = message ? message->media() : nullptr; + const auto image = media + ? media->replyPreview() +diff -ur a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp +--- a/Telegram/SourceFiles/history/history_widget.cpp 2023-11-01 02:41:23.623049094 +0600 ++++ b/Telegram/SourceFiles/history/history_widget.cpp 2023-11-01 02:51:20.558082883 +0600 +@@ -813,6 +813,21 @@ } }, lifetime()); @@ -50,9 +62,9 @@ diff -ru a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFile _topBar->membersShowAreaActive( ) | rpl::start_with_next([=](bool active) { setMembersShowAreaActive(active); -diff -ru a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp ---- a/Telegram/SourceFiles/history/view/history_view_element.cpp 1970-01-01 06:00:00.000000000 +0600 -+++ b/Telegram/SourceFiles/history/view/history_view_element.cpp 2023-09-22 20:01:58.251711974 +0600 +diff -ur a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp +--- a/Telegram/SourceFiles/history/view/history_view_element.cpp 2023-11-01 02:41:23.626382456 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_element.cpp 2023-11-01 02:52:47.375481677 +0600 @@ -42,6 +42,7 @@ #include "ui/item_text_options.h" #include "ui/painter.h" @@ -61,7 +73,7 @@ diff -ru a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram #include "data/data_groups.h" #include "data/data_forum.h" #include "data/data_forum_topic.h" -@@ -611,6 +612,10 @@ +@@ -683,6 +684,10 @@ } bool Element::isHidden() const { @@ -72,9 +84,9 @@ diff -ru a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram return isHiddenByGroup(); } -diff -ru a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/main/main_session.cpp ---- a/Telegram/SourceFiles/main/main_session.cpp 1970-01-01 06:00:00.000000000 +0600 -+++ b/Telegram/SourceFiles/main/main_session.cpp 2023-09-22 20:03:45.975983794 +0600 +diff -ur a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/main/main_session.cpp +--- a/Telegram/SourceFiles/main/main_session.cpp 2023-11-01 02:41:23.646382625 +0600 ++++ b/Telegram/SourceFiles/main/main_session.cpp 2023-11-01 02:56:34.480730048 +0600 @@ -11,6 +11,7 @@ #include "api/api_updates.h" #include "api/api_send_progress.h" @@ -88,40 +100,40 @@ diff -ru a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/mai } +void InitializeBlockedPeers(not_null session) { -+ const auto offset = std::make_shared(0); -+ const auto allLoaded = std::make_shared(false); -+ const auto applySlice = [=]( -+ const Api::BlockedPeers::Slice &slice, -+ auto self) -> void { -+ if (slice.list.empty()) { -+ *allLoaded = true; -+ } ++ const auto offset = std::make_shared(0); ++ const auto allLoaded = std::make_shared(false); ++ const auto applySlice = [=]( ++ const Api::BlockedPeers::Slice &slice, ++ auto self) -> void { ++ if (slice.list.empty()) { ++ *allLoaded = true; ++ } + -+ *offset += slice.list.size(); -+ for (const auto &item : slice.list) { -+ if (const auto peer = session->data().peerLoaded(item.id)) { -+ peer->setIsBlocked(true); -+ } -+ } -+ if (*offset >= slice.total) { -+ *allLoaded = true; -+ } ++ *offset += slice.list.size(); ++ for (const auto &item : slice.list) { ++ if (const auto peer = session->data().peerLoaded(item.id)) { ++ peer->setIsBlocked(true); ++ } ++ } ++ if (*offset >= slice.total) { ++ *allLoaded = true; ++ } + -+ if (!*allLoaded) { -+ session->api().blockedPeers().request( -+ *offset, -+ [=](const Api::BlockedPeers::Slice &slice) { -+ self(slice, self); -+ }); -+ } -+ }; ++ if (!*allLoaded) { ++ session->api().blockedPeers().request( ++ *offset, ++ [=](const Api::BlockedPeers::Slice &slice) { ++ self(slice, self); ++ }); ++ } ++ }; + -+ session->api().blockedPeers().slice( -+ ) | rpl::take( -+ 1 -+ ) | rpl::start_with_next([=](const Api::BlockedPeers::Slice &result) { -+ applySlice(result, applySlice); -+ }, session->lifetime()); ++ session->api().blockedPeers().slice( ++ ) | rpl::take( ++ 1 ++ ) | rpl::start_with_next([=](const Api::BlockedPeers::Slice &result) { ++ applySlice(result, applySlice); ++ }, session->lifetime()); +} + } // namespace diff --git a/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch.old b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch.old new file mode 100644 index 00000000..f7d6a593 --- /dev/null +++ b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_hide-banned/0000_hide-messages-from-blocked-users.patch.old @@ -0,0 +1,138 @@ +diff -ru a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp +--- a/Telegram/SourceFiles/history/history_item_components.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/history_item_components.cpp 2023-09-22 19:55:06.414790851 +0600 +@@ -552,7 +552,10 @@ + const auto pausedSpoiler = context.paused + || On(PowerSaving::kChatSpoiler); + if (w > st::msgReplyBarSkip) { +- if (replyToMsg || replyToStory) { ++ auto blocked = replyToMsg ++ && replyToMsg->from()->isUser() ++ && replyToMsg->from()->asUser()->isBlocked(); ++ if ((replyToMsg && (!blocked)) || replyToStory) { + const auto media = replyToMsg ? replyToMsg->media() : nullptr; + auto hasPreview = (replyToStory && replyToStory->hasReplyPreview()) || (media && media->hasReplyPreview()); + if (hasPreview && w < st::msgReplyBarSkip + st::msgReplyBarSize.height()) { +@@ -645,7 +648,10 @@ + } + + QString HistoryMessageReply::statePhrase() const { +- return (replyToMsgId || replyToStoryId) ++ auto blocked = replyToMsg ++ && replyToMsg->from()->isUser() ++ && replyToMsg->from()->asUser()->isBlocked(); ++ return ((replyToMsgId && (!blocked)) || replyToStoryId) + ? tr::lng_profile_loading(tr::now) + : storyReply + ? tr::lng_deleted_story(tr::now) +diff -ru a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp +--- a/Telegram/SourceFiles/history/history_widget.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/history_widget.cpp 2023-09-22 20:00:03.007374659 +0600 +@@ -829,6 +829,21 @@ + } + }, lifetime()); + ++ session().changes().peerUpdates( ++ Data::PeerUpdate::Flag::IsBlocked ++ ) | rpl::start_with_next([=] { ++ crl::on_main(this, [=] { ++ if (_history) { ++ _history->forceFullResize(); ++ if (_migrated) { ++ _migrated->forceFullResize(); ++ } ++ updateHistoryGeometry(); ++ update(); ++ } ++ }); ++ }, lifetime()); ++ + _topBar->membersShowAreaActive( + ) | rpl::start_with_next([=](bool active) { + setMembersShowAreaActive(active); +diff -ru a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp +--- a/Telegram/SourceFiles/history/view/history_view_element.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_element.cpp 2023-09-22 20:01:58.251711974 +0600 +@@ -42,6 +42,7 @@ + #include "ui/item_text_options.h" + #include "ui/painter.h" + #include "data/data_session.h" ++#include "data/data_user.h" + #include "data/data_groups.h" + #include "data/data_forum.h" + #include "data/data_forum_topic.h" +@@ -611,6 +612,10 @@ + } + + bool Element::isHidden() const { ++ if (data()->from()->isUser() ++ && data()->from()->asUser()->isBlocked()) { ++ return true; ++ } + return isHiddenByGroup(); + } + +diff -ru a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/main/main_session.cpp +--- a/Telegram/SourceFiles/main/main_session.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/main/main_session.cpp 2023-09-22 20:03:45.975983794 +0600 +@@ -11,6 +11,7 @@ + #include "api/api_updates.h" + #include "api/api_send_progress.h" + #include "api/api_user_privacy.h" ++#include "api/api_blocked_peers.h" + #include "main/main_account.h" + #include "main/main_domain.h" + #include "main/main_session_settings.h" +@@ -74,6 +75,43 @@ + return MTP::ConfigFields().internalLinksDomain; + } + ++void InitializeBlockedPeers(not_null session) { ++ const auto offset = std::make_shared(0); ++ const auto allLoaded = std::make_shared(false); ++ const auto applySlice = [=]( ++ const Api::BlockedPeers::Slice &slice, ++ auto self) -> void { ++ if (slice.list.empty()) { ++ *allLoaded = true; ++ } ++ ++ *offset += slice.list.size(); ++ for (const auto &item : slice.list) { ++ if (const auto peer = session->data().peerLoaded(item.id)) { ++ peer->setIsBlocked(true); ++ } ++ } ++ if (*offset >= slice.total) { ++ *allLoaded = true; ++ } ++ ++ if (!*allLoaded) { ++ session->api().blockedPeers().request( ++ *offset, ++ [=](const Api::BlockedPeers::Slice &slice) { ++ self(slice, self); ++ }); ++ } ++ }; ++ ++ session->api().blockedPeers().slice( ++ ) | rpl::take( ++ 1 ++ ) | rpl::start_with_next([=](const Api::BlockedPeers::Slice &result) { ++ applySlice(result, applySlice); ++ }, session->lifetime()); ++} ++ + } // namespace + + Session::Session( +@@ -181,6 +219,7 @@ + _api->requestNotifySettings(MTP_inputNotifyChats()); + _api->requestNotifySettings(MTP_inputNotifyBroadcasts()); + ++ InitializeBlockedPeers(this); + Core::App().downloadManager().trackSession(this); + } + + diff --git a/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch.d b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch.d new file mode 100644 index 00000000..3a8c163c --- /dev/null +++ b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch.d @@ -0,0 +1,16 @@ +--- a/Telegram/lib_ui/ui/text/text.cpp 2021-03-03 03:13:31.095340596 +0700 ++++ b/Telegram/lib_ui/ui/text/text.cpp 2021-03-03 03:14:44.720811463 +0700 +@@ -629,13 +629,6 @@ void String::recountNaturalSize( + + int String::countMaxMonospaceWidth() const { + auto result = 0; +- if (_extended) { +- for (const auto "e : _extended->quotes) { +- if (quote.pre) { +- accumulate_max(result, quote.maxWidth); +- } +- } +- } + return result; + } + diff --git a/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_wide-baloons/wide_balloons_kotato2.patch b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_wide-baloons/wide_balloons_kotato2.patch new file mode 100644 index 00000000..878e3e3e --- /dev/null +++ b/net-im/telegram-desktop/files/patches/0/conditional/tdesktop_patches_wide-baloons/wide_balloons_kotato2.patch @@ -0,0 +1,332 @@ +diff -ur a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp +--- a/Telegram/SourceFiles/history/history_inner_widget.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/history_inner_widget.cpp 2023-11-01 03:37:25.551425129 +0600 +@@ -4004,9 +4004,6 @@ + dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right(); + auto dateLeft = st::msgServiceMargin.left(); + auto maxwidth = _contentWidth; +- if (_isChatWide) { +- maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); +- } + auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); + + dateLeft += (widthForDate - dateWidth) / 2; +diff -ur a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp +--- a/Telegram/SourceFiles/history/view/history_view_element.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_element.cpp 2023-11-01 03:39:51.132654787 +0600 +@@ -320,13 +320,6 @@ + p.setPen(st->historyUnreadBarFg()); + + int maxwidth = w; +- if (chatWide) { +- maxwidth = qMin( +- maxwidth, +- st::msgMaxWidth +- + 2 * st::msgPhotoSkip +- + 2 * st::msgMargin.left()); +- } + w = maxwidth; + + const auto skip = st::historyUnreadBarHeight +@@ -670,6 +663,10 @@ + return 0; + } + ++int Element::plainMaxWidth() const { ++ return 0; ++} ++ + int Element::bottomInfoFirstLineWidth() const { + return 0; + } +diff -ur a/Telegram/SourceFiles/history/view/history_view_element.h b/Telegram/SourceFiles/history/view/history_view_element.h +--- a/Telegram/SourceFiles/history/view/history_view_element.h 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_element.h 2023-11-01 03:40:16.636203544 +0600 +@@ -328,6 +328,7 @@ + [[nodiscard]] int skipBlockWidth() const; + [[nodiscard]] int skipBlockHeight() const; + [[nodiscard]] virtual int infoWidth() const; ++ [[nodiscard]] virtual int plainMaxWidth() const; + [[nodiscard]] virtual int bottomInfoFirstLineWidth() const; + [[nodiscard]] virtual bool bottomInfoIsWide() const; + +diff -ur a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +--- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp 2023-11-01 03:41:00.526574290 +0600 +@@ -3441,9 +3441,6 @@ + dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right(); + auto dateLeft = st::msgServiceMargin.left(); + auto maxwidth = view->width(); +- if (_isChatWide) { +- maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); +- } + auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); + + dateLeft += (widthForDate - dateWidth) / 2; +diff -ur a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp +--- a/Telegram/SourceFiles/history/view/history_view_message.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_message.cpp 2023-11-01 03:45:14.175383704 +0600 +@@ -3877,7 +3877,6 @@ + // contentLeft += st::msgPhotoSkip - (hmaxwidth - hwidth); + } + accumulate_min(contentWidth, maxWidth()); +- accumulate_min(contentWidth, int(_bubbleWidthLimit)); + if (mediaWidth < contentWidth) { + const auto textualWidth = plainMaxWidth(); + if (mediaWidth < textualWidth +@@ -3887,7 +3886,10 @@ + contentWidth = mediaWidth; + } + } +- if (contentWidth < availableWidth && !delegate()->elementIsChatWide()) { ++ if (contentWidth < availableWidth ++ && !delegate()->elementIsChatWide() ++ || (context() == Context::Replies ++ && item->isDiscussionPost())) { + if (outbg) { + contentLeft += availableWidth - contentWidth; + } else if (centeredView) { +@@ -3989,7 +3991,6 @@ + } + accumulate_min(contentWidth, maxWidth()); + _bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth()); +- accumulate_min(contentWidth, int(_bubbleWidthLimit)); + if (mediaDisplayed) { + media->resizeGetHeight(contentWidth); + if (media->width() < contentWidth) { +@@ -4022,7 +4023,7 @@ + _reactions->resizeGetHeight(textWidth); + } + +- if (contentWidth == maxWidth()) { ++ if (false) { + if (mediaDisplayed) { + if (entry) { + newHeight += entry->resizeGetHeight(contentWidth); +diff -ur a/Telegram/SourceFiles/history/view/history_view_message.h b/Telegram/SourceFiles/history/view/history_view_message.h +--- a/Telegram/SourceFiles/history/view/history_view_message.h 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_message.h 2023-11-01 03:46:30.222692686 +0600 +@@ -146,6 +146,7 @@ + [[nodiscard]] bool toggleSelectionByHandlerClick( + const ClickHandlerPtr &handler) const override; + [[nodiscard]] int infoWidth() const override; ++ [[nodiscard]] int plainMaxWidth() const override; + [[nodiscard]] int bottomInfoFirstLineWidth() const override; + [[nodiscard]] bool bottomInfoIsWide() const override; + [[nodiscard]] bool isSignedAuthorElided() const override; +@@ -283,7 +284,7 @@ + void ensureRightAction() const; + void refreshTopicButton(); + void refreshInfoSkipBlock(); +- [[nodiscard]] int plainMaxWidth() const; ++ // [[nodiscard]] int plainMaxWidth() const; + [[nodiscard]] int monospaceMaxWidth() const; + + void validateInlineKeyboard(HistoryMessageReplyMarkup *markup); +diff -ur a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp +--- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp 2023-11-01 03:48:00.663456614 +0600 +@@ -154,9 +154,7 @@ + int w, + bool chatWide) { + int left = st::msgServiceMargin.left(); +- const auto maxwidth = chatWide +- ? std::min(w, WideChatWidth()) +- : w; ++ const auto maxwidth = w; + w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); + + left += (w - dateTextWidth - st::msgServicePadding.left() - st::msgServicePadding.right()) / 2; +@@ -413,9 +411,6 @@ + + QRect Service::countGeometry() const { + auto result = QRect(0, 0, width(), height()); +- if (delegate()->elementIsChatWide()) { +- result.setWidth(qMin(result.width(), st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); +- } + return result.marginsRemoved(st::msgServiceMargin); + } + +@@ -435,9 +430,6 @@ + + st::msgServiceMargin.bottom(); + } else if (!text().isEmpty()) { + auto contentWidth = newWidth; +- if (delegate()->elementIsChatWide()) { +- accumulate_min(contentWidth, st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()); +- } + contentWidth -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins + if (contentWidth < st::msgServicePadding.left() + st::msgServicePadding.right() + 1) { + contentWidth = st::msgServicePadding.left() + st::msgServicePadding.right() + 1; +diff -ur a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp +--- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp 2023-11-01 03:49:16.787433044 +0600 +@@ -385,7 +385,11 @@ + + if (auto named = Get()) { + accumulate_max(maxWidth, tleft + named->namew + tright); +- accumulate_min(maxWidth, st::msgMaxWidth); ++ if (captioned) { ++ accumulate_max(maxWidth, captioned->caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); ++ } else { ++ accumulate_min(maxWidth, st::msgMaxWidth); ++ } + } + if (voice && voice->transcribe) { + maxWidth += st::historyTranscribeSkip +diff -ur a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +--- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp 2023-11-01 03:51:45.282020799 +0600 +@@ -156,13 +156,15 @@ + } + + QSize Gif::countThumbSize(int &inOutWidthMax) const { ++ const auto captionWithPaddings = _caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right(); + const auto maxSize = _data->isVideoFile() + ? st::maxMediaSize + : _data->isVideoMessage() + ? st::maxVideoMessageSize + : st::maxGifSize; ++ const auto maxSizeWithCaption = std::max(captionWithPaddings, maxSize); + const auto size = style::ConvertScale(videoSize()); +- accumulate_min(inOutWidthMax, maxSize); ++ accumulate_min(inOutWidthMax, maxSizeWithCaption); + return DownscaledSize(size, { inOutWidthMax, maxSize }); + } + +@@ -199,6 +201,7 @@ + } + if (_parent->hasBubble()) { + if (!_caption.isEmpty()) { ++ accumulate_max(maxWidth, _caption.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); + maxWidth = qMax(maxWidth, st::msgPadding.left() + + _caption.maxWidth() + + st::msgPadding.right()); +diff -ur a/Telegram/SourceFiles/history/view/media/history_view_location.cpp b/Telegram/SourceFiles/history/view/media/history_view_location.cpp +--- a/Telegram/SourceFiles/history/view/media/history_view_location.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/media/history_view_location.cpp 2023-11-01 03:54:03.303186600 +0600 +@@ -92,9 +92,11 @@ + + if (_parent->hasBubble()) { + if (!_title.isEmpty()) { ++ maxWidth = qMax(maxWidth, _title.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); + minHeight += qMin(_title.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 2 * st::webPageTitleFont->height); + } + if (!_description.isEmpty()) { ++ maxWidth = qMax(maxWidth, _description.maxWidth() + st::msgPadding.left() + st::msgPadding.right()); + minHeight += qMin(_description.countHeight(maxWidth - st::msgPadding.left() - st::msgPadding.right()), 3 * st::webPageDescriptionFont->height); + } + if (!_title.isEmpty() || !_description.isEmpty()) { +@@ -117,11 +119,7 @@ + tw = st::maxMediaSize; + } + auto newHeight = th; +- if (tw > newWidth) { +- newHeight = (newWidth * newHeight / tw); +- } else { +- newWidth = tw; +- } ++ newHeight = (newWidth * newHeight / tw); + auto minWidth = std::clamp( + _parent->minWidthForMedia(), + st::minPhotoSize, +diff -ur a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +--- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp 2023-11-01 03:55:36.937310944 +0600 +@@ -127,10 +127,16 @@ + sizes.push_back(part.content->sizeForGroupingOptimal(maxWidth)); + } + ++ const auto captionWithPaddings = _caption.maxWidth() ++ + st::msgPadding.left() ++ + st::msgPadding.right(); ++ auto groupMaxWidth = st::historyGroupWidthMax; ++ accumulate_max(groupMaxWidth, captionWithPaddings); ++ + const auto layout = (_mode == Mode::Grid) + ? Ui::LayoutMediaGroup( + sizes, +- st::historyGroupWidthMax, ++ groupMaxWidth, + st::historyGroupWidthMin, + st::historyGroupSkip) + : LayoutPlaylist(sizes); +@@ -146,6 +152,7 @@ + } + + if (!_caption.isEmpty()) { ++ maxWidth = qMax(maxWidth, captionWithPaddings); + auto captionw = maxWidth - st::msgPadding.left() - st::msgPadding.right(); + minHeight += st::mediaCaptionSkip + _caption.countHeight(captionw); + if (isBubbleBottom()) { +diff -ur a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +--- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp 2023-11-01 03:57:29.241593072 +0600 +@@ -200,15 +200,17 @@ + ? st::historyPhotoBubbleMinWidth + : st::minPhotoSize), + st::maxMediaSize); +- const auto maxActualWidth = qMax(scaled.width(), minWidth); ++ auto maxActualWidth = qMax(scaled.width(), minWidth); + auto maxWidth = qMax(maxActualWidth, scaled.height()); + auto minHeight = qMax(scaled.height(), st::minPhotoSize); + if (_parent->hasBubble() && !_caption.isEmpty()) { ++ const auto captionWithPaddings = (st::msgPadding.left() + _caption.maxWidth() ++ + st::msgPadding.right()); ++ maxActualWidth = qMax(maxActualWidth, captionWithPaddings); ++ maxWidth = qMax(maxWidth, captionWithPaddings); + maxWidth = qMax( + maxWidth, +- (st::msgPadding.left() +- + _caption.maxWidth() +- + st::msgPadding.right())); ++ captionWithPaddings); + minHeight = adjustHeightForLessCrop( + dimensions, + { maxWidth, minHeight }); +diff -ur a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp +--- a/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/history/view/media/history_view_web_page.cpp 2023-11-01 03:59:58.492863190 +0600 +@@ -357,6 +357,8 @@ + maxWidth += margins.left() + _openButtonWidth + margins.right(); + } + maxWidth += padding.left() + padding.right(); ++ accumulate_min(maxWidth, st::msgMaxWidth); ++ accumulate_max(maxWidth, _parent->plainMaxWidth()); + minHeight += padding.top() + padding.bottom(); + + if (_asArticle) { +@@ -371,6 +373,7 @@ + } + + auto padding = inBubblePadding() + innerMargin(); ++ accumulate_min(newWidth, maxWidth()); + auto innerWidth = newWidth - padding.left() - padding.right(); + auto newHeight = 0; + +diff -ur a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp +--- a/Telegram/SourceFiles/window/themes/window_theme_preview.cpp 1970-01-01 06:00:00.000000000 +0600 ++++ b/Telegram/SourceFiles/window/themes/window_theme_preview.cpp 2023-11-01 04:01:38.277079208 +0600 +@@ -266,7 +266,6 @@ + const auto &st = st::msgFileLayout; + auto tleft = st.padding.left() + st.thumbSize + st.thumbSkip; + accumulate_max(width, tleft + st::normalFont->width(wavestatus) + skipBlock.width() + st::msgPadding.right()); +- accumulate_min(width, st::msgMaxWidth); + + auto height = st.padding.top() + st.thumbSize + st.padding.bottom(); + addBubble(std::move(bubble), width, height, date, status); +@@ -299,7 +298,6 @@ + + auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right(); + accumulate_min(width, st::msgPadding.left() + bubble.text.maxWidth() + st::msgPadding.right()); +- accumulate_min(width, st::msgMaxWidth); + + auto textWidth = qMax(width - st::msgPadding.left() - st::msgPadding.right(), 1); + auto textHeight = bubble.text.countHeight(textWidth); +@@ -328,7 +326,6 @@ + + auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right(); + accumulate_min(width, bubble.photoWidth); +- accumulate_min(width, st::msgMaxWidth); + + auto textWidth = qMax(width - st::msgPadding.left() - st::msgPadding.right(), 1); + auto textHeight = bubble.text.countHeight(textWidth); diff --git a/net-im/telegram-desktop/files/patches/4.10.3/0006_tdesktop-4.10.3-fix-clang-libstdcxx.patch b/net-im/telegram-desktop/files/patches/4.10.3/0006_tdesktop-4.10.3-fix-clang-libstdcxx.patch deleted file mode 100644 index 290eb2a6..00000000 --- a/net-im/telegram-desktop/files/patches/4.10.3/0006_tdesktop-4.10.3-fix-clang-libstdcxx.patch +++ /dev/null @@ -1,13 +0,0 @@ -Fix compilation with Clang + libstdc++ - ---- tdesktop-4.10.3-full.orig/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp -+++ tdesktop-4.10.3-full/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp -@@ -814,7 +814,7 @@ - - // A list of capabilities that offer feature parity - // with custom notifications -- return ranges::all_of(std::initializer_list{ -+ return ranges::all_of(std::array{ - // To show message content - "body", - // To have buttons on notifications diff --git a/net-im/telegram-desktop/files/patches/4.10.3/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch b/net-im/telegram-desktop/files/patches/4.10.3/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch deleted file mode 100644 index d1545ba8..00000000 --- a/net-im/telegram-desktop/files/patches/4.10.3/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/Telegram/lib_ui/ui/text/text.cpp 2021-03-03 03:13:31.095340596 +0700 -+++ b/Telegram/lib_ui/ui/text/text.cpp 2021-03-03 03:14:44.720811463 +0700 -@@ -2791,10 +2791,6 @@ int String::countMaxMonospaceWidth() con - _width = (b->f_width() - last_rBearing); - continue; - } -- if (!(b->flags() & (TextBlockFPre | TextBlockFCode)) -- && (b->type() != TextBlockTSkip)) { -- fullMonospace = false; -- } - auto b__f_rbearing = b->f_rbearing(); // cache - - // We need to accumulate max width after each block, because diff --git a/net-im/telegram-desktop/files/patches/0/tdesktop-4.8.4-remove-private-qt.patch b/net-im/telegram-desktop/files/patches/4.11.8/remove-private-qt.patch similarity index 91% rename from net-im/telegram-desktop/files/patches/0/tdesktop-4.8.4-remove-private-qt.patch rename to net-im/telegram-desktop/files/patches/4.11.8/remove-private-qt.patch index 811c0573..706eee47 100644 --- a/net-im/telegram-desktop/files/patches/0/tdesktop-4.8.4-remove-private-qt.patch +++ b/net-im/telegram-desktop/files/patches/4.11.8/remove-private-qt.patch @@ -8,7 +8,7 @@ https://bugs.gentoo.org/908500 --- tdesktop-4.8.4-full.orig/Telegram/lib_ui/ui/rp_widget.cpp +++ tdesktop-4.8.4-full/Telegram/lib_ui/ui/rp_widget.cpp -@@ -13,41 +13,9 @@ +@@ -13,40 +13,9 @@ #include #include #include @@ -22,15 +22,14 @@ https://bugs.gentoo.org/908500 -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) - QPlatformBackingStoreRhiConfig rhiConfig() const override { - const auto q = static_cast(q_ptr); -- if (!q->testAttribute(Qt::WA_WState_Created)) { +- if (!q->testAttribute(Qt::WA_WState_Created) +- || (!q->testAttribute(Qt::WA_NativeWindow) +- && !q->isWindow())) { - return QWidgetPrivate::rhiConfig(); - } - if (const auto config = q->rhiConfig()) { - return *config; - } -- if (::Platform::IsMac10_14OrGreater()) { -- return { QPlatformBackingStoreRhiConfig::Metal }; -- } - // We can't specify the widget here as q_evaluateRhiConfig is called - // in QWidgetWindow constructor, while windowHandle is set right after - // the constructor is completed diff --git a/net-im/telegram-desktop/files/patches/9999/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch b/net-im/telegram-desktop/files/patches/9999/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch deleted file mode 100644 index 929f6dda..00000000 --- a/net-im/telegram-desktop/files/patches/9999/conditional/tdesktop_patches_wide-baloons/0000_exploit_through_monospace.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/Telegram/lib_ui/ui/text/text.cpp 2021-03-03 03:13:31.095340596 +0700 -+++ b/Telegram/lib_ui/ui/text/text.cpp 2021-03-03 03:14:44.720811463 +0700 -@@ -340,10 +340,6 @@ int String::countMaxMonospaceWidth() con - _width = (b->f_width() - last_rBearing); - continue; - } -- if (!(b->flags() & (TextBlockFlag::Pre | TextBlockFlag::Code)) -- && (b->type() != TextBlockType::Skip)) { -- fullMonospace = false; -- } - auto b__f_rbearing = b->f_rbearing(); // cache - - // We need to accumulate max width after each block, because - diff --git a/net-im/telegram-desktop/files/patches/9999/remove-private-qt.patch b/net-im/telegram-desktop/files/patches/9999/remove-private-qt.patch new file mode 100644 index 00000000..8c7601c5 --- /dev/null +++ b/net-im/telegram-desktop/files/patches/9999/remove-private-qt.patch @@ -0,0 +1,67 @@ +Remove uses of private Qt classes + +Currently, this is used to fix compatibility with odd environments, and only +for Qt6. This causes more trouble than it's worth, because it means telegram +must be rebuilt with every minor Qt bump. + +https://bugs.gentoo.org/908500 + +--- tdesktop-4.8.4-full.orig/Telegram/lib_ui/ui/rp_widget.cpp ++++ tdesktop-4.8.4-full/Telegram/lib_ui/ui/rp_widget.cpp +@@ -13,54 +13,9 @@ + #include + #include + #include +-#include +- +-// Patching out this code without patching out all other private API usage +-// and the Qt::{Core,Gui,Widgets}Private cmake dependency is asking +-// for memory corruption +-class TWidgetPrivate : public QWidgetPrivate { +-public: +-#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) +- TWidgetPrivate(int version = QObjectPrivateVersion) +- : QWidgetPrivate(version) { +- [[maybe_unused]] static const auto Once = [] { +- if (::Platform::IsWayland() +- && Ui::GL::ChooseBackendDefault( +- Ui::GL::CheckCapabilities(nullptr, true)) +- == Ui::GL::Backend::OpenGL) { +- qApp->setProperty("_q_widgets_highdpi_downscale", true); +- WaylandGL = true; +- } +- return true; +- }(); +- } +- +- QPlatformBackingStoreRhiConfig rhiConfig() const override { +- const auto q = static_cast(q_ptr); +- if (!q->testAttribute(Qt::WA_WState_Created) +- || (!q->testAttribute(Qt::WA_NativeWindow) +- && !q->isWindow())) { +- return QWidgetPrivate::rhiConfig(); +- } +- if (const auto config = q->rhiConfig()) { +- return *config; +- } +- // fix flickering on GNOME +- if (WaylandGL) { +- return { QPlatformBackingStoreRhiConfig::OpenGL }; +- } +- return QWidgetPrivate::rhiConfig(); +- } +-#endif // Qt >= 6.4.0 +- +-private: +- static bool WaylandGL; +-}; +- +-bool TWidgetPrivate::WaylandGL = false; + + TWidget::TWidget(QWidget *parent) +-: TWidgetHelper(*(new TWidgetPrivate), parent, {}) { ++: TWidgetHelper(parent, {}) { + [[maybe_unused]] static const auto Once = [] { + auto format = QSurfaceFormat::defaultFormat(); + format.setSwapInterval(0); + diff --git a/net-im/telegram-desktop/telegram-desktop-4.10.3.ebuild b/net-im/telegram-desktop/telegram-desktop-4.11.8.ebuild similarity index 100% rename from net-im/telegram-desktop/telegram-desktop-4.10.3.ebuild rename to net-im/telegram-desktop/telegram-desktop-4.11.8.ebuild