Update API scheme to layer 196.

This commit is contained in:
John Preston 2024-12-04 11:18:51 +04:00
parent 4505a2bf2d
commit c1528f532e
37 changed files with 291 additions and 171 deletions

View file

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "api/api_chat_filters.h"
#include "api/api_text_entities.h"
#include "apiwrap.h"
#include "base/event_filter.h"
#include "boxes/peer_list_box.h"
@ -49,7 +50,7 @@ public:
ToggleChatsController(
not_null<Window::SessionController*> window,
ToggleAction action,
const QString &title,
TextWithEntities title,
std::vector<not_null<PeerData*>> chats,
std::vector<not_null<PeerData*>> additional);
@ -75,7 +76,7 @@ private:
Ui::RpWidget *_addedBottomWidget = nullptr;
ToggleAction _action = ToggleAction::Adding;
QString _filterTitle;
TextWithEntities _filterTitle;
base::flat_set<not_null<PeerData*>> _checkable;
std::vector<not_null<PeerData*>> _chats;
std::vector<not_null<PeerData*>> _additional;
@ -104,11 +105,11 @@ private:
Unexpected("Ui::FilterLinkHeaderType in TitleText.");
}
[[nodiscard]] TextWithEntities AboutText(
[[nodiscard]] TextWithEntities AboutText( // todo filter emoji
Ui::FilterLinkHeaderType type,
const QString &title) {
TextWithEntities title) {
using Type = Ui::FilterLinkHeaderType;
auto boldTitle = Ui::Text::Bold(title);
auto boldTitle = Ui::Text::Wrapped(title, EntityType::Bold);
return (type == Type::AddingFilter)
? tr::lng_filters_by_link_sure(
tr::now,
@ -138,8 +139,8 @@ void InitFilterLinkHeader(
not_null<PeerListBox*> box,
Fn<void(int minHeight, int maxHeight, int addedTopHeight)> adjust,
Ui::FilterLinkHeaderType type,
const QString &title,
const QString &iconEmoji,
TextWithEntities title,
QString iconEmoji,
rpl::producer<int> count,
bool horizontalFilters) {
const auto icon = Ui::LookupFilterIcon(
@ -248,7 +249,7 @@ void ImportInvite(
ToggleChatsController::ToggleChatsController(
not_null<Window::SessionController*> window,
ToggleAction action,
const QString &title,
TextWithEntities title,
std::vector<not_null<PeerData*>> chats,
std::vector<not_null<PeerData*>> additional)
: _window(window)
@ -529,7 +530,7 @@ void ShowImportError(
void ShowImportToast(
base::weak_ptr<Window::SessionController> weak,
const QString &title,
TextWithEntities title,
Ui::FilterLinkHeaderType type,
int added) {
const auto strong = weak.get();
@ -540,7 +541,9 @@ void ShowImportToast(
const auto phrase = created
? tr::lng_filters_added_title
: tr::lng_filters_updated_title;
auto text = Ui::Text::Bold(phrase(tr::now, lt_folder, title));
auto text = Ui::Text::Wrapped( // todo filter emoji
phrase(tr::now, lt_folder, title, Ui::Text::WithEntities),
EntityType::Bold);
if (added > 0) {
const auto phrase = created
? tr::lng_filters_added_also
@ -574,8 +577,8 @@ void ProcessFilterInvite(
base::weak_ptr<Window::SessionController> weak,
const QString &slug,
FilterId filterId,
const QString &title,
const QString &iconEmoji,
TextWithEntities title,
QString iconEmoji,
std::vector<not_null<PeerData*>> peers,
std::vector<not_null<PeerData*>> already) {
const auto strong = weak.get();
@ -720,7 +723,7 @@ void CheckFilterInvite(
if (!strong) {
return;
}
auto title = QString();
auto title = TextWithEntities();
auto iconEmoji = QString();
auto filterId = FilterId();
auto peers = std::vector<not_null<PeerData*>>();
@ -739,7 +742,7 @@ void CheckFilterInvite(
return result;
};
result.match([&](const MTPDchatlists_chatlistInvite &data) {
title = qs(data.vtitle());
title = ParseTextWithEntities(session, data.vtitle());
iconEmoji = data.vemoticon().value_or_empty();
peers = parseList(data.vpeers());
}, [&](const MTPDchatlists_chatlistInviteAlready &data) {
@ -804,8 +807,8 @@ void ProcessFilterUpdate(
void ProcessFilterRemove(
base::weak_ptr<Window::SessionController> weak,
const QString &title,
const QString &iconEmoji,
TextWithEntities title,
QString iconEmoji,
std::vector<not_null<PeerData*>> all,
std::vector<not_null<PeerData*>> suggest,
Fn<void(std::vector<not_null<PeerData*>>)> done) {

View file

@ -36,8 +36,8 @@ void ProcessFilterUpdate(
void ProcessFilterRemove(
base::weak_ptr<Window::SessionController> weak,
const QString &title,
const QString &iconEmoji,
TextWithEntities title,
QString iconEmoji,
std::vector<not_null<PeerData*>> all,
std::vector<not_null<PeerData*>> suggest,
Fn<void(std::vector<not_null<PeerData*>>)> done);

View file

@ -73,6 +73,11 @@ constexpr auto kTransactionsLimit = 100;
return PeerId(0);
}).value;
const auto stargift = tl.data().vstargift();
const auto nonUniqueGift = stargift
? stargift->match([&](const MTPDstarGift &data) {
return &data;
}, [](const auto &) { return (const MTPDstarGift*)nullptr; })
: nullptr;
const auto reaction = tl.data().is_reaction();
const auto amount = Data::FromTL(tl.data().vstars());
const auto starrefAmount = tl.data().vstarref_amount()
@ -85,6 +90,25 @@ constexpr auto kTransactionsLimit = 100;
: 0;
const auto incoming = (amount >= StarsAmount());
const auto saveActorId = (reaction || !extended.empty()) && incoming;
const auto giftStickerId = [&] {
if (!stargift) {
return DocumentId();
}
return stargift->match([&](const MTPDstarGift &data) {
return owner->processDocument(data.vsticker())->id;
}, [&](const MTPDstarGiftUnique &data) {
for (const auto &attribute : data.vattributes().v) {
const auto result = attribute.match([&](
const MTPDstarGiftAttributeModel &data) {
return DocumentId(data.vdocument_id().v);
}, [](const auto &) { return DocumentId(); });
if (result) {
return result;
}
}
return DocumentId();
});
}();
return Data::CreditsHistoryEntry{
.id = qs(tl.data().vid()),
.title = qs(tl.data().vtitle().value_or_empty()),
@ -97,9 +121,7 @@ constexpr auto kTransactionsLimit = 100;
.barePeerId = saveActorId ? peer->id.value : barePeerId,
.bareGiveawayMsgId = uint64(
tl.data().vgiveaway_post_id().value_or_empty()),
.bareGiftStickerId = (stargift
? owner->processDocument(stargift->data().vsticker())->id
: 0),
.bareGiftStickerId = giftStickerId,
.bareActorId = saveActorId ? barePeerId : uint64(0),
.starrefAmount = starrefAmount,
.starrefCommission = starrefCommission,
@ -129,8 +151,8 @@ constexpr auto kTransactionsLimit = 100;
? base::unixtime::parse(tl.data().vtransaction_date()->v)
: QDateTime(),
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
.starsConverted = int(stargift
? stargift->data().vconvert_stars().v
.starsConverted = int(nonUniqueGift
? nonUniqueGift->vconvert_stars().v
: 0),
.floodSkip = int(tl.data().vfloodskip_number().value_or(0)),
.converted = stargift && incoming,

View file

@ -761,25 +761,28 @@ rpl::producer<DocumentData*> RandomHelloStickerValue(
std::optional<StarGift> FromTL(
not_null<Main::Session*> session,
const MTPstarGift &gift) {
const auto &data = gift.data();
const auto document = session->data().processDocument(
data.vsticker());
const auto remaining = data.vavailability_remains();
const auto total = data.vavailability_total();
if (!document->sticker()) {
return {};
}
return StarGift{
.id = uint64(data.vid().v),
.stars = int64(data.vstars().v),
.starsConverted = int64(data.vconvert_stars().v),
.document = document,
.limitedLeft = remaining.value_or_empty(),
.limitedCount = total.value_or_empty(),
.firstSaleDate = data.vfirst_sale_date().value_or_empty(),
.lastSaleDate = data.vlast_sale_date().value_or_empty(),
.birthday = data.is_birthday(),
};
return gift.match([&](const MTPDstarGift &data) {
const auto document = session->data().processDocument(
data.vsticker());
const auto remaining = data.vavailability_remains();
const auto total = data.vavailability_total();
if (!document->sticker()) {
return std::optional<StarGift>();
}
return std::optional<StarGift>(StarGift{
.id = uint64(data.vid().v),
.stars = int64(data.vstars().v),
.starsConverted = int64(data.vconvert_stars().v),
.document = document,
.limitedLeft = remaining.value_or_empty(),
.limitedCount = total.value_or_empty(),
.firstSaleDate = data.vfirst_sale_date().value_or_empty(),
.lastSaleDate = data.vlast_sale_date().value_or_empty(),
.birthday = data.is_birthday(),
});
}, [&](const MTPDstarGiftUnique &data) {
return std::optional<StarGift>();
});
}
std::optional<UserStarGift> FromTL(

View file

@ -229,7 +229,7 @@ EntitiesInText EntitiesFromMTP(
}
MTPVector<MTPMessageEntity> EntitiesToMTP(
not_null<Main::Session*> session,
Main::Session *session,
const EntitiesInText &entities,
ConvertOption option) {
auto v = QVector<MTPMessageEntity>();
@ -283,6 +283,7 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
v.push_back(MTP_messageEntityMention(offset, length));
} break;
case EntityType::MentionName: {
Assert(session != nullptr);
const auto valid = MentionNameEntity(
session,
offset,
@ -344,4 +345,14 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
return MTP_vector<MTPMessageEntity>(std::move(v));
}
TextWithEntities ParseTextWithEntities(
Main::Session *session,
const MTPTextWithEntities &text) {
const auto &data = text.data();
return {
.text = qs(data.vtext()),
.entities = EntitiesFromMTP(session, data.ventities().v),
};
}
} // namespace Api

View file

@ -25,8 +25,12 @@ enum class ConvertOption {
const QVector<MTPMessageEntity> &entities);
[[nodiscard]] MTPVector<MTPMessageEntity> EntitiesToMTP(
not_null<Main::Session*> session,
Main::Session *session,
const EntitiesInText &entities,
ConvertOption option = ConvertOption::WithLocal);
[[nodiscard]] TextWithEntities ParseTextWithEntities(
Main::Session *session,
const MTPTextWithEntities &text);
} // namespace Api

View file

@ -1218,7 +1218,8 @@ void Updates::applyUpdatesNoPtsCheck(const MTPUpdates &updates) {
MTP_int(d.vttl_period().value_or_empty()),
MTPint(), // quick_reply_shortcut_id
MTPlong(), // effect
MTPFactCheck()),
MTPFactCheck(),
MTPint()), // report_delivery_until_date
MessageFlags(),
NewMessageType::Unread);
} break;
@ -1255,7 +1256,8 @@ void Updates::applyUpdatesNoPtsCheck(const MTPUpdates &updates) {
MTP_int(d.vttl_period().value_or_empty()),
MTPint(), // quick_reply_shortcut_id
MTPlong(), // effect
MTPFactCheck()),
MTPFactCheck(),
MTPint()), // report_delivery_until_date
MessageFlags(),
NewMessageType::Unread);
} break;

View file

@ -176,7 +176,7 @@ void ChangeFilterById(
lt_chat,
Ui::Text::Bold(chat),
lt_folder,
Ui::Text::Bold(name),
Ui::Text::Wrapped(name, EntityType::Bold),
Ui::Text::WithEntities));
}
}).fail([=](const MTP::Error &error) {
@ -278,8 +278,8 @@ void FillChooseFilterMenu(
menu.get(),
menu->st().menu,
Ui::Menu::CreateAction(
menu.get(),
Ui::Text::FixAmpersandInAction(filter.title()),
menu.get(), // todo filter emoji
Ui::Text::FixAmpersandInAction(filter.title().text),
std::move(callback)),
contains ? &st::mediaPlayerMenuCheck : nullptr,
contains ? &st::mediaPlayerMenuCheck : nullptr);

View file

@ -356,7 +356,7 @@ void EditFilterBox(
const auto state = box->lifetime().make_state<State>(State{
.rules = filter,
.chatlist = filter.chatlist(),
.creating = filter.title().isEmpty(),
.creating = filter.title().empty(),
});
state->colorIndex = filter.colorIndex().value_or(kNoTag);
state->links = owner->chatsFilters().chatlistLinks(filter.id()),
@ -406,7 +406,7 @@ void EditFilterBox(
box,
st::windowFilterNameInput,
tr::lng_filters_new_name(),
filter.title()),
filter.title().text), // todo filter emoji
st::markdownLinkFieldPadding);
name->setMaxLength(kMaxFilterTitleLength);
name->setInstantReplaces(Ui::InstantReplaces::Default());
@ -672,9 +672,10 @@ void EditFilterBox(
}
const auto collect = [=]() -> std::optional<Data::ChatFilter> {
const auto title = name->getLastText().trimmed();
// todo filter emoji
const auto title = TextWithEntities{ name->getLastText().trimmed() };
const auto rules = data->current();
if (title.isEmpty()) {
if (title.empty()) {
name->showError();
box->scrollToY(0);
return {};

View file

@ -130,7 +130,7 @@ ExceptionRow::ExceptionRow(not_null<History*> history) : Row(history) {
auto filters = QStringList();
for (const auto &filter : history->owner().chatsFilters().list()) {
if (filter.contains(history) && filter.id()) {
filters << filter.title();
filters << filter.title().text; // todo filter emoji
}
}
if (!filters.isEmpty()) {

View file

@ -482,7 +482,7 @@ private:
const not_null<Window::SessionController*> _window;
InviteLinkData _data;
QString _filterTitle;
TextWithEntities _filterTitle;
base::flat_set<not_null<History*>> _filterChats;
base::flat_map<not_null<PeerData*>, QString> _denied;
rpl::variable<base::flat_set<not_null<PeerData*>>> _selected;
@ -543,8 +543,10 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
(_data.url.isEmpty()
? tr::lng_filters_link_no_about(Ui::Text::WithEntities)
: tr::lng_filters_link_share_about(
lt_folder,
rpl::single(Ui::Text::Bold(_filterTitle)),
lt_folder, // todo filter emoji
rpl::single(Ui::Text::Wrapped(
_filterTitle,
EntityType::Bold)),
Ui::Text::WithEntities)),
st::settingsFilterDividerLabel)),
st::filterLinkDividerLabelPadding);

View file

@ -303,6 +303,7 @@ void Call::startOutgoing() {
_api.request(MTPphone_RequestCall(
MTP_flags(flags),
_user->inputUser,
MTPInputGroupCall(),
MTP_int(base::RandomValue<int32>()),
MTP_bytes(_gaHash),
MTP_phoneCallProtocol(

View file

@ -1377,6 +1377,7 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
inputCall(),
joinAs()->input,
MTP_string(_joinHash),
MTPlong(), // key_fingerprint
MTP_dataJSON(MTP_bytes(json))
)).done([=](
const MTPUpdates &updates,

View file

@ -57,6 +57,7 @@ constexpr auto kRequestTimeLimit = 60 * crl::time(1000);
data.vreply_to() ? *data.vreply_to() : MTPMessageReplyHeader(),
data.vdate(),
data.vaction(),
data.vreactions() ? *data.vreactions() : MTPMessageReactions(),
MTP_int(data.vttl_period().value_or_empty()));
}, [&](const MTPDmessage &data) {
return MTP_message(
@ -89,7 +90,8 @@ constexpr auto kRequestTimeLimit = 60 * crl::time(1000);
MTP_int(data.vttl_period().value_or_empty()),
MTP_int(shortcutId),
MTP_long(data.veffect().value_or_empty()),
(data.vfactcheck() ? *data.vfactcheck() : MTPFactCheck()));
(data.vfactcheck() ? *data.vfactcheck() : MTPFactCheck()),
MTP_int(data.vreport_delivery_until_date().value_or_empty()));
});
}

View file

@ -62,6 +62,7 @@ constexpr auto kRequestTimeLimit = 60 * crl::time(1000);
data.vreply_to() ? *data.vreply_to() : MTPMessageReplyHeader(),
data.vdate(),
data.vaction(),
data.vreactions() ? *data.vreactions() : MTPMessageReactions(),
MTP_int(data.vttl_period().value_or_empty()));
}, [&](const MTPDmessage &data) {
return MTP_message(
@ -93,7 +94,8 @@ constexpr auto kRequestTimeLimit = 60 * crl::time(1000);
MTP_int(data.vttl_period().value_or_empty()),
MTPint(), // quick_reply_shortcut_id
MTP_long(data.veffect().value_or_empty()), // effect
data.vfactcheck() ? *data.vfactcheck() : MTPFactCheck());
data.vfactcheck() ? *data.vfactcheck() : MTPFactCheck(),
MTP_int(data.vreport_delivery_until_date().value_or_empty()));
});
}
@ -266,7 +268,8 @@ void ScheduledMessages::sendNowSimpleMessage(
MTP_int(update.vttl_period().value_or_empty()),
MTPint(), // quick_reply_shortcut_id
MTP_long(local->effectId()), // effect
MTPFactCheck()),
MTPFactCheck(),
MTPint()), // report_delivery_until_date
localFlags,
NewMessageType::Unread);

View file

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "data/data_chat_filters.h"
#include "api/api_text_entities.h"
#include "history/history.h"
#include "data/data_peer.h"
#include "data/data_user.h"
@ -41,16 +42,16 @@ constexpr auto kLoadExceptionsPerRequest = 100;
ChatFilter::ChatFilter(
FilterId id,
const QString &title,
const QString &iconEmoji,
TextWithEntities title,
QString iconEmoji,
std::optional<uint8> colorIndex,
Flags flags,
base::flat_set<not_null<History*>> always,
std::vector<not_null<History*>> pinned,
base::flat_set<not_null<History*>> never)
: _id(id)
, _title(title)
, _iconEmoji(iconEmoji)
, _title(std::move(title))
, _iconEmoji(std::move(iconEmoji))
, _colorIndex(colorIndex)
, _always(std::move(always))
, _pinned(std::move(pinned))
@ -95,7 +96,7 @@ ChatFilter ChatFilter::FromTL(
};
return ChatFilter(
data.vid().v,
qs(data.vtitle()),
Api::ParseTextWithEntities(&owner->session(), data.vtitle()),
qs(data.vemoticon().value_or_empty()),
data.vcolor()
? std::make_optional(data.vcolor()->v)
@ -143,7 +144,7 @@ ChatFilter ChatFilter::FromTL(
};
return ChatFilter(
data.vid().v,
qs(data.vtitle()),
Api::ParseTextWithEntities(&owner->session(), data.vtitle()),
qs(data.vemoticon().value_or_empty()),
data.vcolor()
? std::make_optional(data.vcolor()->v)
@ -162,9 +163,9 @@ ChatFilter ChatFilter::withId(FilterId id) const {
return result;
}
ChatFilter ChatFilter::withTitle(const QString &title) const {
ChatFilter ChatFilter::withTitle(TextWithEntities title) const {
auto result = *this;
result._title = title;
result._title = std::move(title);
return result;
}
@ -209,6 +210,12 @@ MTPDialogFilter ChatFilter::tl(FilterId replaceId) const {
for (const auto &history : always) {
include.push_back(history->peer->input);
}
auto title = MTP_textWithEntities(
MTP_string(_title.text),
Api::EntitiesToMTP(
nullptr,
_title.entities,
Api::ConvertOption::SkipLocal));
if (_flags & Flag::Chatlist) {
using TLFlag = MTPDdialogFilterChatlist::Flag;
const auto flags = TLFlag::f_emoticon
@ -216,7 +223,7 @@ MTPDialogFilter ChatFilter::tl(FilterId replaceId) const {
return MTP_dialogFilterChatlist(
MTP_flags(flags),
MTP_int(replaceId ? replaceId : _id),
MTP_string(_title),
std::move(title),
MTP_string(_iconEmoji),
MTP_int(_colorIndex.value_or(0)),
MTP_vector<MTPInputPeer>(pinned),
@ -243,7 +250,7 @@ MTPDialogFilter ChatFilter::tl(FilterId replaceId) const {
return MTP_dialogFilter(
MTP_flags(flags),
MTP_int(replaceId ? replaceId : _id),
MTP_string(_title),
std::move(title),
MTP_string(_iconEmoji),
MTP_int(_colorIndex.value_or(0)),
MTP_vector<MTPInputPeer>(pinned),
@ -255,7 +262,7 @@ FilterId ChatFilter::id() const {
return _id;
}
QString ChatFilter::title() const {
TextWithEntities ChatFilter::title() const {
return _title;
}

View file

@ -50,8 +50,8 @@ public:
ChatFilter() = default;
ChatFilter(
FilterId id,
const QString &title,
const QString &iconEmoji,
TextWithEntities title,
QString iconEmoji,
std::optional<uint8> colorIndex,
Flags flags,
base::flat_set<not_null<History*>> always,
@ -59,7 +59,7 @@ public:
base::flat_set<not_null<History*>> never);
[[nodiscard]] ChatFilter withId(FilterId id) const;
[[nodiscard]] ChatFilter withTitle(const QString &title) const;
[[nodiscard]] ChatFilter withTitle(TextWithEntities title) const;
[[nodiscard]] ChatFilter withColorIndex(std::optional<uint8>) const;
[[nodiscard]] ChatFilter withChatlist(
bool chatlist,
@ -72,7 +72,7 @@ public:
[[nodiscard]] MTPDialogFilter tl(FilterId replaceId = 0) const;
[[nodiscard]] FilterId id() const;
[[nodiscard]] QString title() const;
[[nodiscard]] TextWithEntities title() const;
[[nodiscard]] QString iconEmoji() const;
[[nodiscard]] std::optional<uint8> colorIndex() const;
[[nodiscard]] Flags flags() const;
@ -88,7 +88,7 @@ public:
private:
FilterId _id = 0;
QString _title;
TextWithEntities _title;
QString _iconEmoji;
std::optional<uint8> _colorIndex;
base::flat_set<not_null<History*>> _always;

View file

@ -347,6 +347,7 @@ void GroupCall::discard(const MTPDgroupCallDiscarded &data) {
Core::App().calls().applyGroupCallUpdateChecked(
&peer->session(),
MTP_updateGroupCall(
MTP_flags(MTPDupdateGroupCall::Flag::f_chat_id),
MTP_long(peer->isChat()
? peerToChat(peer->id).bare
: peerToChannel(peer->id).bare),

View file

@ -4591,7 +4591,8 @@ void Session::serviceNotification(
MTPint(), // stories_max_id
MTPPeerColor(), // color
MTPPeerColor(), // profile_color
MTPint())); // bot_active_users
MTPint(), // bot_active_users
MTPBotVerification()));
}
const auto history = this->history(PeerData::kServiceNotificationsId);
const auto insert = [=] {
@ -4649,7 +4650,8 @@ void Session::insertCheckedServiceNotification(
MTPint(), // ttl_period
MTPint(), // quick_reply_shortcut_id
MTPlong(), // effect
MTPFactCheck()),
MTPFactCheck(),
MTPint()), // report_delivery_until_date
localFlags,
NewMessageType::Unread);
}

View file

@ -329,6 +329,8 @@ enum class MessageFlag : uint64 {
HasRestrictions = (1ULL << 48),
EstimatedDate = (1ULL << 49),
ReactionsAllowed = (1ULL << 50),
};
inline constexpr bool is_flag_type(MessageFlag) { return true; }
using MessageFlags = base::flags<MessageFlag>;

View file

@ -4271,7 +4271,7 @@ QImage *InnerWidget::cacheChatsFilterTag(
auto roundedText = QString();
auto colorIndex = -1;
if (filter.id()) {
roundedText = filter.title().toUpper();
roundedText = filter.title().text.toUpper(); // todo filter emoji
if (filter.colorIndex()) {
colorIndex = *(filter.colorIndex());
}

View file

@ -1471,6 +1471,8 @@ ServiceAction ParseServiceAction(
return Reason::Hangup;
}, [](const MTPDphoneCallDiscardReasonBusy &data) {
return Reason::Busy;
}, [](const MTPDphoneCallDiscardReasonAllowGroupCall &) {
return Reason::AllowGroupCall;
});
}
result.content = content;
@ -1667,18 +1669,29 @@ ServiceAction ParseServiceAction(
.isUnclaimed = data.is_unclaimed(),
};
}, [&](const MTPDmessageActionStarGift &data) {
const auto &gift = data.vgift().data();
result.content = ActionStarGift{
.giftId = uint64(gift.vid().v),
.stars = int64(gift.vstars().v),
.text = (data.vmessage()
? ParseText(
data.vmessage()->data().vtext(),
data.vmessage()->data().ventities().v)
: std::vector<TextPart>()),
.anonymous = data.is_name_hidden(),
.limited = gift.is_limited(),
};
data.vgift().match([&](const MTPDstarGift &gift) {
result.content = ActionStarGift{
.giftId = uint64(gift.vid().v),
.stars = int64(gift.vstars().v),
.text = (data.vmessage()
? ParseText(
data.vmessage()->data().vtext(),
data.vmessage()->data().ventities().v)
: std::vector<TextPart>()),
.anonymous = data.is_name_hidden(),
.limited = gift.is_limited(),
};
}, [&](const MTPDstarGiftUnique &gift) {
result.content = ActionStarGift{
.giftId = uint64(gift.vid().v),
.text = (data.vmessage()
? ParseText(
data.vmessage()->data().vtext(),
data.vmessage()->data().ventities().v)
: std::vector<TextPart>()),
.anonymous = data.is_name_hidden(),
};
});
}, [](const MTPDmessageActionEmpty &data) {});
return result;
}

View file

@ -503,6 +503,7 @@ struct ActionPhoneCall {
Disconnect,
Hangup,
Busy,
AllowGroupCall,
};
DiscardReason discardReason = DiscardReason::Unknown;
int duration = 0;

View file

@ -90,6 +90,8 @@ MTPMessage PrepareLogMessage(const MTPMessage &message, TimeId newDate) {
const auto removeFlags = MTPDmessageService::Flag::f_out
| MTPDmessageService::Flag::f_post
| MTPDmessageService::Flag::f_reply_to
| MTPDmessageService::Flag::f_reactions_are_possible
| MTPDmessageService::Flag::f_reactions
| MTPDmessageService::Flag::f_ttl_period;
return MTP_messageService(
MTP_flags(data.vflags().v & ~removeFlags),
@ -99,6 +101,7 @@ MTPMessage PrepareLogMessage(const MTPMessage &message, TimeId newDate) {
MTPMessageReplyHeader(),
MTP_int(newDate),
data.vaction(),
MTPMessageReactions(),
MTPint()); // ttl_period
}, [&](const MTPDmessage &data) {
const auto removeFlags = MTPDmessage::Flag::f_out
@ -112,7 +115,8 @@ MTPMessage PrepareLogMessage(const MTPMessage &message, TimeId newDate) {
//| MTPDmessage::Flag::f_reactions
| MTPDmessage::Flag::f_restriction_reason
| MTPDmessage::Flag::f_ttl_period
| MTPDmessage::Flag::f_factcheck;
| MTPDmessage::Flag::f_factcheck
| MTPDmessage::Flag::f_report_delivery_until_date;
return MTP_message(
MTP_flags(data.vflags().v & ~removeFlags),
data.vid(),
@ -142,7 +146,8 @@ MTPMessage PrepareLogMessage(const MTPMessage &message, TimeId newDate) {
MTPint(), // ttl_period
MTPint(), // quick_reply_shortcut_id
MTP_long(data.veffect().value_or_empty()),
MTPFactCheck());
MTPFactCheck(),
MTPint()); // report_delivery_until_date
});
}

View file

@ -468,7 +468,8 @@ HistoryItem::HistoryItem(
createComponents(CreateConfig());
_media = std::make_unique<Data::MediaCall>(
this,
Data::ComputeCallData(data.vaction().c_messageActionPhoneCall()));
Data::ComputeCallData(
data.vaction().c_messageActionPhoneCall()));
setTextValue({});
}
applyTTL(data);
@ -2034,6 +2035,7 @@ void HistoryItem::applyEditionToHistoryCleared() {
MTPMessageReplyHeader(),
MTP_int(date()),
MTP_messageActionHistoryClear(),
MTPMessageReactions(),
MTPint() // ttl_period
).c_messageService());
}
@ -2587,8 +2589,10 @@ void HistoryItem::translationDone(LanguageId to, TextWithEntities result) {
}
bool HistoryItem::canReact() const {
if (!isRegular() || isService()) {
if (!isRegular()) {
return false;
} else if (isService()) {
return _flags & MessageFlag::ReactionsAllowed;
} else if (const auto media = this->media()) {
if (media->call()) {
return false;
@ -5393,7 +5397,12 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
auto result = PreparedServiceText();
const auto isSelf = _from->isSelf();
const auto peer = isSelf ? _history->peer : _from;
const auto stars = action.vgift().data().vstars().v;
const auto stars = action.vgift().match([&](
const MTPDstarGift &data) {
return uint64(data.vstars().v);
}, [](const MTPDstarGiftUnique &) {
return uint64();
});
const auto cost = TextWithEntities{
tr::lng_action_gift_for_stars(tr::now, lt_count, stars),
};
@ -5517,17 +5526,13 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
}
}
}, [&](const MTPDmessageActionGiftPremium &data) {
const auto session = &history()->session();
_media = std::make_unique<Data::MediaGiftBox>(
this,
_from,
Data::GiftCode{
.message = (data.vmessage()
? TextWithEntities{
.text = qs(data.vmessage()->data().vtext()),
.entities = Api::EntitiesFromMTP(
&history()->session(),
data.vmessage()->data().ventities().v),
}
? Api::ParseTextWithEntities(session, *data.vmessage())
: TextWithEntities()),
.count = data.vmonths().v,
.type = Data::GiftType::Premium,
@ -5599,28 +5604,31 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
.unclaimed = data.is_unclaimed(),
});
}, [&](const MTPDmessageActionStarGift &data) {
const auto &gift = data.vgift().data();
const auto document = history()->owner().processDocument(
gift.vsticker());
using Fields = Data::GiftCode;
_media = std::make_unique<Data::MediaGiftBox>(this, _from, Fields{
.document = document->sticker() ? document.get() : nullptr,
.message = (data.vmessage()
? TextWithEntities{
.text = qs(data.vmessage()->data().vtext()),
.entities = Api::EntitiesFromMTP(
&history()->session(),
data.vmessage()->data().ventities().v),
}
: TextWithEntities()),
.starsConverted = int(data.vconvert_stars().value_or_empty()),
.limitedCount = gift.vavailability_total().value_or_empty(),
.limitedLeft = gift.vavailability_remains().value_or_empty(),
.count = int(gift.vstars().v),
.type = Data::GiftType::StarGift,
.anonymous = data.is_name_hidden(),
.converted = data.is_converted(),
.saved = data.is_saved(),
data.vgift().match([&](const MTPDstarGift &gift) {
const auto document = history()->owner().processDocument(
gift.vsticker());
using Fields = Data::GiftCode;
_media = std::make_unique<Data::MediaGiftBox>(this, _from, Fields{
.document = document->sticker() ? document.get() : nullptr,
.message = (data.vmessage()
? TextWithEntities{
.text = qs(data.vmessage()->data().vtext()),
.entities = Api::EntitiesFromMTP(
&history()->session(),
data.vmessage()->data().ventities().v),
}
: TextWithEntities()),
.starsConverted = int(data.vconvert_stars().value_or_empty()),
.limitedCount = gift.vavailability_total().value_or_empty(),
.limitedLeft = gift.vavailability_remains().value_or_empty(),
.count = int(gift.vstars().v),
.type = Data::GiftType::StarGift,
.anonymous = data.is_name_hidden(),
.converted = data.is_converted(),
.saved = data.is_saved(),
});
}, [&](const MTPDstarGiftUnique &gift) {
});
}, [](const auto &) {
});

View file

@ -472,7 +472,10 @@ MessageFlags FlagsFromMTP(
| ((flags & MTP::f_post) ? Flag::Post : Flag())
| ((flags & MTP::f_legacy) ? Flag::Legacy : Flag())
| ((flags & MTP::f_from_id) ? Flag::HasFromId : Flag())
| ((flags & MTP::f_reply_to) ? Flag::HasReplyInfo : Flag());
| ((flags & MTP::f_reply_to) ? Flag::HasReplyInfo : Flag())
| ((flags & MTP::f_reactions_are_possible)
? Flag::ReactionsAllowed
: Flag());
}
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) {

View file

@ -60,7 +60,8 @@ PeerId GenerateUser(not_null<History*> history, const QString &name) {
MTPint(), // stories_max_id
MTPPeerColor(), // color
MTPPeerColor(), // profile_color
MTPint())); // bot_active_users
MTPint(), // bot_active_users
MTPBotVerification()));
return peerId;
}

View file

@ -173,7 +173,8 @@ void Account::createSession(
MTPint(), // stories_max_id
MTPPeerColor(), // color
MTPPeerColor(), // profile_color
MTPint()), // bot_active_users
MTPint(), // bot_active_users
MTPBotVerification()),
serialized,
streamVersion,
std::move(settings));

View file

@ -84,7 +84,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
storage.fileWebp#1081464c = storage.FileType;
userEmpty#d3bc4b7a id:long = User;
user#83314fca flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int = User;
user#59476956 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification:flags2.14?BotVerification = User;
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
@ -99,7 +99,7 @@ userStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus;
chatEmpty#29562865 id:long = Chat;
chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
chatForbidden#6592a1a7 id:long title:string = Chat;
channel#fe4478bd flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int = Chat;
channel#46aeac06 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification:flags2.13?BotVerification = Chat;
channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull;
@ -116,8 +116,8 @@ chatPhotoEmpty#37c1011c = ChatPhoto;
chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;
messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;
message#94345242 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck = Message;
messageService#2b085862 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction ttl_period:flags.25?int = Message;
message#96fdbbe9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int = Message;
messageService#d3d28540 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message;
messageMediaEmpty#3ded6320 = MessageMedia;
messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
@ -183,7 +183,7 @@ messageActionRequestedPeerSentMe#93b31848 button_id:int peers:Vector<RequestedPe
messageActionPaymentRefunded#41b3e202 flags:# peer:Peer currency:string total_amount:long payload:flags.0?bytes charge:PaymentCharge = MessageAction;
messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long crypto_currency:flags.0?string crypto_amount:flags.0?long transaction_id:flags.1?string = MessageAction;
messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction;
messageActionStarGift#8557637 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long = MessageAction;
messageActionStarGift#b54b82a2 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true transferred:flags.6?true can_upgrade:flags.8?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long can_export_at:flags.7?int = MessageAction;
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
@ -371,7 +371,7 @@ updatePinnedMessages#ed85eab5 flags:# pinned:flags.0?true peer:Peer messages:Vec
updatePinnedChannelMessages#5bb98608 flags:# pinned:flags.0?true channel_id:long messages:Vector<int> pts:int pts_count:int = Update;
updateChat#f89a6a4e chat_id:long = Update;
updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector<GroupCallParticipant> version:int = Update;
updateGroupCall#14b24500 chat_id:long call:GroupCall = Update;
updateGroupCall#97d64341 flags:# chat_id:flags.0?long call:GroupCall = Update;
updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update;
updateChatParticipant#d087663a flags:# chat_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
updateChannelParticipant#985d3abb flags:# via_chatlist:flags.3?true channel_id:long date:int actor_id:long user_id:long prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
@ -426,6 +426,7 @@ updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long conne
updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update;
updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update;
updatePaidReactionPrivacy#51ca7aec private:Bool = Update;
updateStarGiftUpgraded#767cde44 gift:UserStarGift to_gift:UserStarGift = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -619,7 +620,7 @@ chatInviteExported#a22cbd96 flags:# revoked:flags.0?true permanent:flags.5?true
chatInvitePublicJoinRequests#ed107ab7 = ExportedChatInvite;
chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
chatInvite#fe65389d flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true request_needed:flags.6?true verified:flags.7?true scam:flags.8?true fake:flags.9?true can_refulfill_subscription:flags.11?true title:string about:flags.5?string photo:Photo participants_count:int participants:flags.4?Vector<User> color:int subscription_pricing:flags.10?StarsSubscriptionPricing subscription_form_id:flags.12?long = ChatInvite;
chatInvite#5c9d3702 flags:# channel:flags.0?true broadcast:flags.1?true public:flags.2?true megagroup:flags.3?true request_needed:flags.6?true verified:flags.7?true scam:flags.8?true fake:flags.9?true can_refulfill_subscription:flags.11?true title:string about:flags.5?string photo:Photo participants_count:int participants:flags.4?Vector<User> color:int subscription_pricing:flags.10?StarsSubscriptionPricing subscription_form_id:flags.12?long bot_verification:flags.13?BotVerification = ChatInvite;
chatInvitePeek#61695cb0 chat:Chat expires:int = ChatInvite;
inputStickerSetEmpty#ffb62b95 = InputStickerSet;
@ -641,7 +642,7 @@ messages.stickerSetNotModified#d3f924eb = messages.StickerSet;
botCommand#c27ac8c7 command:string description:string = BotCommand;
botInfo#36607333 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings = BotInfo;
botInfo#4d8a0299 flags:# has_preview_medias:flags.6?true user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton privacy_policy_url:flags.7?string app_settings:flags.8?BotAppSettings verifier_settings:flags.9?BotVerifierSettings = BotInfo;
keyboardButton#a2fa4880 text:string = KeyboardButton;
keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
@ -894,6 +895,7 @@ phoneCallDiscardReasonMissed#85e42301 = PhoneCallDiscardReason;
phoneCallDiscardReasonDisconnect#e095c1a0 = PhoneCallDiscardReason;
phoneCallDiscardReasonHangup#57adc690 = PhoneCallDiscardReason;
phoneCallDiscardReasonBusy#faf7e8c9 = PhoneCallDiscardReason;
phoneCallDiscardReasonAllowGroupCall#afe2b839 encrypted_key:bytes = PhoneCallDiscardReason;
dataJSON#7d748d04 data:string = DataJSON;
@ -923,6 +925,7 @@ upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mti
payments.paymentForm#a0058751 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice provider_id:long url:string native_provider:flags.4?string native_params:flags.4?DataJSON additional_methods:flags.6?Vector<PaymentFormMethod> saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?Vector<PaymentSavedCredentials> users:Vector<User> = payments.PaymentForm;
payments.paymentFormStars#7bf6b15c flags:# form_id:long bot_id:long title:string description:string photo:flags.5?WebDocument invoice:Invoice users:Vector<User> = payments.PaymentForm;
payments.paymentFormStarGift#b425cfe1 form_id:long invoice:Invoice = payments.PaymentForm;
payments.paymentFormStarGiftUpgrade#ed1802c6 form_id:long invoice:Invoice sample_attributes:Vector<StarGiftAttribute> = payments.PaymentForm;
payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;
@ -948,11 +951,11 @@ inputStickerSetItem#32da9e9c flags:# document:InputDocument emoji:string mask_co
inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall;
phoneCallEmpty#5366c915 id:long = PhoneCall;
phoneCallWaiting#c5226f17 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;
phoneCallRequested#14b0ed0c flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;
phoneCallAccepted#3660c311 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol = PhoneCall;
phoneCall#30535af5 flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON = PhoneCall;
phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
phoneCallWaiting#eed42858 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int conference_call:flags.8?InputGroupCall = PhoneCall;
phoneCallRequested#45361c63 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall;
phoneCallAccepted#22fd7181 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol conference_call:flags.8?InputGroupCall = PhoneCall;
phoneCall#3ba5940c flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON conference_call:flags.8?InputGroupCall = PhoneCall;
phoneCallDiscarded#f9d25503 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int conference_call:flags.8?InputGroupCall = PhoneCall;
phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;
@ -1273,9 +1276,9 @@ bankCardOpenUrl#f568028a url:string name:string = BankCardOpenUrl;
payments.bankCardData#3e24e573 title:string open_urls:Vector<BankCardOpenUrl> = payments.BankCardData;
dialogFilter#5fb5523b flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;
dialogFilter#aa472651 flags:# contacts:flags.0?true non_contacts:flags.1?true groups:flags.2?true broadcasts:flags.3?true bots:flags.4?true exclude_muted:flags.11?true exclude_read:flags.12?true exclude_archived:flags.13?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> exclude_peers:Vector<InputPeer> = DialogFilter;
dialogFilterDefault#363293ae = DialogFilter;
dialogFilterChatlist#9fe28ea4 flags:# has_my_invites:flags.26?true id:int title:string emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> = DialogFilter;
dialogFilterChatlist#96537bd7 flags:# has_my_invites:flags.26?true title_noanimate:flags.28?true id:int title:TextWithEntities emoticon:flags.25?string color:flags.27?int pinned_peers:Vector<InputPeer> include_peers:Vector<InputPeer> = DialogFilter;
dialogFilterSuggested#77744d4a filter:DialogFilter description:string = DialogFilterSuggested;
@ -1331,7 +1334,7 @@ peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;
stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats;
groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;
groupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall;
groupCall#cdf8d3e3 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int conference_from_call:flags.14?long = GroupCall;
inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;
@ -1473,6 +1476,7 @@ inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:Pre
inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice;
inputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice;
inputInvoiceStarGift#25d8c1d8 flags:# hide_name:flags.0?true user_id:InputUser gift_id:long message:flags.1?TextWithEntities = InputInvoice;
inputInvoiceStarGiftUpgrade#9b352120 flags:# keep_original_details:flags.0?true user_id:InputUser msg_id:int = InputInvoice;
payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice;
@ -1590,7 +1594,7 @@ chatlists.exportedChatlistInvite#10e6e3a6 filter:DialogFilter invite:ExportedCha
chatlists.exportedInvites#10ab6dc7 invites:Vector<ExportedChatlistInvite> chats:Vector<Chat> users:Vector<User> = chatlists.ExportedInvites;
chatlists.chatlistInviteAlready#fa87f659 filter_id:int missing_peers:Vector<Peer> already_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite;
chatlists.chatlistInvite#1dcd839d flags:# title:string emoticon:flags.0?string peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite;
chatlists.chatlistInvite#f10ece2f flags:# title_noanimate:flags.1?true title:TextWithEntities emoticon:flags.0?string peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistInvite;
chatlists.chatlistUpdates#93bd878d missing_peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = chatlists.ChatlistUpdates;
@ -1870,11 +1874,12 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true
starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;
starGift#49c577cd flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int = StarGift;
starGiftUnique#6a1407cd id:long title:string num:int owner_id:long attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int = StarGift;
payments.starGiftsNotModified#a388a368 = payments.StarGifts;
payments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts;
userStarGift#eea49a6e flags:# name_hidden:flags.0?true unsaved:flags.5?true from_id:flags.1?long date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int convert_stars:flags.4?long = UserStarGift;
userStarGift#2b97af02 flags:# name_hidden:flags.0?true unsaved:flags.5?true can_upgrade:flags.6?true from_id:flags.1?long date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int convert_stars:flags.4?long can_export_at:flags.7?int = UserStarGift;
payments.userStarGifts#6b65b517 flags:# count:int gifts:Vector<UserStarGift> next_offset:flags.0?string users:Vector<User> = payments.UserStarGifts;
@ -1903,6 +1908,15 @@ starsAmount#bbb6b4a3 amount:long nanos:int = StarsAmount;
messages.foundStickersNotModified#6010c534 flags:# next_offset:flags.0?int = messages.FoundStickers;
messages.foundStickers#82c9e290 flags:# next_offset:flags.0?int hash:long stickers:Vector<Document> = messages.FoundStickers;
botVerifierSettings#b0cd6617 flags:# can_modify_custom_description:flags.1?true icon:long company:string custom_description:flags.0?string = BotVerifierSettings;
botVerification#4a1c6d3c flags:# bot_id:long icon:long company:string description:flags.0?string = BotVerification;
starGiftAttributeModel#a2f7a0d8 name:string document_id:long rarity_permille:int = StarGiftAttribute;
starGiftAttributePattern#b8b33e23 name:string document_id:long rarity_permille:int = StarGiftAttribute;
starGiftAttributeBackdrop#94271762 name:string center_color:int edge_color:int pattern_color:int text_color:int rarity_permille:int = StarGiftAttribute;
starGiftAttributeOriginalDetails#c02c4f4b flags:# sender_id:flags.0?long recipient_id:long date:int message:flags.1?TextWithEntities = StarGiftAttribute;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -2132,7 +2146,7 @@ messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_par
messages.getMessagesViews#5784d3e1 peer:InputPeer id:Vector<int> increment:Bool = messages.MessageViews;
messages.editChatAdmin#a85bd1c2 chat_id:long user_id:InputUser is_admin:Bool = Bool;
messages.migrateChat#a2875319 chat_id:long = Updates;
messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
messages.searchGlobal#4bc6589a flags:# broadcasts_only:flags.1?true groups_only:flags.2?true users_only:flags.3?true folder_id:flags.0?int q:string filter:MessagesFilter min_date:int max_date:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
messages.reorderStickerSets#78337739 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Bool;
messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document;
messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs;
@ -2309,6 +2323,7 @@ messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessag
messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector<InlineQueryPeerType> = messages.BotPreparedInlineMessage;
messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage;
messages.searchStickers#29b1c66a flags:# emojis:flags.0?true q:string emoticon:string lang_code:Vector<string> offset:int limit:int hash:long = messages.FoundStickers;
messages.reportMessagesDelivery#5a6d7395 flags:# push:flags.0?true peer:InputPeer id:Vector<int> = Bool;
updates.getState#edd4882a = updates.State;
updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference;
@ -2445,6 +2460,7 @@ bots.toggleUserEmojiStatusPermission#6de6392 bot:InputUser enabled:Bool = Bool;
bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string = Bool;
bots.getAdminedBots#b0711d83 = Vector<User>;
bots.updateStarRefProgram#778b5ab3 flags:# bot:InputUser commission_permille:int duration_months:flags.0?int = StarRefProgram;
bots.setCustomVerification#8b89dfbd flags:# enabled:flags.1?true bot:flags.0?InputUser peer:InputPeer custom_description:flags.2?string = Bool;
payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm;
payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
@ -2486,6 +2502,7 @@ payments.getConnectedStarRefBot#b7d998f0 peer:InputPeer bot:InputUser = payments
payments.getSuggestedStarRefBots#d6b48f7 flags:# order_by_revenue:flags.0?true order_by_date:flags.1?true peer:InputPeer offset:string limit:int = payments.SuggestedStarRefBots;
payments.connectStarRefBot#7ed5348a peer:InputPeer bot:InputUser = payments.ConnectedStarRefBots;
payments.editConnectedStarRefBot#e4fca4a3 flags:# revoked:flags.0?true peer:InputPeer link:string = payments.ConnectedStarRefBots;
payments.transferStarGift#e7ebd0d5 user_id:InputUser msg_id:int to_id:InputUser = Updates;
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
@ -2500,7 +2517,7 @@ stickers.deleteStickerSet#87704394 stickerset:InputStickerSet = Bool;
stickers.replaceSticker#4696459a sticker:InputDocument new_sticker:InputStickerSetItem = messages.StickerSet;
phone.getCallConfig#55451fa9 = DataJSON;
phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
phone.requestCall#a6c4600c flags:# video:flags.0?true user_id:InputUser conference_call:flags.1?InputGroupCall random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
phone.acceptCall#3bd2b4a0 peer:InputPhoneCall g_b:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
phone.confirmCall#2efe1722 peer:InputPhoneCall g_a:bytes key_fingerprint:long protocol:PhoneCallProtocol = phone.PhoneCall;
phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
@ -2509,7 +2526,7 @@ phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhon
phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool;
phone.createGroupCall#48cdc6d8 flags:# rtmp_stream:flags.2?true peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates;
phone.joinGroupCall#b132ff7b flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string params:DataJSON = Updates;
phone.joinGroupCall#d61e1df3 flags:# muted:flags.0?true video_stopped:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string key_fingerprint:flags.3?long params:DataJSON = Updates;
phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates;
phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector<InputUser> = Updates;
phone.discardGroupCall#7a777135 call:InputGroupCall = Updates;
@ -2530,6 +2547,7 @@ phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;
phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallStreamChannels;
phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl;
phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool;
phone.createConferenceCall#dfc909ab peer:InputPhoneCall key_fingerprint:long = phone.PhoneCall;
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
@ -2605,4 +2623,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
// LAYER 195
// LAYER 196

View file

@ -514,6 +514,8 @@ void Form::requestForm() {
.starGiftForm = true,
};
_updates.fire(CreditsPaymentStarted{ .data = formData });
}, [&](const MTPDpayments_paymentFormStarGiftUpgrade &data) {
// todo gifts
});
}).fail([=](const MTP::Error &error) {
hideProgress();

View file

@ -216,8 +216,8 @@ void FilterRowButton::setRemoved(bool removed) {
void FilterRowButton::updateData(const Data::ChatFilter &filter) {
Expects(_session != nullptr);
_title.setText(st::contactsNameStyle, filter.title());
// todo filter emoji
_title.setText(st::contactsNameStyle, filter.title().text);
_icon = Ui::ComputeFilterIcon(filter);
_colorIndex = filter.colorIndex();
updateCount(filter);
@ -243,8 +243,8 @@ void FilterRowButton::setup(
const Data::ChatFilter &filter,
const QString &status) {
resize(width(), st::defaultPeerListItem.height);
_title.setText(st::contactsNameStyle, filter.title());
// todo filter emoji
_title.setText(st::contactsNameStyle, filter.title().text);
_status = status;
_icon = Ui::ComputeFilterIcon(filter);
_colorIndex = filter.colorIndex();

View file

@ -202,7 +202,8 @@ AdminLog::OwnedItem GenerateForwardedItem(
MTPint(), // ttl_period
MTPint(), // quick_reply_shortcut_id
MTPlong(), // effect
MTPFactCheck()
MTPFactCheck(),
MTPint() // report_delivery_until_date
).match([&](const MTPDmessage &data) {
return history->makeMessage(
history->nextNonHistoryEntryId(),

View file

@ -70,7 +70,7 @@ private:
QPoint _titlePosition;
QPainterPath _titlePath;
QString _folderTitle;
TextWithEntities _folderTitle;
not_null<const style::icon*> _folderIcon;
bool _horizontalFilters = false;
@ -82,7 +82,7 @@ private:
[[nodiscard]] QImage GeneratePreview(
not_null<Ui::RpWidget*> parent,
const QString &title,
const TextWithEntities &title,
int badge) {
using Tabs = Ui::ChatsFiltersTabs;
auto owned = parent->lifetime().make_state<base::unique_qptr<Tabs>>(
@ -90,7 +90,7 @@ private:
const auto raw = owned->get();
raw->setSections({
tr::lng_filters_name_people(tr::now),
title,
title.text, // todo filter emoji
tr::lng_filters_name_unread(tr::now),
});
raw->fitWidthToSections();
@ -121,7 +121,7 @@ private:
}
[[nodiscard]] QImage GeneratePreview(
const QString &title,
const TextWithEntities &title,
not_null<const style::icon*> icon,
int badge) {
const auto size = st::filterLinkPreview;
@ -171,7 +171,7 @@ private:
p.setPen(st.textFg);
paintName(tr::lng_filters_all(tr::now), st::filterLinkPreviewAllTop);
p.setPen(st.textFgActive);
paintName(title, st::filterLinkPreviewMyTop);
paintName(title.text, st::filterLinkPreviewMyTop); // todo filter emoji
auto hq = PainterHighQualityEnabler(p);
@ -414,7 +414,7 @@ void Widget::wheelEvent(QWheelEvent *e) {
object_ptr<RoundButton> FilterLinkProcessButton(
not_null<QWidget*> parent,
FilterLinkHeaderType type,
const QString &title,
TextWithEntities title,
rpl::producer<int> badge) {
const auto st = &st::filterInviteBox.button;
const auto badgeSt = &st::filterInviteButtonBadgeStyle;
@ -439,7 +439,7 @@ object_ptr<RoundButton> FilterLinkProcessButton(
? tr::lng_filters_by_link_add_no() | with(QString())
: tr::lng_filters_by_link_add_button(
lt_folder,
rpl::single(title)
rpl::single(title.text) // todo filter emoji
) | with(badge);
case FilterLinkHeaderType::AddingChats:
return badge.isEmpty()

View file

@ -26,7 +26,7 @@ struct FilterLinkHeaderDescriptor {
base::required<FilterLinkHeaderType> type;
base::required<QString> title;
base::required<TextWithEntities> about;
base::required<QString> folderTitle;
base::required<TextWithEntities> folderTitle;
not_null<const style::icon*> folderIcon;
rpl::producer<int> badge;
bool horizontalFilters = false;
@ -45,7 +45,7 @@ struct FilterLinkHeader {
[[nodiscard]] object_ptr<RoundButton> FilterLinkProcessButton(
not_null<QWidget*> parent,
FilterLinkHeaderType type,
const QString &title,
TextWithEntities title,
rpl::producer<int> badge);
} // namespace Ui

View file

@ -149,9 +149,9 @@ void ShowFiltersListMenu(
for (auto i = 0; i < list.size(); ++i) {
const auto &filter = list[i];
auto text = filter.title().isEmpty()
auto text = filter.title().empty()
? tr::lng_filters_all_short(tr::now)
: filter.title();
: filter.title().text; // todo filter emoji
const auto action = state->menu->addAction(std::move(text), [=] {
if (i != active) {
@ -329,9 +329,9 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
ranges::views::all(
list
) | ranges::views::transform([](const Data::ChatFilter &filter) {
return filter.title().isEmpty()
return filter.title().empty()
? tr::lng_filters_all_short(tr::now)
: filter.title();
: filter.title().text; // todo filter emoji
}) | ranges::to_vector);
if (!sectionsChanged) {
return;

View file

@ -216,7 +216,7 @@ void FiltersMenu::setupList() {
_setup = prepareButton(
_container,
-1,
tr::lng_filters_setup(tr::now),
TextWithEntities{ tr::lng_filters_setup(tr::now) },
Ui::FilterIcon::Edit);
_reorder = std::make_unique<Ui::VerticalLayoutReorder>(_list, &_scroll);
@ -247,12 +247,12 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareAll() {
base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
not_null<Ui::VerticalLayout*> container,
FilterId id,
const QString &title,
TextWithEntities title,
Ui::FilterIcon icon,
bool toBeginning) {
auto prepared = object_ptr<Ui::SideBarButton>(
container,
id ? title : tr::lng_filters_all(tr::now),
id ? title.text : tr::lng_filters_all(tr::now), // todo filter emoji
st::windowFiltersButton);
auto added = toBeginning
? container->insert(0, std::move(prepared))

View file

@ -44,7 +44,7 @@ private:
[[nodiscard]] base::unique_qptr<Ui::SideBarButton> prepareButton(
not_null<Ui::VerticalLayout*> container,
FilterId id,
const QString &title,
TextWithEntities title,
Ui::FilterIcon icon,
bool toBeginning = false);
void setupMainMenuIcon();