Update API scheme on layer 167.

This commit is contained in:
John Preston 2023-11-22 12:16:39 +04:00
parent 6a87fef851
commit 4b5e2582d9
7 changed files with 48 additions and 36 deletions

View file

@ -64,8 +64,8 @@ PeerId GenerateUser(not_null<History*> history, const QString &name) {
MTPEmojiStatus(),
MTPVector<MTPUsername>(),
MTPint(), // stories_max_id
MTP_int(0), // color
MTPlong())); // background_emoji_id
MTPPeerColor(), // color
MTPPeerColor())); // profile_color
return peerId;
}

View file

@ -669,6 +669,17 @@ bool PeerData::changeBackgroundEmojiId(
: DocumentId());
}
bool PeerData::changeColor(
const tl::conditional<MTPPeerColor> &cloudColor) {
const auto changed1 = cloudColor
? changeColorIndex(cloudColor->data().vcolor().v)
: clearColorIndex();
const auto changed2 = changeBackgroundEmojiId(cloudColor
? cloudColor->data().vbackground_emoji_id().v
: DocumentId());
return changed1 || changed2;
}
void PeerData::fillNames() {
_nameWords.clear();
_nameFirstLetters.clear();

View file

@ -370,6 +370,7 @@ public:
bool changeColorIndex(const tl::conditional<MTPint> &cloudColorIndex);
bool changeBackgroundEmojiId(
const tl::conditional<MTPlong> &cloudBackgroundEmoji);
bool changeColor(const tl::conditional<MTPPeerColor> &cloudColor);
enum class BlockStatus : char {
Unknown,

View file

@ -706,17 +706,11 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
flags |= UpdateFlag::CanShareContact;
}
auto decorationsUpdated = false;
if (result->changeColorIndex(data.vcolor())) {
if (result->changeColor(data.vcolor())) {
flags |= UpdateFlag::Color;
decorationsUpdated = true;
}
if (result->changeBackgroundEmojiId(data.vbackground_emoji_id())) {
flags |= UpdateFlag::BackgroundEmoji;
decorationsUpdated = true;
}
if (decorationsUpdated && result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
if (result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
}
}
});
@ -992,17 +986,11 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
if (wasCallNotEmpty != Data::ChannelHasActiveCall(channel)) {
flags |= UpdateFlag::GroupCall;
}
auto decorationsUpdated = false;
if (result->changeColorIndex(data.vcolor())) {
if (result->changeColor(data.vcolor())) {
flags |= UpdateFlag::Color;
decorationsUpdated = true;
}
if (result->changeBackgroundEmojiId(data.vbackground_emoji_id())) {
flags |= UpdateFlag::BackgroundEmoji;
decorationsUpdated = true;
}
if (decorationsUpdated && result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
if (result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
}
}
}, [&](const MTPDchannelForbidden &data) {
const auto channel = result->asChannel();
@ -4372,8 +4360,8 @@ void Session::serviceNotification(
MTPEmojiStatus(),
MTPVector<MTPUsername>(),
MTPint(), // stories_max_id
MTP_int(0), // color
MTPlong())); // background_emoji_id
MTPPeerColor(), // color
MTPPeerColor())); // profile_color
}
const auto history = this->history(PeerData::kServiceNotificationsId);
const auto insert = [=] {

View file

@ -766,8 +766,9 @@ ContactInfo ParseContactInfo(const MTPUser &data) {
auto result = ContactInfo();
data.match([&](const MTPDuser &data) {
result.userId = data.vid().v;
result.colorIndex = data.vcolor().value_or(
PeerColorIndex(result.userId));
result.colorIndex = data.vcolor()
? data.vcolor()->data().vcolor().v
: PeerColorIndex(result.userId);
if (const auto firstName = data.vfirst_name()) {
result.firstName = ParseString(*firstName);
}
@ -797,8 +798,9 @@ User ParseUser(const MTPUser &data) {
result.info = ParseContactInfo(data);
data.match([&](const MTPDuser &data) {
result.bareId = data.vid().v;
result.colorIndex = data.vcolor().value_or(
PeerColorIndex(result.bareId));
result.colorIndex = data.vcolor()
? data.vcolor()->data().vcolor().v
: PeerColorIndex(result.bareId);
if (const auto username = data.vusername()) {
result.username = ParseString(*username);
}
@ -853,8 +855,9 @@ Chat ParseChat(const MTPChat &data) {
result.input = MTP_inputPeerChat(MTP_long(result.bareId));
}, [&](const MTPDchannel &data) {
result.bareId = data.vid().v;
result.colorIndex = data.vcolor().value_or(
PeerColorIndex(result.bareId));
result.colorIndex = data.vcolor()
? data.vcolor()->data().vcolor().v
: PeerColorIndex(result.bareId);
result.isBroadcast = data.is_broadcast();
result.isSupergroup = data.is_megagroup();
result.title = ParseString(data.vtitle());

View file

@ -173,8 +173,8 @@ void Account::createSession(
MTPEmojiStatus(),
MTPVector<MTPUsername>(),
MTPint(), // stories_max_id
MTP_int(0), // color
MTPlong()), // background_emoji_id
MTPPeerColor(), // color
MTPPeerColor()), // profile_color
serialized,
streamVersion,
std::move(settings));

View file

@ -82,7 +82,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
storage.fileWebp#1081464c = storage.FileType;
userEmpty#d3bc4b7a id:long = User;
user#eb602f25 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 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.7?int background_emoji_id:flags2.6?long = User;
user#215c4438 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 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 = 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;
@ -97,7 +97,7 @@ userStatusLastMonth#77ebc742 = 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#1981ea7e 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 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.6?int background_emoji_id:flags2.5?long = Chat;
channel#8e87ccd8 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 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 = 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#c9d31138 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 = ChatFull;
@ -1419,7 +1419,7 @@ inputInvoicePremiumGiftCode#98986c0d purpose:InputStorePaymentPurpose option:Pre
payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice;
messages.transcribedAudio#93752c52 flags:# pending:flags.0?true transcription_id:long text:string = messages.TranscribedAudio;
messages.transcribedAudio#cfb9d957 flags:# pending:flags.0?true transcription_id:long text:string trial_remains_num:flags.1?int trial_remains_until_date:flags.1?int = messages.TranscribedAudio;
help.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> period_options:Vector<PremiumSubscriptionOption> users:Vector<User> = help.PremiumPromo;
@ -1604,6 +1604,13 @@ postInteractionCountersStory#8a480e27 story_id:int views:int forwards:int reacti
stats.storyStats#50cd067c views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.StoryStats;
peerColor#ba278146 color:int background_emoji_id:long = PeerColor;
help.peerColorOption#6a1b4441 flags:# hidden:flags.0?true color_id:int colors:flags.1?Vector<int> dark_colors:flags.2?Vector<int> = help.PeerColorOption;
help.peerColorsNotModified#2ba1f5ce = help.PeerColors;
help.peerColors#f8ed08 hash:int colors:Vector<help.PeerColorOption> = help.PeerColors;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -1725,7 +1732,7 @@ account.getAutoSaveSettings#adcbbcda = account.AutoSaveSettings;
account.saveAutoSaveSettings#d69b8361 flags:# users:flags.0?true chats:flags.1?true broadcasts:flags.2?true peer:flags.3?InputPeer settings:AutoSaveSettings = Bool;
account.deleteAutoSaveExceptions#53bc0020 = Bool;
account.invalidateSignInCodes#ca8ae8ba codes:Vector<string> = Bool;
account.updateColor#a001cc43 flags:# color:int background_emoji_id:flags.0?long = Bool;
account.updateColor#a001cc43 flags:# for_profile:flags.1?true color:int background_emoji_id:flags.0?long = Bool;
account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
@ -1989,6 +1996,8 @@ help.hidePromoData#1e251c95 peer:InputPeer = Bool;
help.dismissSuggestion#f50dbaa1 peer:InputPeer suggestion:string = Bool;
help.getCountriesList#735787a8 lang_code:string hash:int = help.CountriesList;
help.getPremiumPromo#b81b93d4 = help.PremiumPromo;
help.getPeerColors#da80f42f hash:int = help.PeerColors;
help.getPeerProfileColors#abcfa9fd hash:int = help.PeerColors;
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;