Update API scheme to layer 160.

This commit is contained in:
John Preston 2023-05-01 10:44:57 +04:00
parent 918af601cf
commit 429a3da3e5
11 changed files with 83 additions and 21 deletions

View File

@ -961,6 +961,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_edit_privacy_everyone" = "Everybody";
"lng_edit_privacy_contacts" = "My contacts";
"lng_edit_privacy_close_friends" = "Close friends";
"lng_edit_privacy_nobody" = "Nobody";
"lng_edit_privacy_exceptions" = "Add exceptions";

View File

@ -110,7 +110,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
storage.fileWebp#1081464c = storage.FileType;
userEmpty#d3bc4b7a id:long = User;
user#8f97c628 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 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> = User;
user#8f97c628 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_available:flags2.3?true stories_unavailable:flags2.4?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> = 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;
@ -150,7 +150,7 @@ messageMediaPhoto#695150d7 flags:# spoiler:flags.3?true photo:flags.0?Photo ttl_
messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
messageMediaContact#70322949 phone_number:string first_name:string last_name:string vcard:string user_id:long = MessageMedia;
messageMediaUnsupported#9f84f49e = MessageMedia;
messageMediaDocument#9cb070d7 flags:# nopremium:flags.3?true spoiler:flags.4?true document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia;
messageMediaDocument#4cf4d72d flags:# nopremium:flags.3?true spoiler:flags.4?true document:flags.0?Document alt_document:flags.5?Document ttl_seconds:flags.2?int = MessageMedia;
messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
messageMediaGame#fdb19008 game:Game = MessageMedia;
@ -249,7 +249,7 @@ inputReportReasonFake#f5ddd6e7 = ReportReason;
inputReportReasonIllegalDrugs#a8eb2be = ReportReason;
inputReportReasonPersonalDetails#9ec7863d = ReportReason;
userFull#93eadb53 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper = UserFull;
userFull#4fe1cc86 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper stories:flags.25?UserStories = UserFull;
contact#145ade0b user_id:long mutual:Bool = Contact;
@ -410,6 +410,8 @@ updateChannelPinnedTopics#fe198602 flags:# channel_id:long order:flags.0?Vector<
updateUser#20529438 user_id:long = Update;
updateAutoSaveSettings#ec05b097 = Update;
updateGroupInvitePrivacyForbidden#ccf08ad6 user_id:long = Update;
updateStories#66fad7b5 stories:UserStories = Update;
updateReadStories#feb5345a user_id:long max_id:int = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -535,6 +537,7 @@ inputPrivacyValueDisallowAll#d66b66c9 = InputPrivacyRule;
inputPrivacyValueDisallowUsers#90110467 users:Vector<InputUser> = InputPrivacyRule;
inputPrivacyValueAllowChatParticipants#840649cf chats:Vector<long> = InputPrivacyRule;
inputPrivacyValueDisallowChatParticipants#e94f0f86 chats:Vector<long> = InputPrivacyRule;
inputPrivacyValueAllowCloseFriends#2f453e49 = InputPrivacyRule;
privacyValueAllowContacts#fffe1bac = PrivacyRule;
privacyValueAllowAll#65427b82 = PrivacyRule;
@ -544,6 +547,7 @@ privacyValueDisallowAll#8b73e763 = PrivacyRule;
privacyValueDisallowUsers#e4621141 users:Vector<long> = PrivacyRule;
privacyValueAllowChatParticipants#6b134e8e chats:Vector<long> = PrivacyRule;
privacyValueDisallowChatParticipants#41c87565 chats:Vector<long> = PrivacyRule;
privacyValueAllowCloseFriends#f7e8d89b = PrivacyRule;
account.privacyRules#50a04e45 rules:Vector<PrivacyRule> chats:Vector<Chat> users:Vector<User> = account.PrivacyRules;
@ -552,7 +556,7 @@ accountDaysTTL#b8d0afdf days:int = AccountDaysTTL;
documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute;
documentAttributeAnimated#11b58939 = DocumentAttribute;
documentAttributeSticker#6319d612 flags:# mask:flags.1?true alt:string stickerset:InputStickerSet mask_coords:flags.0?MaskCoords = DocumentAttribute;
documentAttributeVideo#ef02ce6 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int = DocumentAttribute;
documentAttributeVideo#e9407793 flags:# round_message:flags.0?true supports_streaming:flags.1?true duration:int w:int h:int preload_prefix_size:flags.2?int = DocumentAttribute;
documentAttributeAudio#9852f9c6 flags:# voice:flags.10?true duration:int title:flags.0?string performer:flags.1?string waveform:flags.2?bytes = DocumentAttribute;
documentAttributeFilename#15590068 file_name:string = DocumentAttribute;
documentAttributeHasStickers#9801d2f7 = DocumentAttribute;
@ -1547,6 +1551,25 @@ messagePeerVoteMultiple#4628f6e6 peer:Peer options:Vector<bytes> date:int = Mess
sponsoredWebPage#3db8ec63 flags:# url:string site_name:string photo:flags.0?Photo = SponsoredWebPage;
storyViews#518b47d8 recent_viewers:Vector<long> views_count:int = StoryViews;
storyItemDeleted#51e6ee4f id:int = StoryItem;
storyItemSkipped#a1d8cf8f id:int date:int = StoryItem;
storyItem#8fcd96ac flags:# pinned:flags.5?true expired:flags.6?true id:int date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews = StoryItem;
userStories#8611a200 flags:# user_id:long max_read_id:flags.0?int stories:Vector<StoryItem> = UserStories;
stories.allStoriesNotModified#47e0a07e state:string = stories.AllStories;
stories.allStories#5b1aa68c flags:# has_more:flags.0?true state:string user_stories:Vector<UserStories> users:Vector<User> = stories.AllStories;
stories.stories#4fe57df1 count:int stories:Vector<StoryItem> users:Vector<User> = stories.Stories;
storyView#a71aacc2 user_id:long date:int = StoryView;
stories.storyViewsList#fb3f77ac count:int views:Vector<StoryView> users:Vector<User> = stories.StoryViewsList;
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -1696,6 +1719,7 @@ contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_hi
contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer;
contacts.exportContactToken#f8654027 = ExportedContactToken;
contacts.importContactToken#13005788 token:string = User;
contacts.editCloseFriends#ba6705f0 id:Vector<long> = Bool;
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs;
@ -2080,4 +2104,16 @@ chatlists.hideChatlistUpdates#66e486fb chatlist:InputChatlist = Bool;
chatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector<Peer>;
chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer> = Updates;
// LAYER 159
stories.sendStory#8e826f5d flags:# pinned:flags.2?true media:InputMedia caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> = Updates;
stories.deleteStories#b5d501d7 id:Vector<int> = Vector<int>;
stories.editStoryPrivacy#78981875 id:int privacy_rules:Vector<InputPrivacyRule> = Updates;
stories.togglePinned#51602944 id:Vector<int> pinned:Bool = Vector<int>;
stories.getAllStories#eeb0d625 flags:# next:flags.1?true state:flags.0?string = stories.AllStories;
stories.getUserStories#c946f3c0 flags:# pinned:flags.0?true user_id:InputUser offset_id:int limit:int = stories.Stories;
stories.getStoriesByID#6a15cf46 user_id:InputUser id:Vector<int> = stories.Stories;
stories.getExpiredStories#8f792f2 offset_id:int limit:int = stories.Stories;
stories.readStories#edc5105b user_id:InputUser max_id:int = Vector<int>;
stories.getStoryViewsList#4b3b5e97 id:int offset_date:int offset_id:long limit:int = stories.StoryViewsList;
stories.getStoriesViews#9a75d6a6 id:Vector<int> = stories.StoryViews;
// LAYER 160

View File

@ -36,7 +36,8 @@ MTPVector<MTPDocumentAttribute> ComposeSendingDocumentAttributes(
MTP_flags(flags),
MTP_int(duration),
MTP_int(dimensions.width()),
MTP_int(dimensions.height())));
MTP_int(dimensions.height()),
MTPint())); // preload_prefix_size
} else {
attributes.push_back(MTP_documentAttributeImageSize(
MTP_int(dimensions.width()),

View File

@ -453,11 +453,13 @@ void SendConfirmedFile(
MTP_flags(Flag::f_document
| (file->spoiler ? Flag::f_spoiler : Flag())),
file->document,
MTPDocument(), // alt_document
MTPint());
} else if (file->type == SendMediaType::Audio) {
return MTP_messageMediaDocument(
MTP_flags(MTPDmessageMediaDocument::Flag::f_document),
file->document,
MTPDocument(), // alt_document
MTPint());
} else {
Unexpected("Type in sendFilesConfirmed.");

View File

@ -82,6 +82,8 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
switch (rule.option) {
case Option::Everyone: return MTP_inputPrivacyValueAllowAll();
case Option::Contacts: return MTP_inputPrivacyValueAllowContacts();
case Option::CloseFriends:
return MTP_inputPrivacyValueAllowCloseFriends();
case Option::Nobody: return MTP_inputPrivacyValueDisallowAll();
}
Unexpected("Option value in Api::UserPrivacy::RulesToTL.");
@ -110,6 +112,8 @@ UserPrivacy::Rule TLToRules(const TLRules &rules, Data::Session &owner) {
setOption(Option::Everyone);
}, [&](const MTPDprivacyValueAllowContacts &) {
setOption(Option::Contacts);
}, [&](const MTPDprivacyValueAllowCloseFriends &) {
setOption(Option::CloseFriends);
}, [&](const MTPDprivacyValueAllowUsers &data) {
const auto &users = data.vusers().v;
always.reserve(always.size() + users.size());

View File

@ -34,6 +34,7 @@ public:
enum class Option {
Everyone,
Contacts,
CloseFriends,
Nobody,
};
struct Rule {

View File

@ -116,6 +116,8 @@ QString EditPrivacyController::optionLabel(Option option) const {
switch (option) {
case Option::Everyone: return tr::lng_edit_privacy_everyone(tr::now);
case Option::Contacts: return tr::lng_edit_privacy_contacts(tr::now);
case Option::CloseFriends:
return tr::lng_edit_privacy_close_friends(tr::now);
case Option::Nobody: return tr::lng_edit_privacy_nobody(tr::now);
}
Unexpected("Option value in optionsLabelKey.");
@ -182,10 +184,12 @@ bool EditPrivacyBox::showExceptionLink(Exception exception) const {
switch (exception) {
case Exception::Always:
return (_value.option == Option::Contacts)
|| (_value.option == Option::CloseFriends)
|| (_value.option == Option::Nobody);
case Exception::Never:
return (_value.option == Option::Everyone)
|| (_value.option == Option::Contacts);
|| (_value.option == Option::Contacts)
|| (_value.option == Option::CloseFriends);
}
Unexpected("Invalid exception value.");
}
@ -326,6 +330,7 @@ void EditPrivacyBox::setupContent() {
{ 0, st::settingsPrivacySkipTop, 0, 0 });
addOptionRow(Option::Everyone);
addOptionRow(Option::Contacts);
addOptionRow(Option::CloseFriends);
addOptionRow(Option::Nobody);
const auto warning = addLabelOrDivider(
content,

View File

@ -252,6 +252,7 @@ struct ForwardedTooltip {
case Option::Everyone:
return tr::lng_edit_privacy_forwards_sample_everyone(tr::now);
case Option::Contacts:
case Option::CloseFriends:
return tr::lng_edit_privacy_forwards_sample_contacts(tr::now);
case Option::Nobody:
return tr::lng_edit_privacy_forwards_sample_nobody(tr::now);
@ -783,15 +784,14 @@ rpl::producer<QString> CallsPeer2PeerPrivacyController::optionsTitleKey() const
QString CallsPeer2PeerPrivacyController::optionLabel(
EditPrivacyBox::Option option) const {
switch (option) {
case Option::Everyone: {
case Option::Everyone:
return tr::lng_edit_privacy_calls_p2p_everyone(tr::now);
};
case Option::Contacts: {
case Option::Contacts:
return tr::lng_edit_privacy_calls_p2p_contacts(tr::now);
};
case Option::Nobody: {
case Option::CloseFriends:
return tr::lng_edit_privacy_close_friends(tr::now); // unused
case Option::Nobody:
return tr::lng_edit_privacy_calls_p2p_nobody(tr::now);
};
}
Unexpected("Option value in optionsLabelKey.");
}
@ -1215,15 +1215,13 @@ auto ProfilePhotoPrivacyController::exceptionsDescription() const
return _option.value(
) | rpl::map([](Option option) {
switch (option) {
case Option::Everyone: {
case Option::Everyone:
return tr::lng_edit_privacy_forwards_exceptions_everyone();
};
case Option::Contacts: {
case Option::Contacts:
case Option::CloseFriends:
return tr::lng_edit_privacy_forwards_exceptions();
};
case Option::Nobody: {
case Option::Nobody:
return tr::lng_edit_privacy_forwards_exceptions_nobody();
};
}
Unexpected("Option value in exceptionsDescription.");
}) | rpl::flatten_latest();

View File

@ -80,6 +80,8 @@ QString PrivacyBase(Privacy::Key key, Privacy::Option option) {
return tr::lng_edit_privacy_calls_p2p_everyone(tr::now);
case Option::Contacts:
return tr::lng_edit_privacy_calls_p2p_contacts(tr::now);
case Option::CloseFriends:
return tr::lng_edit_privacy_close_friends(tr::now); // unused
case Option::Nobody:
return tr::lng_edit_privacy_calls_p2p_nobody(tr::now);
}
@ -88,6 +90,8 @@ QString PrivacyBase(Privacy::Key key, Privacy::Option option) {
switch (option) {
case Option::Everyone: return tr::lng_edit_privacy_everyone(tr::now);
case Option::Contacts: return tr::lng_edit_privacy_contacts(tr::now);
case Option::CloseFriends:
return tr::lng_edit_privacy_close_friends(tr::now);
case Option::Nobody: return tr::lng_edit_privacy_nobody(tr::now);
}
Unexpected("Value in Privacy::Option.");

View File

@ -918,7 +918,12 @@ void FileLoadTask::process(Args &&args) {
if (video->supportsStreaming) {
flags |= MTPDdocumentAttributeVideo::Flag::f_supports_streaming;
}
attributes.push_back(MTP_documentAttributeVideo(MTP_flags(flags), MTP_int(video->duration), MTP_int(coverWidth), MTP_int(coverHeight)));
attributes.push_back(MTP_documentAttributeVideo(
MTP_flags(flags),
MTP_int(video->duration),
MTP_int(coverWidth),
MTP_int(coverHeight),
MTPint())); // preload_prefix_size
if (args.generateGoodThumbnail) {
goodThumbnail = video->thumbnail;

View File

@ -192,7 +192,12 @@ DocumentData *Document::readFromStreamHelper(
if (type == RoundVideoDocument) {
flags |= MTPDdocumentAttributeVideo::Flag::f_round_message;
}
attributes.push_back(MTP_documentAttributeVideo(MTP_flags(flags), MTP_int(duration), MTP_int(width), MTP_int(height)));
attributes.push_back(MTP_documentAttributeVideo(
MTP_flags(flags),
MTP_int(duration),
MTP_int(width),
MTP_int(height),
MTPint())); // preload_prefix_size
} else {
attributes.push_back(MTP_documentAttributeImageSize(MTP_int(width), MTP_int(height)));
}