Add stickerSet.is_allowed_as_chat_emoji_status.

This commit is contained in:
levlam 2023-12-24 01:23:15 +03:00
parent 02159a2fce
commit 8090aac1c1
4 changed files with 33 additions and 11 deletions

View File

@ -3353,16 +3353,17 @@ emojis emojis:vector<string> = Emojis;
//@sticker_format Format of the stickers in the set
//@sticker_type Type of the stickers in the set
//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only
//@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only
//@is_viewed True for already viewed trending sticker sets
//@stickers List of stickers in this set
//@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object
stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector<closedVectorPath> is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool stickers:vector<sticker> emojis:vector<emojis> = StickerSet;
stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector<closedVectorPath> is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector<sticker> emojis:vector<emojis> = StickerSet;
//@description Represents short information about a sticker set
//@id Identifier of the sticker set
//@title Title of the sticker set
//@name Name of the sticker set
//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null
//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed
//@thumbnail_outline Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner
//@is_installed True, if the sticker set has been installed by the current user
//@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously
@ -3370,10 +3371,11 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli
//@sticker_format Format of the stickers in the set
//@sticker_type Type of the stickers in the set
//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only
//@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only
//@is_viewed True for already viewed trending sticker sets
//@size Total number of stickers in the set
//@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested
stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector<closedVectorPath> is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool size:int32 covers:vector<sticker> = StickerSetInfo;
stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector<closedVectorPath> is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector<sticker> = StickerSetInfo;
//@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets
stickerSets total_count:int32 sets:vector<stickerSetInfo> = StickerSets;

View File

@ -2504,7 +2504,8 @@ tl_object_ptr<td_api::stickerSet> StickersManager::get_sticker_set_object(Sticke
get_sticker_set_minithumbnail_zoom(sticker_set)),
sticker_set->is_installed_ && !sticker_set->is_archived_, sticker_set->is_archived_, sticker_set->is_official_,
get_sticker_format_object(sticker_set->sticker_format_), get_sticker_type_object(sticker_set->sticker_type_),
sticker_set->has_text_color_, sticker_set->is_viewed_, std::move(stickers), std::move(emojis));
sticker_set->has_text_color_, sticker_set->channel_emoji_status_, sticker_set->is_viewed_, std::move(stickers),
std::move(emojis));
}
tl_object_ptr<td_api::stickerSets> StickersManager::get_sticker_sets_object(int32 total_count,
@ -2580,7 +2581,7 @@ tl_object_ptr<td_api::stickerSetInfo> StickersManager::get_sticker_set_info_obje
get_sticker_set_minithumbnail_zoom(sticker_set)),
sticker_set->is_installed_ && !sticker_set->is_archived_, sticker_set->is_archived_, sticker_set->is_official_,
get_sticker_format_object(sticker_set->sticker_format_), get_sticker_type_object(sticker_set->sticker_type_),
sticker_set->has_text_color_, sticker_set->is_viewed_,
sticker_set->has_text_color_, sticker_set->channel_emoji_status_, sticker_set->is_viewed_,
sticker_set->was_loaded_ ? actual_count : max(actual_count, sticker_set->sticker_count_), std::move(stickers));
}
@ -3583,7 +3584,8 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
bool is_installed = (set->flags_ & telegram_api::stickerSet::INSTALLED_DATE_MASK) != 0;
bool is_archived = set->archived_;
bool is_official = set->official_;
bool has_text_color = set->text_color_;
bool has_text_color = set->emojis_ && set->text_color_;
bool channel_emoji_status = set->emojis_ && set->channel_emoji_status_;
StickerFormat sticker_format =
set->videos_ ? StickerFormat::Webm : (set->animated_ ? StickerFormat::Tgs : StickerFormat::Webp);
StickerType sticker_type =
@ -3623,6 +3625,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
s->sticker_format_ = sticker_format;
s->sticker_type_ = sticker_type;
s->has_text_color_ = has_text_color;
s->channel_emoji_status_ = channel_emoji_status;
s->is_changed_ = true;
} else {
CHECK(s->id_ == set_id);
@ -3698,6 +3701,11 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
s->has_text_color_ = has_text_color;
s->is_changed_ = true;
}
if (s->channel_emoji_status_ != channel_emoji_status) {
LOG(INFO) << "Channel e,oji status flag of " << set_id << " changed to " << channel_emoji_status;
s->channel_emoji_status_ = channel_emoji_status;
s->is_changed_ = true;
}
if (s->sticker_format_ != sticker_format) {
LOG(ERROR) << "Format of stickers in " << set_id << '/' << s->short_name_ << " has changed from "
<< s->sticker_format_ << " to " << sticker_format << " from " << source;
@ -3839,6 +3847,7 @@ StickerSetId StickersManager::on_get_messages_sticker_set(StickerSetId sticker_s
s->is_changed_ = true;
s->are_keywords_loaded_ = true;
s->is_sticker_has_text_color_loaded_ = true;
s->is_sticker_channel_emoji_status_loaded_ = true;
FlatHashMap<int64, FileId> document_id_to_sticker_id;
@ -5388,8 +5397,9 @@ void StickersManager::on_load_sticker_set_from_database(StickerSetId sticker_set
<< format::as_hex_dump<4>(Slice(value));
}
}
if (!sticker_set->is_sticker_has_text_color_loaded_ || !sticker_set->are_keywords_loaded_ ||
!sticker_set->is_thumbnail_reloaded_ || !sticker_set->are_legacy_sticker_thumbnails_reloaded_) {
if (!sticker_set->is_sticker_channel_emoji_status_loaded_ || !sticker_set->is_sticker_has_text_color_loaded_ ||
!sticker_set->are_keywords_loaded_ || !sticker_set->is_thumbnail_reloaded_ ||
!sticker_set->are_legacy_sticker_thumbnails_reloaded_) {
do_reload_sticker_set(sticker_set_id, get_input_sticker_set(sticker_set), 0, Auto(),
"on_load_sticker_set_from_database 2");
}

View File

@ -468,8 +468,9 @@ class StickersManager final : public Actor {
bool is_inited_ = false; // basic information about the set
bool was_loaded_ = false;
bool is_loaded_ = false;
bool are_keywords_loaded_ = false; // stored in telegram_api::messages_stickerSet
bool is_sticker_has_text_color_loaded_ = false; // stored in telegram_api::messages_stickerSet
bool are_keywords_loaded_ = false; // stored in telegram_api::messages_stickerSet
bool is_sticker_has_text_color_loaded_ = false;
bool is_sticker_channel_emoji_status_loaded_ = false;
StickerSetId id_;
int64 access_hash_ = 0;
@ -496,6 +497,7 @@ class StickersManager final : public Actor {
bool is_archived_ = false;
bool is_official_ = false;
bool has_text_color_ = false;
bool channel_emoji_status_ = false;
bool is_viewed_ = true;
bool is_thumbnail_reloaded_ = false; // stored in telegram_api::stickerSet
bool are_legacy_sticker_thumbnails_reloaded_ = false; // stored in telegram_api::stickerSet

View File

@ -202,6 +202,8 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with
STORE_FLAG(sticker_set->are_keywords_loaded_);
STORE_FLAG(sticker_set->is_sticker_has_text_color_loaded_);
STORE_FLAG(sticker_set->has_text_color_);
STORE_FLAG(sticker_set->is_sticker_channel_emoji_status_loaded_);
STORE_FLAG(sticker_set->channel_emoji_status_);
END_STORE_FLAGS();
store(sticker_set->id_.get(), storer);
store(sticker_set->access_hash_, storer);
@ -266,6 +268,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
bool is_emojis;
bool has_thumbnail_document_id;
bool has_text_color;
bool channel_emoji_status;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(sticker_set->is_inited_);
PARSE_FLAG(sticker_set->was_loaded_);
@ -287,6 +290,8 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
PARSE_FLAG(sticker_set->are_keywords_loaded_);
PARSE_FLAG(sticker_set->is_sticker_has_text_color_loaded_);
PARSE_FLAG(has_text_color);
PARSE_FLAG(sticker_set->is_sticker_channel_emoji_status_loaded_);
PARSE_FLAG(channel_emoji_status);
END_PARSE_FLAGS();
int64 sticker_set_id;
int64 access_hash;
@ -308,6 +313,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
auto sticker_type = ::td::get_sticker_type(is_masks, is_emojis);
if (!is_emojis) {
sticker_set->is_sticker_has_text_color_loaded_ = true;
sticker_set->is_sticker_channel_emoji_status_loaded_ = true;
}
if (sticker_set->is_inited_) {
@ -349,6 +355,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
sticker_set->sticker_type_ = sticker_type;
sticker_set->sticker_format_ = sticker_format;
sticker_set->has_text_color_ = has_text_color;
sticker_set->channel_emoji_status_ = channel_emoji_status;
auto cleaned_username = clean_username(sticker_set->short_name_);
if (!cleaned_username.empty()) {
@ -358,7 +365,8 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
} else {
if (sticker_set->title_ != title || sticker_set->minithumbnail_ != minithumbnail ||
sticker_set->thumbnail_ != thumbnail || sticker_set->thumbnail_document_id_ != thumbnail_document_id ||
sticker_set->is_official_ != is_official || sticker_set->has_text_color_ != has_text_color) {
sticker_set->is_official_ != is_official || sticker_set->has_text_color_ != has_text_color ||
sticker_set->channel_emoji_status_ != channel_emoji_status) {
sticker_set->is_changed_ = true;
}
if (sticker_set->short_name_ != short_name) {