Support telegram_api::updateSentStoryReaction.

This commit is contained in:
levlam 2023-08-04 19:18:27 +03:00
parent b36aee538b
commit f37a9e73ca
4 changed files with 29 additions and 4 deletions

View File

@ -3272,6 +3272,26 @@ void StoryManager::on_update_story_stealth_mode(
set_story_stealth_mode(StoryStealthMode(std::move(stealth_mode))); set_story_stealth_mode(StoryStealthMode(std::move(stealth_mode)));
} }
void StoryManager::on_update_story_chosen_reaction_type(DialogId owner_dialog_id, StoryId story_id,
ReactionType chosen_reaction_type) {
if (!owner_dialog_id.is_valid() || !story_id.is_server()) {
LOG(ERROR) << "Receive chosen reaction in " << story_id << " in " << owner_dialog_id;
return;
}
if (!td_->messages_manager_->have_dialog_info_force(owner_dialog_id)) {
return;
}
StoryFullId story_full_id{owner_dialog_id, story_id};
Story *story = get_story_force(story_full_id, "on_update_story_chosen_reaction_type");
if (story == nullptr) {
return;
}
if (story->chosen_reaction_type_ != chosen_reaction_type) {
story->chosen_reaction_type_ = std::move(chosen_reaction_type);
on_story_changed(story_full_id, story, true, true);
}
}
void StoryManager::set_story_stealth_mode(StoryStealthMode stealth_mode) { void StoryManager::set_story_stealth_mode(StoryStealthMode stealth_mode) {
if (stealth_mode == stealth_mode_) { if (stealth_mode == stealth_mode_) {
return; return;

View File

@ -268,6 +268,9 @@ class StoryManager final : public Actor {
void on_update_story_stealth_mode(telegram_api::object_ptr<telegram_api::storiesStealthMode> &&stealth_mode); void on_update_story_stealth_mode(telegram_api::object_ptr<telegram_api::storiesStealthMode> &&stealth_mode);
void on_update_story_chosen_reaction_type(DialogId owner_dialog_id, StoryId story_id,
ReactionType chosen_reaction_type);
void on_dialog_active_stories_order_updated(DialogId owner_dialog_id, const char *source); void on_dialog_active_stories_order_updated(DialogId owner_dialog_id, const char *source);
Status can_get_story_viewers(StoryFullId story_full_id, const Story *story) const; Status can_get_story_viewers(StoryFullId story_full_id, const Story *story) const;

View File

@ -4316,12 +4316,14 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStoriesStealthM
promise.set_value(Unit()); promise.set_value(Unit());
} }
// unsupported updates
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateSentStoryReaction> update, Promise<Unit> &&promise) { void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateSentStoryReaction> update, Promise<Unit> &&promise) {
td_->story_manager_->on_update_story_chosen_reaction_type(
DialogId(UserId(update->user_id_)), StoryId(update->story_id_), ReactionType(update->reaction_));
promise.set_value(Unit()); promise.set_value(Unit());
} }
// unsupported updates
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStoryID> update, Promise<Unit> &&promise) { void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStoryID> update, Promise<Unit> &&promise) {
promise.set_value(Unit()); promise.set_value(Unit());
} }

View File

@ -626,10 +626,10 @@ class UpdatesManager final : public Actor {
void on_update(tl_object_ptr<telegram_api::updateStoriesStealthMode> update, Promise<Unit> &&promise); void on_update(tl_object_ptr<telegram_api::updateStoriesStealthMode> update, Promise<Unit> &&promise);
// unsupported updates
void on_update(tl_object_ptr<telegram_api::updateSentStoryReaction> update, Promise<Unit> &&promise); void on_update(tl_object_ptr<telegram_api::updateSentStoryReaction> update, Promise<Unit> &&promise);
// unsupported updates
void on_update(tl_object_ptr<telegram_api::updateStoryID> update, Promise<Unit> &&promise); void on_update(tl_object_ptr<telegram_api::updateStoryID> update, Promise<Unit> &&promise);
}; };