From 6225237cb957d3ab7b7a0102bc5f7e1524fa3128 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 17 Apr 2020 15:56:57 +0300 Subject: [PATCH] Add td_api::updateStickerSet. GitOrigin-RevId: 4c4299138929e45a2c5a044895f18bd49045256a --- td/generate/scheme/td_api.tl | 3 +++ td/generate/scheme/td_api.tlo | Bin 170932 -> 171028 bytes td/telegram/StickersManager.cpp | 8 +++++++- td/telegram/StickersManager.h | 5 +++-- 4 files changed, 13 insertions(+), 3 deletions(-) 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 ba6ec2744e1e42dea1e40571ecffb9347730b675..aa7d5b40deccfd0585693a2abdb95e0219b1112c 100644 GIT binary patch delta 1991 zcmZuyUr1YL6!(0_l1VnQ;ns|1n_ytKc!#%;hfp$*RmL77%hq)SX2DVgxA~A+3$FAb zP${nKAnTQUc~G0UtJPX<(pYb-S-nz_AV-tgz&s?_BRj^K|a- zobx+>zms{rez;hl34A}?P-qB5>RvqbSNqg~6Y;K7{oOU~>M3@xFnHKs3$I1Wdwq(r0JN%6-yv3F8z>QjC3}lpc#~_AM(1>OMjm%;iMNDY$32L{=PK|#hs~!y-#-kI$y$bWp1UZ@$RB-$p z6BLn2!a8q)%(Y2~AotTrC&|_%k@Q|8$#O8R!3XHznG%h_WTKMV8Wf`$nQ{h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*l&N>Uslk~8<{R0rhl!7&6lMr9*VOi1DFet9(mqt+xm5K_b@ z;n6W!VqL91Mjfh*L7>iDx36<12c!4?7Xr%nA%X(h#$}eefb4IoWjIRX)+C$P5S_5v zW0x3SPhyhVUhZR(J~>HwH*QRJ&oyO9DPmKE(#bALQzXy-z|w?^D7muH^UWFq(}X`W zO}Rq9vo=whmSKq*$zk|rpbwBF^N=R+{X;m4HZ@IDooSl)w`mgKoP}A8E6kEj`-}Y| z4*tnn&=Gw^3gV9-BRLOl^ECjT zy4u3qTjhwZnIQLLn8pmH$C4A(S@4;uw(xDo_X)>1 zcyFsVp=C)=IZMs=bTL&Fz5}lr)$;@fkjnFv9)s!?qF;YXC3gJ5L?=);nkw&RrX%PnMt+L#j(O1FmI~5?z+^c<8o^$B#Hgb{YCH z{={>O%tk)*U#rMGCpF;}6L?4w6DyEGQ1peoK`Wsm)?R?z&S-&vxu0al0`wrb{iQ71 zh`j`t+{7ENsDqhTG#zVX^`#9XFq&3U$Yr;&U)>i0W7Rk 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;