Add group_call_id to supergroupFullInfo.

This commit is contained in:
levlam 2020-11-25 23:07:10 +03:00
parent cc47f9b63f
commit 5d6e55e939
4 changed files with 27 additions and 11 deletions

View File

@ -583,6 +583,7 @@ supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_co
//@restricted_count Number of restricted users in the supergroup; 0 if unknown
//@banned_count Number of users banned from chat; 0 if unknown
//@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown
//@group_call_id Identifier of an active group call; empty if none or unknown
//@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds
//@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero
//@can_get_members True, if members of the chat can be retrieved
@ -596,7 +597,7 @@ supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_co
//@invite_link Invite link for this chat
//@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none
//@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none
supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool is_all_history_available:Bool sticker_set_id:int64 location:chatLocation invite_link:string upgraded_from_basic_group_id:int32 upgraded_from_max_message_id:int53 = SupergroupFullInfo;
supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 group_call_id:string slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool is_all_history_available:Bool sticker_set_id:int64 location:chatLocation invite_link:string upgraded_from_basic_group_id:int32 upgraded_from_max_message_id:int53 = SupergroupFullInfo;
//@class SecretChatState @description Describes the current secret chat state

Binary file not shown.

View File

@ -8707,7 +8707,13 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
channel_full->expires_at = 0.0;
}
}
on_update_channel_full_photo(channel_full, channel_id, std::move(channel_full->photo));
auto photo = std::move(channel_full->photo);
on_update_channel_full_photo(channel_full, channel_id, std::move(photo));
if (!c->has_active_group_call && channel_full->active_group_call_id.is_valid()) {
channel_full->active_group_call_id = InputGroupCallId();
channel_full->expires_at = 0.0;
}
update_channel_full(channel_full, channel_id, true);
@ -9588,11 +9594,13 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
channel->active_group_call_id = group_call_id;
bool has_active_group_call = group_call_id.is_valid();
if (c->has_active_group_call != has_active_group_call) {
LOG(ERROR) << "Receive invalid has_active_group_call flag " << c->has_active_group_call;
LOG(ERROR) << "Receive invalid has_active_group_call flag " << c->has_active_group_call << ", but have "
<< group_call_id;
c->has_active_group_call = has_active_group_call;
c->is_changed = true;
update_channel(c, channel_id);
}
channel->is_changed = true;
}
on_update_channel_full_photo(
@ -10966,7 +10974,8 @@ void ContactsManager::drop_channel_photos(ChannelId channel_id, bool is_empty, b
}
}
void ContactsManager::invalidate_channel_full(ChannelId channel_id, bool drop_invite_link, bool drop_slow_mode_delay) {
void ContactsManager::invalidate_channel_full(ChannelId channel_id, bool drop_invite_link, bool drop_slow_mode_delay,
bool drop_active_group_call_id) {
LOG(INFO) << "Invalidate supergroup full for " << channel_id;
// drop channel full cache
auto channel_full = get_channel_full_force(channel_id, "invalidate_channel_full");
@ -10981,6 +10990,10 @@ void ContactsManager::invalidate_channel_full(ChannelId channel_id, bool drop_in
channel_full->is_slow_mode_next_send_date_changed = true;
channel_full->is_changed = true;
}
if (drop_active_group_call_id && channel_full->active_group_call_id.is_valid()) {
channel_full->active_group_call_id = InputGroupCallId();
channel_full->is_changed = true;
}
update_channel_full(channel_full, channel_id);
}
if (drop_invite_link) {
@ -13953,6 +13966,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
}
bool need_invalidate_channel_full = false;
bool need_drop_active_group_call_id = c->has_active_group_call != has_active_group_call;
if (c->has_linked_channel != has_linked_channel || c->has_location != has_location ||
c->has_active_group_call != has_active_group_call || c->sign_messages != sign_messages ||
c->is_megagroup != is_megagroup || c->is_verified != is_verified ||
@ -13979,7 +13993,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
update_channel(c, channel_id);
if (need_invalidate_channel_full) {
invalidate_channel_full(channel_id, false, !c->is_slow_mode_enabled);
invalidate_channel_full(channel_id, false, !c->is_slow_mode_enabled, need_drop_active_group_call_id);
}
}
@ -14316,11 +14330,11 @@ tl_object_ptr<td_api::supergroupFullInfo> ContactsManager::get_supergroup_full_i
return td_api::make_object<td_api::supergroupFullInfo>(
get_chat_photo_object(td_->file_manager_.get(), channel_full->photo), channel_full->description,
channel_full->participant_count, channel_full->administrator_count, channel_full->restricted_count,
channel_full->banned_count, DialogId(channel_full->linked_channel_id).get(), channel_full->slow_mode_delay,
slow_mode_delay_expires_in, channel_full->can_get_participants, channel_full->can_set_username,
channel_full->can_set_sticker_set, channel_full->can_set_location, channel_full->can_view_statistics,
channel_full->is_all_history_available, channel_full->sticker_set_id.get(),
channel_full->location.get_chat_location_object(), channel_full->invite_link,
channel_full->banned_count, DialogId(channel_full->linked_channel_id).get(),
channel_full->active_group_call_id.get_group_call_id(), channel_full->slow_mode_delay, slow_mode_delay_expires_in,
channel_full->can_get_participants, channel_full->can_set_username, channel_full->can_set_sticker_set,
channel_full->can_set_location, channel_full->can_view_statistics, channel_full->is_all_history_available,
channel_full->sticker_set_id.get(), channel_full->location.get_chat_location_object(), channel_full->invite_link,
get_basic_group_id_object(channel_full->migrated_from_chat_id, "get_supergroup_full_info_object"),
channel_full->migrated_from_max_message_id.get());
}

View File

@ -216,7 +216,8 @@ class ContactsManager : public Actor {
void speculative_delete_channel_participant(ChannelId channel_id, UserId deleted_user_id, bool by_me);
void invalidate_channel_full(ChannelId channel_id, bool drop_invite_link, bool drop_slow_mode_delay);
void invalidate_channel_full(ChannelId channel_id, bool drop_invite_link, bool drop_slow_mode_delay,
bool drop_active_group_call_id = false);
bool on_get_channel_error(ChannelId channel_id, const Status &status, const string &source);