From 6b5669780968dd112f8f6baabececd5ba9cda97f Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Apr 2024 15:34:42 +0400 Subject: [PATCH] wip fix build --- Telegram/SourceFiles/api/api_chat_links.cpp | 15 ++ Telegram/SourceFiles/api/api_earn.cpp | 4 + .../data/business/data_business_chatbots.cpp | 74 +++++++++ .../data/business/data_business_common.cpp | 152 ++++++++++++++++++ .../data/business/data_business_common.h | 35 ++++ .../data/business/data_business_info.cpp | 77 +++++++++ .../SourceFiles/data/data_media_types.cpp | 2 + Telegram/SourceFiles/data/data_media_types.h | 2 + Telegram/SourceFiles/data/data_user.cpp | 8 +- Telegram/SourceFiles/data/data_user.h | 3 + .../SourceFiles/tdb/details/tdb_instance.cpp | 4 +- 11 files changed, 372 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/api/api_chat_links.cpp b/Telegram/SourceFiles/api/api_chat_links.cpp index aa5be9f55a496a..6f951d883fa0f1 100644 --- a/Telegram/SourceFiles/api/api_chat_links.cpp +++ b/Telegram/SourceFiles/api/api_chat_links.cpp @@ -12,9 +12,15 @@ For license and copyright information please follow this link: #include "data/data_session.h" #include "main/main_session.h" +#include "tdb/tdb_sender.h" +#include "tdb/tdb_tl_scheme.h" + namespace Api { namespace { +using namespace Tdb; + +#if 0 // mtp [[nodiscard]] ChatLink FromMTP( not_null session, const MTPBusinessChatLink &link) { @@ -49,6 +55,7 @@ namespace { std::move(entities), MTP_string(title)); } +#endif } // namespace @@ -60,6 +67,7 @@ void ChatLinks::create( const TextWithEntities &message, Fn done) { const auto session = &_api->session(); +#if 0 // tdlib todo _api->request(MTPaccount_CreateBusinessChatLink( ToMTP(session, title, message) )).done([=](const MTPBusinessChatLink &result) { @@ -71,6 +79,7 @@ void ChatLinks::create( const auto type = error.type(); if (done) done(Link()); }).send(); +#endif } void ChatLinks::edit( @@ -79,6 +88,7 @@ void ChatLinks::edit( const TextWithEntities &message, Fn done) { const auto session = &_api->session(); +#if 0 // tdlib todo _api->request(MTPaccount_EditBusinessChatLink( MTP_string(link), ToMTP(session, title, message) @@ -102,11 +112,13 @@ void ChatLinks::edit( const auto type = error.type(); if (done) done(Link()); }).send(); +#endif } void ChatLinks::destroy( const QString &link, Fn done) { +#if 0 // tdlib todo _api->request(MTPaccount_DeleteBusinessChatLink( MTP_string(link) )).done([=] { @@ -123,12 +135,14 @@ void ChatLinks::destroy( const auto type = error.type(); if (done) done(); }).send(); +#endif } void ChatLinks::preload() { if (_loaded || _requestId) { return; } +#if 0 // tdlib todo _requestId = _api->request(MTPaccount_GetBusinessChatLinks( )).done([=](const MTPaccount_BusinessChatLinks &result) { const auto &data = result.data(); @@ -149,6 +163,7 @@ void ChatLinks::preload() { _loaded = true; _loadedUpdates.fire({}); }).send(); +#endif } const std::vector &ChatLinks::list() const { diff --git a/Telegram/SourceFiles/api/api_earn.cpp b/Telegram/SourceFiles/api/api_earn.cpp index d6425ef69b738e..503fbeaf44a030 100644 --- a/Telegram/SourceFiles/api/api_earn.cpp +++ b/Telegram/SourceFiles/api/api_earn.cpp @@ -23,6 +23,7 @@ void RestrictSponsored( not_null channel, bool restricted, Fn failed) { +#if 0 // tdlib todo channel->session().api().request(MTPchannels_RestrictSponsoredMessages( channel->inputChannel, MTP_bool(restricted)) @@ -31,6 +32,7 @@ void RestrictSponsored( }).fail([=](const MTP::Error &error) { failed(error.type()); }).send(); +#endif } void HandleWithdrawalButton( @@ -77,6 +79,7 @@ void HandleWithdrawalButton( const auto fail = [=](const QString &error) { show->showToast(error); }; +#if 0 // tdlib todo session->api().request( MTPstats_GetBroadcastRevenueWithdrawalUrl( channel->inputChannel, @@ -86,6 +89,7 @@ void HandleWithdrawalButton( }).fail([=](const MTP::Error &error) { fail(error.type()); }).send(); +#endif }); show->show(Box(session, fields)); }); diff --git a/Telegram/SourceFiles/data/business/data_business_chatbots.cpp b/Telegram/SourceFiles/data/business/data_business_chatbots.cpp index ca894acf556b98..891212ef5fe726 100644 --- a/Telegram/SourceFiles/data/business/data_business_chatbots.cpp +++ b/Telegram/SourceFiles/data/business/data_business_chatbots.cpp @@ -14,7 +14,15 @@ For license and copyright information please follow this link: #include "data/data_user.h" #include "main/main_session.h" +#include "tdb/tdb_sender.h" +#include "tdb/tdb_tl_scheme.h" + namespace Data { +namespace { + +using namespace Tdb; + +} // namespace Chatbots::Chatbots(not_null owner) : _owner(owner) { @@ -26,6 +34,30 @@ void Chatbots::preload() { if (_loaded || _requestId) { return; } + _requestId = _owner->session().sender().request( + TLgetBusinessConnectedBot() + ).done([=](const TLbusinessConnectedBot &result) { + _requestId = 0; + _loaded = true; + + const auto &data = result.data(); + const auto botId = UserId(data.vbot_user_id().v); + _settings = ChatbotsSettings{ + .bot = _owner->session().data().user(botId), + .recipients = FromTL(_owner, data.vrecipients()), + .repliesAllowed = data.vcan_reply().v, + }; + }).fail([=](const Error &error) { + _requestId = 0; + if (error.code == 404) { + _loaded = true; + _settings.force_assign(ChatbotsSettings()); + } else { + LOG(("API Error: Could not get connected bot (%1)" + ).arg(error.message)); + } + }).send(); +#if 0 // mtp _requestId = _owner->session().api().request( MTPaccount_GetConnectedBots() ).done([=](const MTPaccount_ConnectedBots &result) { @@ -52,6 +84,7 @@ void Chatbots::preload() { ).arg(error.code() ).arg(error.type())); }).send(); +#endif } bool Chatbots::loaded() const { @@ -77,6 +110,33 @@ void Chatbots::save( const auto was = _settings.current(); if (was == settings) { return; + } else if (settings.bot) { + _owner->session().sender().request(TLsetBusinessConnectedBot( + tl_businessConnectedBot( + tl_int53(peerToUser(settings.bot->id).bare), + ForBotsToTL(settings.recipients), + tl_bool(settings.repliesAllowed)) + )).done([=] { + if (done) { + done(); + } + }).fail([=](const Error &error) { + if (fail) { + fail(error.message); + } + }).send(); + } else if (was.bot) { + _owner->session().sender().request(TLdeleteBusinessConnectedBot( + )).done([=] { + if (done) { + done(); + } + }).fail([=](const Error &error) { + if (fail) { + fail(error.message); + } + }).send(); +#if 0 // mtp } else if (was.bot || settings.bot) { using Flag = MTPaccount_UpdateConnectedBot::Flag; const auto api = &_owner->session().api(); @@ -99,6 +159,7 @@ void Chatbots::save( fail(error.type()); } }).send(); +#endif } _settings = settings; } @@ -107,7 +168,10 @@ void Chatbots::togglePaused(not_null peer, bool paused) { const auto type = paused ? SentRequestType::Pause : SentRequestType::Unpause; +#if 0 // mtp const auto api = &_owner->session().api(); +#endif + const auto api = &_owner->session().sender(); const auto i = _sentRequests.find(peer); if (i != end(_sentRequests)) { const auto already = i->second.type; @@ -117,6 +181,7 @@ void Chatbots::togglePaused(not_null peer, bool paused) { api->request(i->second.requestId).cancel(); _sentRequests.erase(i); } +#if 0 // tdlib todo const auto id = api->request(MTPaccount_ToggleConnectedBotPaused( peer->input, MTP_bool(paused) @@ -141,11 +206,15 @@ void Chatbots::togglePaused(not_null peer, bool paused) { _sentRequests.remove(peer); }).send(); _sentRequests[peer] = SentRequest{ type, id }; +#endif } void Chatbots::removeFrom(not_null peer) { const auto type = SentRequestType::Remove; +#if 0 // mtp const auto api = &_owner->session().api(); +#endif + const auto api = &_owner->session().sender(); const auto i = _sentRequests.find(peer); if (i != end(_sentRequests)) { const auto already = i->second.type; @@ -155,6 +224,7 @@ void Chatbots::removeFrom(not_null peer) { api->request(i->second.requestId).cancel(); _sentRequests.erase(i); } +#if 0 // tdlib todo const auto id = api->request(MTPaccount_DisablePeerConnectedBot( peer->input )).done([=] { @@ -172,11 +242,15 @@ void Chatbots::removeFrom(not_null peer) { _sentRequests.remove(peer); }).send(); _sentRequests[peer] = SentRequest{ type, id }; +#endif } void Chatbots::reload() { _loaded = false; +#if 0 // mtp _owner->session().api().request(base::take(_requestId)).cancel(); +#endif + _owner->session().sender().request(base::take(_requestId)).cancel(); preload(); } diff --git a/Telegram/SourceFiles/data/business/data_business_common.cpp b/Telegram/SourceFiles/data/business/data_business_common.cpp index 149a3ee1369fd6..c59dfc8fcf501a 100644 --- a/Telegram/SourceFiles/data/business/data_business_common.cpp +++ b/Telegram/SourceFiles/data/business/data_business_common.cpp @@ -11,9 +11,13 @@ For license and copyright information please follow this link: #include "data/data_session.h" #include "data/data_user.h" +#include "tdb/tdb_tl_scheme.h" + namespace Data { namespace { +using namespace Tdb; + constexpr auto kDay = WorkingInterval::kDay; constexpr auto kWeek = WorkingInterval::kWeek; constexpr auto kInNextDayMax = WorkingInterval::kInNextDayMax; @@ -78,6 +82,7 @@ BusinessRecipients BusinessRecipients::MakeValid(BusinessRecipients value) { return value; } +#if 0 // mtp MTPInputBusinessRecipients ForMessagesToMTP(const BusinessRecipients &data) { using Flag = MTPDinputBusinessRecipients::Flag; const auto &chats = data.allButExcluded ? data.excluded : data.included; @@ -242,6 +247,153 @@ BusinessDetails FromMTP( .shortcutId = data.vshortcut_id().v, }; } +#endif + +TLbusinessRecipients ForMessagesToTL(const BusinessRecipients &data) { + auto copy = data; + (copy.allButExcluded ? copy.included : copy.excluded) = {}; + return ForBotsToTL(copy); +} + +TLbusinessRecipients ForBotsToTL(const BusinessRecipients &data) { + const auto &chats = data.allButExcluded ? data.excluded : data.included; + auto chatIds = QVector(); + chatIds.reserve(chats.list.size()); + for (const auto &user : chats.list) { + chatIds.push_back(peerToTdbChat(user->id)); + } + auto excludedChatIds = QVector(); + if (!data.allButExcluded) { + excludedChatIds.reserve(data.excluded.list.size()); + for (const auto &user : data.excluded.list) { + excludedChatIds.push_back(peerToTdbChat(user->id)); + } + } + using Type = BusinessChatType; + return tl_businessRecipients( + tl_vector(chatIds), + tl_vector(excludedChatIds), + tl_bool(chats.types & Type::ExistingChats), + tl_bool(chats.types & Type::NewChats), + tl_bool(chats.types & Type::Contacts), + tl_bool(chats.types & Type::NonContacts), + tl_bool(data.allButExcluded)); +} + +BusinessRecipients FromTL( + not_null owner, + const TLbusinessRecipients &recipients) { + using Type = BusinessChatType; + + const auto &data = recipients.data(); + auto result = BusinessRecipients{ + .allButExcluded = data.vexclude_selected().v, + }; + + auto &chats = result.allButExcluded + ? result.excluded + : result.included; + chats.types = Type() + | (data.vselect_new_chats().v ? Type::NewChats : Type()) + | (data.vselect_existing_chats().v ? Type::ExistingChats : Type()) + | (data.vselect_contacts().v ? Type::Contacts : Type()) + | (data.vselect_non_contacts().v ? Type::NonContacts : Type()); + for (const auto chatId : data.vchat_ids().v) { + if (const auto userId = peerToUser(peerFromTdbChat(chatId))) { + chats.list.push_back(owner->user(userId)); + } + } + for (const auto chatId : data.vexcluded_chat_ids().v) { + if (const auto userId = peerToUser(peerFromTdbChat(chatId))) { + result.excluded.list.push_back(owner->user(userId)); + } + } + return result; +} + +BusinessDetails FromTL( + not_null owner, + const tl::conditional &info) { + if (!info) { + return {}; + } + auto result = BusinessDetails(); + const auto &data = info->data(); + if (const auto hours = data.vopening_hours()) { + const auto &data = hours->data(); + result.hours.timezoneId = data.vtime_zone_id().v; + result.hours.intervals.list = ranges::views::all( + data.vopening_hours().v + ) | ranges::views::transform([]( + const TLbusinessOpeningHoursInterval &open) { + const auto &data = open.data(); + return WorkingInterval{ + data.vstart_minute().v * 60, + data.vend_minute().v * 60, + }; + }) | ranges::to_vector; + } + if (const auto location = data.vlocation()) { + const auto &data = location->data(); + result.location.address = data.vaddress().v; + if (const auto point = data.vlocation()) { + result.location.point = LocationPoint(*point); + } + } + if (const auto intro = data.vintro()) { + const auto &data = intro->data(); + result.intro.title = data.vtitle().v; + result.intro.description = data.vmessage().v; + if (const auto document = data.vsticker()) { + result.intro.sticker = owner->processDocument(*document); + if (!result.intro.sticker->sticker()) { + result.intro.sticker = nullptr; + } + } + } + return result; +} + +AwaySettings FromTL( + not_null owner, + const tl::conditional &settings) { + if (!settings) { + return AwaySettings(); + } + const auto &data = settings->data(); + auto result = AwaySettings{ + .recipients = FromTL(owner, data.vrecipients()), + .shortcutId = data.vshortcut_id().v, + .offlineOnly = data.voffline_only().v, + }; + data.vschedule().match([&]( + const TLDbusinessAwayMessageScheduleAlways &) { + result.schedule.type = AwayScheduleType::Always; + }, [&](const TLDbusinessAwayMessageScheduleOutsideOfOpeningHours &) { + result.schedule.type = AwayScheduleType::OutsideWorkingHours; + }, [&](const TLDbusinessAwayMessageScheduleCustom &data) { + result.schedule.type = AwayScheduleType::Custom; + result.schedule.customInterval = WorkingInterval{ + data.vstart_date().v, + data.vend_date().v, + }; + }); + return result; +} + +[[nodiscard]] GreetingSettings FromTL( + not_null owner, + const tl::conditional &settings) { + if (!settings) { + return GreetingSettings(); + } + const auto &data = settings->data(); + return GreetingSettings{ + .recipients = FromTL(owner, data.vrecipients()), + .noActivityDays = data.vinactivity_days().v, + .shortcutId = data.vshortcut_id().v, + }; +} WorkingIntervals WorkingIntervals::normalized() const { return SortAndMerge(MoveTailToFront(SortAndMerge(*this))); diff --git a/Telegram/SourceFiles/data/business/data_business_common.h b/Telegram/SourceFiles/data/business/data_business_common.h index 600d5ff79d81f8..d8540bd6539ace 100644 --- a/Telegram/SourceFiles/data/business/data_business_common.h +++ b/Telegram/SourceFiles/data/business/data_business_common.h @@ -10,6 +10,13 @@ For license and copyright information please follow this link: #include "base/flags.h" #include "data/data_location.h" +namespace Tdb { +class TLbusinessInfo; +class TLbusinessRecipients; +class TLbusinessAwayMessageSettings; +class TLbusinessGreetingMessageSettings; +} // namespace Tdb + class UserData; namespace Data { @@ -57,6 +64,7 @@ enum class BusinessRecipientsType : uchar { Bots, }; +#if 0 // mtp [[nodiscard]] MTPInputBusinessRecipients ForMessagesToMTP( const BusinessRecipients &data); [[nodiscard]] MTPInputBusinessBotRecipients ForBotsToMTP( @@ -67,6 +75,15 @@ enum class BusinessRecipientsType : uchar { [[nodiscard]] BusinessRecipients FromMTP( not_null owner, const MTPBusinessBotRecipients &recipients); +#endif + +[[nodiscard]] Tdb::TLbusinessRecipients ForMessagesToTL( + const BusinessRecipients &data); +[[nodiscard]] Tdb::TLbusinessRecipients ForBotsToTL( + const BusinessRecipients &data); +[[nodiscard]] BusinessRecipients FromTL( + not_null owner, + const Tdb::TLbusinessRecipients &recipients); struct Timezone { QString id; @@ -217,11 +234,17 @@ struct BusinessDetails { const BusinessDetails &b) = default; }; +#if 0 // mtp [[nodiscard]] BusinessDetails FromMTP( not_null owner, const tl::conditional &hours, const tl::conditional &location, const tl::conditional &intro); +#endif + +[[nodiscard]] BusinessDetails FromTL( + not_null owner, + const tl::conditional &info); enum class AwayScheduleType : uchar { Never = 0, @@ -254,9 +277,15 @@ struct AwaySettings { const AwaySettings &b) = default; }; +#if 0 // mtp [[nodiscard]] AwaySettings FromMTP( not_null owner, const tl::conditional &message); +#endif + +[[nodiscard]] AwaySettings FromTL( + not_null owner, + const tl::conditional &settings); struct GreetingSettings { BusinessRecipients recipients; @@ -272,8 +301,14 @@ struct GreetingSettings { const GreetingSettings &b) = default; }; +#if 0 // mtp [[nodiscard]] GreetingSettings FromMTP( not_null owner, const tl::conditional &message); +#endif + +[[nodiscard]] GreetingSettings FromTL( + not_null owner, + const tl::conditional &settings); } // namespace Data diff --git a/Telegram/SourceFiles/data/business/data_business_info.cpp b/Telegram/SourceFiles/data/business/data_business_info.cpp index e158c7a3a8e9b2..ae1cb51e41c6ef 100644 --- a/Telegram/SourceFiles/data/business/data_business_info.cpp +++ b/Telegram/SourceFiles/data/business/data_business_info.cpp @@ -15,9 +15,15 @@ For license and copyright information please follow this link: #include "data/data_user.h" #include "main/main_session.h" +#include "tdb/tdb_sender.h" +#include "tdb/tdb_tl_scheme.h" + namespace Data { namespace { +using namespace Tdb; + +#if 0 // mtp [[nodiscard]] MTPBusinessWorkHours ToMTP(const WorkingHours &data) { const auto list = data.intervals.normalized().list; const auto proj = [](const WorkingInterval &data) { @@ -60,6 +66,47 @@ namespace { ForMessagesToMTP(data.recipients), MTP_int(data.noActivityDays)); } +#endif + +[[nodiscard]] std::optional ToTL( + const WorkingHours &data) { + if (!data) { + return {}; + } + const auto list = data.intervals.normalized().list; + const auto proj = [](const WorkingInterval &data) { + return MTPBusinessWeeklyOpen(MTP_businessWeeklyOpen( + MTP_int(data.start / 60), + MTP_int(data.end / 60))); + }; + auto intervals = QVector(); + intervals.reserve(list.size()); + for (const auto &interval : list) { + intervals.push_back(tl_businessOpeningHoursInterval( + tl_int32(interval.start / 60), + tl_int32(interval.end / 60))); + } + return tl_businessOpeningHours( + tl_string(data.timezoneId), + tl_vector(intervals)); +} + +[[nodiscard]] MTPInputBusinessAwayMessage ToMTP(const AwaySettings &data) { + using Flag = MTPDinputBusinessAwayMessage::Flag; + return MTP_inputBusinessAwayMessage( + MTP_flags(data.offlineOnly ? Flag::f_offline_only : Flag()), + MTP_int(data.shortcutId), + ToMTP(data.schedule), + ForMessagesToMTP(data.recipients)); +} + +[[nodiscard]] MTPInputBusinessGreetingMessage ToMTP( + const GreetingSettings &data) { + return MTP_inputBusinessGreetingMessage( + MTP_int(data.shortcutId), + ForMessagesToMTP(data.recipients), + MTP_int(data.noActivityDays)); +} } // namespace @@ -79,16 +126,24 @@ void BusinessInfo::saveWorkingHours( return; } +#if 0 // mtp using Flag = MTPaccount_UpdateBusinessWorkHours::Flag; session->api().request(MTPaccount_UpdateBusinessWorkHours( MTP_flags(data ? Flag::f_business_work_hours : Flag()), ToMTP(data) )).fail([=](const MTP::Error &error) { +#endif + session->sender().request(TLsetBusinessOpeningHours( + ToTL(data) + )).fail([=](const Error &error) { auto details = session->user()->businessDetails(); details.hours = was; session->user()->setBusinessDetails(std::move(details)); if (fail) { +#if 0 // mtp fail(error.type()); +#endif + fail(error.message); } }).send(); @@ -104,6 +159,7 @@ void BusinessInfo::saveChatIntro(ChatIntro data, Fn fail) { return; } else { const auto session = &_owner->session(); +#if 0 // mtp using Flag = MTPaccount_UpdateBusinessIntro::Flag; session->api().request(MTPaccount_UpdateBusinessIntro( MTP_flags(data ? Flag::f_intro : Flag()), @@ -117,11 +173,24 @@ void BusinessInfo::saveChatIntro(ChatIntro data, Fn fail) { ? data.sticker->mtpInput() : MTP_inputDocumentEmpty())) )).fail([=](const MTP::Error &error) { +#endif + session->sender().request(TLsetBusinessIntro(data + ? tl_inputBusinessIntro( + tl_string(data.title), + tl_string(data.description), + (data.sticker + ? tl_inputFileId(tl_int32(data.sticker->tdbFileId())) + : std::optional())) + : std::optional() + )).fail([=](const Error &error) { auto details = session->user()->businessDetails(); details.intro = was; session->user()->setBusinessDetails(std::move(details)); if (fail) { +#if 0 // mtp fail(error.type()); +#endif + fail(error.message); } }).send(); } @@ -145,16 +214,24 @@ void BusinessInfo::saveAwaySettings( if (was == data) { return; } else if (!data || data.shortcutId) { +#if 0 // mtp using Flag = MTPaccount_UpdateBusinessAwayMessage::Flag; const auto session = &_owner->session(); session->api().request(MTPaccount_UpdateBusinessAwayMessage( MTP_flags(data ? Flag::f_message : Flag()), data ? ToMTP(data) : MTPInputBusinessAwayMessage() )).fail([=](const MTP::Error &error) { +#endif + _owner->session().sender().request(TLsetBusinessAwayMessageSettings( + ToTL(data) + )).fail([=](const Error &error) { _awaySettings = was; _awaySettingsChanged.fire({}); if (fail) { +#if 0 // mtp fail(error.type()); +#endif + fail(error.message); } }).send(); } diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 22d05d5f80ad4c..94892d5ca9e9cd 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -2660,6 +2660,7 @@ TextForMimeData MediaGiveawayResults::clipboardText() const { return TextForMimeData(); } +#if 0 // mtp bool MediaGiveawayResults::updateInlineResultMedia(const MTPMessageMedia &media) { return true; } @@ -2667,6 +2668,7 @@ bool MediaGiveawayResults::updateInlineResultMedia(const MTPMessageMedia &media) bool MediaGiveawayResults::updateSentMedia(const MTPMessageMedia &media) { return true; } +#endif std::unique_ptr MediaGiveawayResults::createView( not_null message, diff --git a/Telegram/SourceFiles/data/data_media_types.h b/Telegram/SourceFiles/data/data_media_types.h index 7867b679fcae57..cbbfb00f3d6808 100644 --- a/Telegram/SourceFiles/data/data_media_types.h +++ b/Telegram/SourceFiles/data/data_media_types.h @@ -803,8 +803,10 @@ class MediaGiveawayResults final : public Media { QString pinnedTextSubstring() const override; TextForMimeData clipboardText() const override; +#if 0 // mtp bool updateInlineResultMedia(const MTPMessageMedia &media) override; bool updateSentMedia(const MTPMessageMedia &media) override; +#endif std::unique_ptr createView( not_null message, not_null realParent, diff --git a/Telegram/SourceFiles/data/data_user.cpp b/Telegram/SourceFiles/data/data_user.cpp index 57d457ba9f4bcf..c3cadb2e7b5443 100644 --- a/Telegram/SourceFiles/data/data_user.cpp +++ b/Telegram/SourceFiles/data/data_user.cpp @@ -612,15 +612,21 @@ void UserData::setBirthday(Data::Birthday value) { } } +#if 0 // mtp void UserData::setBirthday(const tl::conditional &value) { - if (!value) { +#endif +void UserData::setBirthday(const tl::conditional &value) { + if (!value) { setBirthday(Data::Birthday()); } else { const auto &data = value->data(); setBirthday(Data::Birthday( data.vday().v, data.vmonth().v, + data.vyear().v)); +#if 0 // mtp data.vyear().value_or_empty())); +#endif } } diff --git a/Telegram/SourceFiles/data/data_user.h b/Telegram/SourceFiles/data/data_user.h index 12db293aa99530..4340340dc7d3d2 100644 --- a/Telegram/SourceFiles/data/data_user.h +++ b/Telegram/SourceFiles/data/data_user.h @@ -204,7 +204,10 @@ class UserData final : public PeerData { [[nodiscard]] Data::Birthday birthday() const; void setBirthday(Data::Birthday value); +#if 0 // mtp void setBirthday(const tl::conditional &value); +#endif + void setBirthday(const tl::conditional &value); void setUnavailableReasons( std::vector &&reasons); diff --git a/Telegram/SourceFiles/tdb/details/tdb_instance.cpp b/Telegram/SourceFiles/tdb/details/tdb_instance.cpp index 7404ed9b983ee2..0cb7f5f779b50e 100644 --- a/Telegram/SourceFiles/tdb/details/tdb_instance.cpp +++ b/Telegram/SourceFiles/tdb/details/tdb_instance.cpp @@ -949,9 +949,7 @@ void Instance::Client::sendTdlibParameters() { tl_string(_config.systemLanguageCode), tl_string(_config.deviceModel), tl_string(_config.systemVersion), - tl_string(_config.applicationVersion), - tl_bool(true), // enable_storage_optimizer - tl_bool(false)), // ignore_file_names + tl_string(_config.applicationVersion)), nullptr, fail, true);