diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index c7958bc14..e470ab989 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3010,6 +3010,9 @@ updateUnreadChatCount chat_list:ChatList total_count:int32 unread_count:int32 un //@description An option changed its value @name The option name @value The new option value updateOption name:string value:OptionValue = Update; +//@description A sticker set has changed @sticker_set The sticker set +updateStickerSet sticker_set:stickerSet = Update; + //@description The list of installed sticker sets was updated @is_masks True, if the list of installed mask sticker sets was updated @sticker_set_ids The new list of installed ordinary sticker sets updateInstalledStickerSets is_masks:Bool sticker_set_ids:vector = Update; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index ba6ec2744..aa7d5b40d 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index a63b8193e..8ccb866d7 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1221,6 +1221,7 @@ tl_object_ptr StickersManager::get_sticker_set_object(Sticke const StickerSet *sticker_set = get_sticker_set(sticker_set_id); CHECK(sticker_set != nullptr); CHECK(sticker_set->was_loaded); + sticker_set->was_update_sent = true; std::vector> stickers; std::vector> emojis; @@ -1268,6 +1269,7 @@ tl_object_ptr StickersManager::get_sticker_set_info_obje const StickerSet *sticker_set = get_sticker_set(sticker_set_id); CHECK(sticker_set != nullptr); CHECK(sticker_set->is_inited); + sticker_set->was_update_sent = true; std::vector> stickers; for (auto sticker_id : sticker_set->sticker_ids) { @@ -2976,7 +2978,7 @@ string StickersManager::get_sticker_set_database_value(const StickerSet *s, bool void StickersManager::update_sticker_set(StickerSet *sticker_set) { CHECK(sticker_set != nullptr); if (sticker_set->is_changed || sticker_set->need_save_to_database) { - if (G()->parameters().use_file_db) { + if (G()->parameters().use_file_db && sticker_set->need_save_to_database) { LOG(INFO) << "Save " << sticker_set->id << " to database"; if (sticker_set->is_inited) { G()->td_db()->get_sqlite_pmc()->set(get_sticker_set_database_key(sticker_set->id), @@ -2987,6 +2989,10 @@ void StickersManager::update_sticker_set(StickerSet *sticker_set) { get_sticker_set_database_value(sticker_set, true), Auto()); } } + if (sticker_set->is_changed && sticker_set->was_loaded && sticker_set->was_update_sent) { + send_closure(G()->td(), &Td::send_update, + td_api::make_object(get_sticker_set_object(sticker_set->id))); + } sticker_set->is_changed = false; sticker_set->need_save_to_database = false; if (sticker_set->is_inited) { diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index 6b28806b4..24556247c 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -325,8 +325,9 @@ class StickersManager : public Actor { bool is_masks = false; bool is_viewed = true; bool is_thumbnail_reloaded = false; - bool is_changed = true; // have new changes that need to be sent to the client and database - bool need_save_to_database = true; // have new changes that need only to be saved to the database + mutable bool was_update_sent = false; // does the sticker set is known to the client + bool is_changed = true; // have new changes that need to be sent to the client and database + bool need_save_to_database = true; // have new changes that need only to be saved to the database vector load_requests; vector load_without_stickers_requests;