Init True fields for some manually created telegram_api objects.

This commit is contained in:
levlam 2023-06-23 17:53:38 +03:00
parent c3c8af9104
commit a87a41f22d
6 changed files with 14 additions and 10 deletions

View File

@ -64,7 +64,7 @@ class GetAutoDownloadSettingsQuery final : public Td::ResultHandler {
}
};
telegram_api::object_ptr<telegram_api::autoDownloadSettings> get_input_auto_download_settings(
static telegram_api::object_ptr<telegram_api::autoDownloadSettings> get_input_auto_download_settings(
const AutoDownloadSettings &settings) {
int32 flags = 0;
if (!settings.is_enabled) {

View File

@ -468,8 +468,8 @@ telegram_api::object_ptr<telegram_api::wallPaperSettings> BackgroundType::get_in
flags |= telegram_api::wallPaperSettings::INTENSITY_MASK;
}
return telegram_api::make_object<telegram_api::wallPaperSettings>(
flags, false /*ignored*/, false /*ignored*/, fill_.top_color_, fill_.bottom_color_, fill_.third_color_,
fill_.fourth_color_, intensity_, fill_.rotation_angle_);
flags, is_blurred_, is_moving_, fill_.top_color_, fill_.bottom_color_, fill_.third_color_, fill_.fourth_color_,
intensity_, fill_.rotation_angle_);
}
} // namespace td

View File

@ -92,7 +92,7 @@ telegram_api::object_ptr<telegram_api::ChatReactions> ChatReactions::get_input_c
if (allow_custom_) {
flags |= telegram_api::chatReactionsAll::ALLOW_CUSTOM_MASK;
}
return telegram_api::make_object<telegram_api::chatReactionsAll>(flags, false /*ignored*/);
return telegram_api::make_object<telegram_api::chatReactionsAll>(flags, allow_custom_);
}
if (!reactions_.empty()) {
return telegram_api::make_object<telegram_api::chatReactionsSome>(transform(reactions_, get_input_reaction));

View File

@ -10206,9 +10206,12 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
LOG(ERROR) << "Receive invalid " << user_id;
return;
}
int32 flags = user->flags_;
int32 flags2 = user->flags2_;
LOG(INFO) << "Receive " << user_id << " with flags " << flags << ' ' << flags2 << " from " << source;
// the boolean fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
if (is_me && (flags & USER_FLAG_IS_ME) == 0) {
LOG(ERROR) << user_id << " doesn't have flag IS_ME, but must have it when received from " << source;
flags |= USER_FLAG_IS_ME;
@ -10708,8 +10711,8 @@ ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
telegram_api::object_ptr<telegram_api::userProfilePhoto> profile_photo;
if (!G()->is_test_dc() && profile_photo_id != 0) {
profile_photo = telegram_api::make_object<telegram_api::userProfilePhoto>(
0, false /*ignored*/, false /*ignored*/, profile_photo_id, BufferSlice(), profile_photo_dc_id);
profile_photo = telegram_api::make_object<telegram_api::userProfilePhoto>(0, false, false, profile_photo_id,
BufferSlice(), profile_photo_dc_id);
}
auto user = telegram_api::make_object<telegram_api::user>(

View File

@ -1166,6 +1166,7 @@ class ContactsManager final : public Actor {
static constexpr int32 CHANNEL_PARTICIPANT_CACHE_TIME = 1800; // some reasonable limit
// the boolean fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
static constexpr int32 USER_FLAG_HAS_ACCESS_HASH = 1 << 0;
static constexpr int32 USER_FLAG_HAS_FIRST_NAME = 1 << 1;
static constexpr int32 USER_FLAG_HAS_LAST_NAME = 1 << 2;

View File

@ -882,7 +882,7 @@ static tl_object_ptr<telegram_api::KeyboardButton> get_input_keyboard_button(
case InlineKeyboardButton::Type::Url:
return make_tl_object<telegram_api::keyboardButtonUrl>(keyboard_button.text, keyboard_button.data);
case InlineKeyboardButton::Type::Callback:
return make_tl_object<telegram_api::keyboardButtonCallback>(0, false /*ignored*/, keyboard_button.text,
return make_tl_object<telegram_api::keyboardButtonCallback>(0, false, keyboard_button.text,
BufferSlice(keyboard_button.data));
case InlineKeyboardButton::Type::CallbackGame:
return make_tl_object<telegram_api::keyboardButtonGame>(keyboard_button.text);
@ -906,13 +906,13 @@ static tl_object_ptr<telegram_api::KeyboardButton> get_input_keyboard_button(
peer_types.push_back(telegram_api::make_object<telegram_api::inlineQueryPeerTypeBroadcast>());
}
}
return make_tl_object<telegram_api::keyboardButtonSwitchInline>(flags, false /*ignored*/, keyboard_button.text,
return make_tl_object<telegram_api::keyboardButtonSwitchInline>(flags, false, keyboard_button.text,
keyboard_button.data, std::move(peer_types));
}
case InlineKeyboardButton::Type::SwitchInlineCurrentDialog:
return make_tl_object<telegram_api::keyboardButtonSwitchInline>(
telegram_api::keyboardButtonSwitchInline::SAME_PEER_MASK, false /*ignored*/, keyboard_button.text,
keyboard_button.data, vector<telegram_api::object_ptr<telegram_api::InlineQueryPeerType>>());
telegram_api::keyboardButtonSwitchInline::SAME_PEER_MASK, true, keyboard_button.text, keyboard_button.data,
vector<telegram_api::object_ptr<telegram_api::InlineQueryPeerType>>());
case InlineKeyboardButton::Type::Buy:
return make_tl_object<telegram_api::keyboardButtonBuy>(keyboard_button.text);
case InlineKeyboardButton::Type::UrlAuth: {