Move voice chat-related fields to Dialog.
This commit is contained in:
parent
00eed8928c
commit
6ca15f18c8
@ -451,7 +451,7 @@ chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_pol
|
||||
//@is_member True, if the user is a member of the chat
|
||||
chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = ChatMemberStatus;
|
||||
|
||||
//@description The user is a member of a chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, and ban unprivileged members. In supergroups and channels, there are more detailed options for administrator privileges
|
||||
//@description The user is a member of a chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, ban unprivileged members, and manage voice chats. In supergroups and channels, there are more detailed options for administrator privileges
|
||||
//@custom_title A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only
|
||||
//@can_be_edited True, if the current user can edit the administrator privileges for the called user
|
||||
//@can_change_info True, if the administrator can change the chat title, photo, and other settings
|
||||
@ -462,7 +462,7 @@ chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = C
|
||||
//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members
|
||||
//@can_pin_messages True, if the administrator can pin messages; applicable to groups only
|
||||
//@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them
|
||||
//@can_manage_voice_chats True, if the administrator can manage voice chats; applicable to supergroups only
|
||||
//@can_manage_voice_chats True, if the administrator can manage voice chats; applicable to groups only
|
||||
//@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only
|
||||
chatMemberStatusAdministrator custom_title:string can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool can_manage_voice_chats:Bool is_anonymous:Bool = ChatMemberStatus;
|
||||
|
||||
@ -570,15 +570,13 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int32 memb
|
||||
//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, or getUserPrivacySettingRules
|
||||
//@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel
|
||||
//@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup
|
||||
//@has_voice_chat True, if the supergroup has active voice chat
|
||||
//@is_voice_chat_empty True, if the supergroup's active voice chat is empty
|
||||
//@sign_messages True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels
|
||||
//@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup
|
||||
//@is_channel True, if the supergroup is a channel
|
||||
//@is_verified True, if the supergroup or channel is verified
|
||||
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted
|
||||
//@is_scam True, if many users reported this supergroup as a scam
|
||||
supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool has_voice_chat:Bool is_voice_chat_empty:Bool sign_messages:Bool is_slow_mode_enabled:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup;
|
||||
supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool is_slow_mode_enabled:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup;
|
||||
|
||||
//@description Contains full information about a supergroup or channel
|
||||
//@photo Chat photo; may be null
|
||||
@ -588,7 +586,6 @@ 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 voice chat; 0 if none or unknown. The voice chat can be received through the method getGroupCall.
|
||||
//@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
|
||||
@ -602,7 +599,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 group_call_id:int32 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 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
|
||||
@ -869,10 +866,12 @@ chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPo
|
||||
//@unread_mention_count Number of unread messages with a mention/reply in the chat
|
||||
//@notification_settings Notification settings for this chat
|
||||
//@action_bar Describes actions which should be possible to do through a chat action bar; may be null
|
||||
//@voice_chat_group_call_id Group call identifier of an active voice chat; 0 if none or unknown. The voice chat can be received through the method getGroupCall
|
||||
//@is_voice_chat_empty True, if an active voice chat is empty
|
||||
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
||||
//@draft_message A draft of a message in the chat; may be null
|
||||
//@client_data Contains application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings action_bar:ChatActionBar reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings action_bar:ChatActionBar voice_chat_group_call_id:int32 is_voice_chat_empty:Bool reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||
|
||||
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
|
||||
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
||||
@ -2406,7 +2405,7 @@ chatEvents events:vector<chatEvent> = ChatEvents;
|
||||
//@member_restrictions True, if member restricted/unrestricted/banned/unbanned events should be returned
|
||||
//@info_changes True, if changes in chat information should be returned
|
||||
//@setting_changes True, if changes in chat settings should be returned
|
||||
//@voice_chat_changes True, if voice chat actionss should be returned
|
||||
//@voice_chat_changes True, if voice chat actions should be returned
|
||||
chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool voice_chat_changes:Bool = ChatEventLogFilters;
|
||||
|
||||
|
||||
@ -3289,6 +3288,9 @@ updateChatIsBlocked chat_id:int53 is_blocked:Bool = Update;
|
||||
//@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages
|
||||
updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update;
|
||||
|
||||
//@description A chat voice chat state has changed @chat_id Chat identifier @voice_chat_group_call_id New value of voice_chat_group_call_id @is_voice_chat_empty New value of is_voice_chat_empty
|
||||
updateChatVoiceChat chat_id:int53 voice_chat_group_call_id:int32 is_voice_chat_empty:Bool = Update;
|
||||
|
||||
//@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed @chat_id Chat identifier @default_disable_notification The new default_disable_notification value
|
||||
updateChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Update;
|
||||
|
||||
|
Binary file not shown.
@ -21,6 +21,7 @@
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/GroupCallManager.h"
|
||||
#include "td/telegram/InlineQueriesManager.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/logevent/LogEvent.h"
|
||||
#include "td/telegram/logevent/LogEventHelper.h"
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
@ -3538,6 +3539,7 @@ void ContactsManager::Channel::store(StorerT &storer) const {
|
||||
bool have_default_permissions = true;
|
||||
bool has_cache_version = cache_version != 0;
|
||||
bool has_restriction_reasons = !restriction_reasons.empty();
|
||||
bool legacy_has_active_group_call = false;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(false);
|
||||
STORE_FLAG(false);
|
||||
@ -3560,8 +3562,7 @@ void ContactsManager::Channel::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_location);
|
||||
STORE_FLAG(is_slow_mode_enabled);
|
||||
STORE_FLAG(has_restriction_reasons);
|
||||
STORE_FLAG(has_active_group_call);
|
||||
STORE_FLAG(is_group_call_empty);
|
||||
STORE_FLAG(legacy_has_active_group_call);
|
||||
END_STORE_FLAGS();
|
||||
|
||||
store(status, storer);
|
||||
@ -3605,6 +3606,7 @@ void ContactsManager::Channel::parse(ParserT &parser) {
|
||||
bool have_default_permissions;
|
||||
bool has_cache_version;
|
||||
bool has_restriction_reasons;
|
||||
bool legacy_has_active_group_call;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(left);
|
||||
PARSE_FLAG(kicked);
|
||||
@ -3627,8 +3629,7 @@ void ContactsManager::Channel::parse(ParserT &parser) {
|
||||
PARSE_FLAG(has_location);
|
||||
PARSE_FLAG(is_slow_mode_enabled);
|
||||
PARSE_FLAG(has_restriction_reasons);
|
||||
PARSE_FLAG(has_active_group_call);
|
||||
PARSE_FLAG(is_group_call_empty);
|
||||
PARSE_FLAG(legacy_has_active_group_call);
|
||||
END_PARSE_FLAGS();
|
||||
|
||||
if (use_new_rights) {
|
||||
@ -3676,6 +3677,9 @@ void ContactsManager::Channel::parse(ParserT &parser) {
|
||||
if (has_cache_version) {
|
||||
parse(cache_version, parser);
|
||||
}
|
||||
if (legacy_has_active_group_call) {
|
||||
cache_version = 0;
|
||||
}
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -3696,7 +3700,7 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const {
|
||||
bool is_slow_mode_delay_active = slow_mode_next_send_date != 0;
|
||||
bool has_stats_dc_id = stats_dc_id.is_exact();
|
||||
bool has_photo = !photo.is_empty();
|
||||
bool has_active_group_call_id = active_group_call_id.is_valid();
|
||||
bool legacy_has_active_group_call_id = false;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(has_description);
|
||||
STORE_FLAG(has_administrator_count);
|
||||
@ -3721,7 +3725,7 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_photo);
|
||||
STORE_FLAG(is_can_view_statistics_inited);
|
||||
STORE_FLAG(can_view_statistics);
|
||||
STORE_FLAG(has_active_group_call_id);
|
||||
STORE_FLAG(legacy_has_active_group_call_id);
|
||||
END_STORE_FLAGS();
|
||||
if (has_description) {
|
||||
store(description, storer);
|
||||
@ -3770,9 +3774,6 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const {
|
||||
if (has_photo) {
|
||||
store(photo, storer);
|
||||
}
|
||||
if (has_active_group_call_id) {
|
||||
store(active_group_call_id, storer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
@ -3794,7 +3795,7 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) {
|
||||
bool is_slow_mode_delay_active;
|
||||
bool has_stats_dc_id;
|
||||
bool has_photo;
|
||||
bool has_active_group_call_id;
|
||||
bool legacy_has_active_group_call_id;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(has_description);
|
||||
PARSE_FLAG(has_administrator_count);
|
||||
@ -3819,7 +3820,7 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) {
|
||||
PARSE_FLAG(has_photo);
|
||||
PARSE_FLAG(is_can_view_statistics_inited);
|
||||
PARSE_FLAG(can_view_statistics);
|
||||
PARSE_FLAG(has_active_group_call_id);
|
||||
PARSE_FLAG(legacy_has_active_group_call_id);
|
||||
END_PARSE_FLAGS();
|
||||
if (has_description) {
|
||||
parse(description, parser);
|
||||
@ -3868,8 +3869,9 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) {
|
||||
if (has_photo) {
|
||||
parse(photo, parser);
|
||||
}
|
||||
if (has_active_group_call_id) {
|
||||
parse(active_group_call_id, parser);
|
||||
if (legacy_has_active_group_call_id) {
|
||||
InputGroupCallId input_group_call_id;
|
||||
parse(input_group_call_id, parser);
|
||||
}
|
||||
|
||||
if (legacy_can_view_statistics) {
|
||||
@ -8713,11 +8715,6 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
|
||||
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);
|
||||
|
||||
if (channel_full->expires_at == 0.0) {
|
||||
@ -9553,14 +9550,6 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
LOG(ERROR) << "Receive can_view_statistics == true, but invalid statistics DC ID in " << channel_id;
|
||||
can_view_statistics = false;
|
||||
}
|
||||
InputGroupCallId input_group_call_id;
|
||||
if (channel_full->call_ != nullptr) {
|
||||
input_group_call_id = InputGroupCallId(channel_full->call_);
|
||||
if (input_group_call_id.is_valid() && !c->is_megagroup) {
|
||||
LOG(ERROR) << "Receive " << input_group_call_id << " in " << channel_id;
|
||||
input_group_call_id = InputGroupCallId();
|
||||
}
|
||||
}
|
||||
|
||||
channel->repair_request_version = 0;
|
||||
channel->expires_at = Time::now() + CHANNEL_FULL_EXPIRE_TIME;
|
||||
@ -9597,22 +9586,6 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
channel->need_save_to_database = true;
|
||||
}
|
||||
|
||||
if (channel->active_group_call_id != input_group_call_id) {
|
||||
channel->active_group_call_id = input_group_call_id;
|
||||
bool has_active_group_call = input_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 << ", but have "
|
||||
<< input_group_call_id << " in " << channel_id;
|
||||
c->has_active_group_call = has_active_group_call;
|
||||
if (!has_active_group_call) {
|
||||
c->is_group_call_empty = false;
|
||||
}
|
||||
c->is_changed = true;
|
||||
update_channel(c, channel_id);
|
||||
}
|
||||
channel->is_changed = true;
|
||||
}
|
||||
|
||||
on_update_channel_full_photo(
|
||||
channel, channel_id,
|
||||
get_photo(td_->file_manager_.get(), std::move(channel_full->chat_photo_), DialogId(channel_id)));
|
||||
@ -9649,6 +9622,17 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_has_scheduled_server_messages(
|
||||
DialogId(channel_id), (channel_full->flags_ & CHANNEL_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
|
||||
{
|
||||
InputGroupCallId input_group_call_id;
|
||||
if (channel_full->call_ != nullptr) {
|
||||
input_group_call_id = InputGroupCallId(channel_full->call_);
|
||||
if (input_group_call_id.is_valid() && !c->is_megagroup) {
|
||||
LOG(ERROR) << "Receive " << input_group_call_id << " in " << channel_id;
|
||||
input_group_call_id = InputGroupCallId();
|
||||
}
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_group_call_id(DialogId(channel_id), input_group_call_id);
|
||||
}
|
||||
|
||||
if (participant_count >= 190) {
|
||||
int32 online_member_count = 0;
|
||||
@ -10984,8 +10968,7 @@ 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,
|
||||
bool drop_active_group_call_id) {
|
||||
void ContactsManager::invalidate_channel_full(ChannelId channel_id, bool drop_invite_link, bool drop_slow_mode_delay) {
|
||||
LOG(INFO) << "Invalidate supergroup full for " << channel_id;
|
||||
// drop channel full cache
|
||||
auto channel_full = get_channel_full_force(channel_id, "invalidate_channel_full");
|
||||
@ -11000,10 +10983,6 @@ 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) {
|
||||
@ -12222,36 +12201,6 @@ void ContactsManager::on_update_channel_is_all_history_available(ChannelId chann
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_channel_group_call(ChannelId channel_id, bool has_active_group_call,
|
||||
bool is_group_call_empty) {
|
||||
CHECK(channel_id.is_valid());
|
||||
Channel *c = get_channel_force(channel_id);
|
||||
if (c == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (c->has_active_group_call == has_active_group_call && c->is_group_call_empty == is_group_call_empty) {
|
||||
return;
|
||||
}
|
||||
if (!c->has_active_group_call && !has_active_group_call) {
|
||||
c->is_group_call_empty = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->has_active_group_call && !has_active_group_call) {
|
||||
auto channel_full = get_channel_full(channel_id, "on_update_channel_group_call");
|
||||
if (channel_full != nullptr && 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);
|
||||
}
|
||||
}
|
||||
|
||||
c->has_active_group_call = has_active_group_call;
|
||||
c->is_group_call_empty = is_group_call_empty;
|
||||
c->is_changed = true;
|
||||
update_channel(c, channel_id);
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_channel_default_permissions(ChannelId channel_id,
|
||||
RestrictedRights default_permissions) {
|
||||
if (!channel_id.is_valid()) {
|
||||
@ -13098,17 +13047,6 @@ int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id) {
|
||||
return channel_full->slow_mode_delay;
|
||||
}
|
||||
|
||||
GroupCallId ContactsManager::get_channel_active_group_call_id(ChannelId channel_id) {
|
||||
auto channel_full = get_channel_full_const(channel_id);
|
||||
if (channel_full == nullptr) {
|
||||
channel_full = get_channel_full_force(channel_id, "get_channel_active_group_call_id");
|
||||
if (channel_full == nullptr) {
|
||||
return GroupCallId();
|
||||
}
|
||||
}
|
||||
return td_->group_call_manager_->get_group_call_id(channel_full->active_group_call_id, DialogId(channel_id));
|
||||
}
|
||||
|
||||
bool ContactsManager::have_channel(ChannelId channel_id) const {
|
||||
return channels_.count(channel_id) > 0;
|
||||
}
|
||||
@ -14011,6 +13949,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
|
||||
on_update_channel_username(c, channel_id, std::move(channel.username_)); // uses status, must be called after
|
||||
on_update_channel_default_permissions(c, channel_id,
|
||||
get_restricted_rights(std::move(channel.default_banned_rights_)));
|
||||
td_->messages_manager_->on_update_dialog_group_call(DialogId(channel_id), has_active_group_call, is_group_call_empty);
|
||||
|
||||
if (participant_count != 0 && participant_count != c->participant_count) {
|
||||
c->participant_count = participant_count;
|
||||
@ -14018,13 +13957,11 @@ 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->is_megagroup != is_megagroup ||
|
||||
c->is_slow_mode_enabled != is_slow_mode_enabled || c->is_megagroup != is_megagroup ||
|
||||
c->restriction_reasons != restriction_reasons || c->is_scam != is_scam) {
|
||||
c->has_linked_channel = has_linked_channel;
|
||||
c->has_location = has_location;
|
||||
c->has_active_group_call = has_active_group_call;
|
||||
c->is_slow_mode_enabled = is_slow_mode_enabled;
|
||||
c->is_megagroup = is_megagroup;
|
||||
c->restriction_reasons = std::move(restriction_reasons);
|
||||
@ -14033,11 +13970,9 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
|
||||
c->is_changed = true;
|
||||
need_invalidate_channel_full = true;
|
||||
}
|
||||
if (c->is_group_call_empty != is_group_call_empty || c->sign_messages != sign_messages ||
|
||||
c->is_verified != is_verified) {
|
||||
c->is_group_call_empty = is_group_call_empty;
|
||||
c->sign_messages = sign_messages;
|
||||
if (c->is_verified != is_verified || c->sign_messages != sign_messages) {
|
||||
c->is_verified = is_verified;
|
||||
c->sign_messages = sign_messages;
|
||||
|
||||
c->is_changed = true;
|
||||
}
|
||||
@ -14050,7 +13985,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, need_drop_active_group_call_id);
|
||||
invalidate_channel_full(channel_id, false, !c->is_slow_mode_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14090,9 +14025,8 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
|
||||
// on_update_channel_username(c, channel_id, ""); // don't know if channel username is empty, so don't update it
|
||||
tl_object_ptr<telegram_api::chatBannedRights> banned_rights; // == nullptr
|
||||
on_update_channel_default_permissions(c, channel_id, get_restricted_rights(banned_rights));
|
||||
td_->messages_manager_->on_update_dialog_group_call(DialogId(channel_id), false, false);
|
||||
|
||||
bool has_active_group_call = false;
|
||||
bool is_group_call_empty = false;
|
||||
bool sign_messages = false;
|
||||
bool is_slow_mode_enabled = false;
|
||||
bool is_megagroup = (channel.flags_ & CHANNEL_FLAG_IS_MEGAGROUP) != 0;
|
||||
@ -14116,11 +14050,10 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
|
||||
}
|
||||
|
||||
bool need_invalidate_channel_full = false;
|
||||
if (c->has_active_group_call != has_active_group_call || c->is_slow_mode_enabled != is_slow_mode_enabled ||
|
||||
c->is_megagroup != is_megagroup || !c->restriction_reasons.empty() || c->is_scam != is_scam) {
|
||||
if (c->is_slow_mode_enabled != is_slow_mode_enabled || c->is_megagroup != is_megagroup ||
|
||||
!c->restriction_reasons.empty() || c->is_scam != is_scam) {
|
||||
// c->has_linked_channel = has_linked_channel;
|
||||
// c->has_location = has_location;
|
||||
c->has_active_group_call = has_active_group_call;
|
||||
c->is_slow_mode_enabled = is_slow_mode_enabled;
|
||||
c->is_megagroup = is_megagroup;
|
||||
c->restriction_reasons.clear();
|
||||
@ -14129,9 +14062,7 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
|
||||
c->is_changed = true;
|
||||
need_invalidate_channel_full = true;
|
||||
}
|
||||
if (c->is_group_call_empty != is_group_call_empty || c->sign_messages != sign_messages ||
|
||||
c->is_verified != is_verified) {
|
||||
c->is_group_call_empty = is_group_call_empty;
|
||||
if (c->sign_messages != sign_messages || c->is_verified != is_verified) {
|
||||
c->sign_messages = sign_messages;
|
||||
c->is_verified = is_verified;
|
||||
|
||||
@ -14352,7 +14283,7 @@ td_api::object_ptr<td_api::updateSupergroup> ContactsManager::get_update_unknown
|
||||
ChannelId channel_id) {
|
||||
return td_api::make_object<td_api::updateSupergroup>(td_api::make_object<td_api::supergroup>(
|
||||
channel_id.get(), string(), 0, DialogParticipantStatus::Banned(0).get_chat_member_status_object(), 0, false,
|
||||
false, false, true, false, false, true, false, "", false));
|
||||
false, false, false, true, false, "", false));
|
||||
}
|
||||
|
||||
int32 ContactsManager::get_supergroup_id_object(ChannelId channel_id, const char *source) const {
|
||||
@ -14374,8 +14305,7 @@ tl_object_ptr<td_api::supergroup> ContactsManager::get_supergroup_object(Channel
|
||||
}
|
||||
return td_api::make_object<td_api::supergroup>(
|
||||
channel_id.get(), c->username, c->date, get_channel_status(c).get_chat_member_status_object(),
|
||||
c->participant_count, c->has_linked_channel, c->has_location, c->has_active_group_call,
|
||||
c->has_active_group_call ? c->is_group_call_empty : true, c->sign_messages, c->is_slow_mode_enabled,
|
||||
c->participant_count, c->has_linked_channel, c->has_location, c->sign_messages, c->is_slow_mode_enabled,
|
||||
!c->is_megagroup, c->is_verified, get_restriction_reason_description(c->restriction_reasons), c->is_scam);
|
||||
}
|
||||
|
||||
@ -14393,11 +14323,10 @@ 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(),
|
||||
td_->group_call_manager_->get_group_call_id(channel_full->active_group_call_id, DialogId(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->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,
|
||||
get_basic_group_id_object(channel_full->migrated_from_chat_id, "get_supergroup_full_info_object"),
|
||||
channel_full->migrated_from_max_message_id.get());
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FolderId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/GroupCallId.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/Location.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/net/DcId.h"
|
||||
@ -201,7 +199,6 @@ class ContactsManager : public Actor {
|
||||
void on_update_channel_slow_mode_delay(ChannelId channel_id, int32 slow_mode_delay);
|
||||
void on_update_channel_slow_mode_next_send_date(ChannelId channel_id, int32 slow_mode_next_send_date);
|
||||
void on_update_channel_is_all_history_available(ChannelId channel_id, bool is_all_history_available);
|
||||
void on_update_channel_group_call(ChannelId channel_id, bool has_active_group_call, bool is_group_call_empty);
|
||||
void on_update_channel_default_permissions(ChannelId channel_id, RestrictedRights default_permissions);
|
||||
void on_update_channel_administrator_count(ChannelId channel_id, int32 administrator_count);
|
||||
void on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date,
|
||||
@ -218,8 +215,7 @@ 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,
|
||||
bool drop_active_group_call_id = false);
|
||||
void invalidate_channel_full(ChannelId channel_id, bool drop_invite_link, bool drop_slow_mode_delay);
|
||||
|
||||
bool on_get_channel_error(ChannelId channel_id, const Status &status, const string &source);
|
||||
|
||||
@ -499,7 +495,6 @@ class ContactsManager : public Actor {
|
||||
bool get_channel_has_linked_channel(ChannelId channel_id) const;
|
||||
ChannelId get_channel_linked_channel_id(ChannelId channel_id);
|
||||
int32 get_channel_slow_mode_delay(ChannelId channel_id);
|
||||
GroupCallId get_channel_active_group_call_id(ChannelId channel_id);
|
||||
|
||||
std::pair<int32, vector<UserId>> search_among_users(const vector<UserId> &user_ids, const string &query, int32 limit);
|
||||
|
||||
@ -794,8 +789,6 @@ class ContactsManager : public Actor {
|
||||
|
||||
bool has_linked_channel = false;
|
||||
bool has_location = false;
|
||||
bool has_active_group_call = false;
|
||||
bool is_group_call_empty = false;
|
||||
bool sign_messages = false;
|
||||
bool is_slow_mode_enabled = false;
|
||||
|
||||
@ -854,8 +847,6 @@ class ContactsManager : public Actor {
|
||||
|
||||
DcId stats_dc_id;
|
||||
|
||||
InputGroupCallId active_group_call_id;
|
||||
|
||||
int32 slow_mode_delay = 0;
|
||||
int32 slow_mode_next_send_date = 0;
|
||||
|
||||
|
@ -647,10 +647,8 @@ void GroupCallManager::on_voice_chat_created(DialogId dialog_id, InputGroupCallI
|
||||
return promise.set_error(Status::Error(500, "Receive invalid group call identifier"));
|
||||
}
|
||||
|
||||
td_->contacts_manager_->on_update_channel_group_call(dialog_id.get_channel_id(), true, true);
|
||||
|
||||
// TODO
|
||||
// td_->messages_manager_->on_update_chat_group_call(dialog_id, input_group_call_id);
|
||||
td_->messages_manager_->on_update_dialog_group_call(dialog_id, true, true);
|
||||
td_->messages_manager_->on_update_dialog_group_call_id(dialog_id, input_group_call_id);
|
||||
|
||||
promise.set_value(get_group_call_id(input_group_call_id, dialog_id));
|
||||
}
|
||||
@ -1511,7 +1509,7 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
|
||||
*group_call = std::move(call);
|
||||
need_update = true;
|
||||
if (group_call->dialog_id.is_valid()) {
|
||||
td_->contacts_manager_->on_update_channel_group_call(group_call->dialog_id.get_channel_id(), false, false);
|
||||
td_->messages_manager_->on_update_dialog_group_call(group_call->dialog_id, false, false);
|
||||
}
|
||||
} else {
|
||||
auto mute_flags_changed =
|
||||
@ -1540,8 +1538,8 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
|
||||
}
|
||||
}
|
||||
if (group_call->dialog_id.is_valid()) {
|
||||
td_->contacts_manager_->on_update_channel_group_call(group_call->dialog_id.get_channel_id(), true,
|
||||
group_call->participant_count == 0);
|
||||
td_->messages_manager_->on_update_dialog_group_call(group_call->dialog_id, true,
|
||||
group_call->participant_count == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5010,6 +5010,7 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
bool has_pending_read_channel_inbox = pending_read_channel_inbox_pts != 0;
|
||||
bool has_distance = distance >= 0;
|
||||
bool has_last_yet_unsent_message = last_message_id.is_valid() && last_message_id.is_yet_unsent();
|
||||
bool has_active_group_call_id = active_group_call_id.is_valid();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(has_draft_message);
|
||||
STORE_FLAG(has_last_database_message);
|
||||
@ -5065,6 +5066,9 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_last_yet_unsent_message);
|
||||
STORE_FLAG(is_blocked);
|
||||
STORE_FLAG(is_is_blocked_inited);
|
||||
STORE_FLAG(has_active_group_call);
|
||||
STORE_FLAG(is_group_call_empty);
|
||||
STORE_FLAG(has_active_group_call_id);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
@ -5149,6 +5153,9 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
if (has_distance) {
|
||||
store(distance, storer);
|
||||
}
|
||||
if (has_active_group_call_id) {
|
||||
store(active_group_call_id, storer);
|
||||
}
|
||||
}
|
||||
|
||||
// do not forget to resolve dialog dependencies including dependencies of last_message
|
||||
@ -5178,6 +5185,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
bool has_folder_id = false;
|
||||
bool has_pending_read_channel_inbox = false;
|
||||
bool has_distance = false;
|
||||
bool has_active_group_call_id = false;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(has_draft_message);
|
||||
PARSE_FLAG(has_last_database_message);
|
||||
@ -5233,6 +5241,9 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
PARSE_FLAG(had_last_yet_unsent_message);
|
||||
PARSE_FLAG(is_blocked);
|
||||
PARSE_FLAG(is_is_blocked_inited);
|
||||
PARSE_FLAG(has_active_group_call);
|
||||
PARSE_FLAG(is_group_call_empty);
|
||||
PARSE_FLAG(has_active_group_call_id);
|
||||
END_PARSE_FLAGS();
|
||||
} else {
|
||||
is_folder_id_inited = false;
|
||||
@ -5249,6 +5260,8 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
had_last_yet_unsent_message = false;
|
||||
is_blocked = false;
|
||||
is_is_blocked_inited = false;
|
||||
has_active_group_call = false;
|
||||
is_group_call_empty = false;
|
||||
}
|
||||
|
||||
parse(last_new_message_id, parser);
|
||||
@ -5365,6 +5378,9 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
if (has_distance) {
|
||||
parse(distance, parser);
|
||||
}
|
||||
if (has_active_group_call_id) {
|
||||
parse(active_group_call_id, parser);
|
||||
}
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -6999,14 +7015,15 @@ void MessagesManager::on_user_dialog_action(DialogId dialog_id, MessageId top_th
|
||||
return;
|
||||
}
|
||||
|
||||
auto dialog_type = dialog_id.get_type();
|
||||
if (action == DialogAction::get_speaking_action()) {
|
||||
if (dialog_id.get_type() != DialogType::Channel || top_thread_message_id.is_valid()) {
|
||||
if ((dialog_type != DialogType::Chat && dialog_type != DialogType::Channel) || top_thread_message_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive " << action << " in thread of " << top_thread_message_id << " in " << dialog_id;
|
||||
return;
|
||||
}
|
||||
|
||||
auto group_call_id = td_->contacts_manager_->get_channel_active_group_call_id(dialog_id.get_channel_id());
|
||||
if (group_call_id.is_valid()) {
|
||||
const Dialog *d = get_dialog_force(dialog_id);
|
||||
if (d != nullptr && d->active_group_call_id.is_valid()) {
|
||||
auto group_call_id = td_->group_call_manager_->get_group_call_id(d->active_group_call_id, dialog_id);
|
||||
td_->group_call_manager_->on_user_speaking_in_group_call(group_call_id, user_id, date);
|
||||
}
|
||||
return;
|
||||
@ -7026,7 +7043,6 @@ void MessagesManager::on_user_dialog_action(DialogId dialog_id, MessageId top_th
|
||||
td_->contacts_manager_->on_update_user_local_was_online(user_id, date);
|
||||
}
|
||||
|
||||
auto dialog_type = dialog_id.get_type();
|
||||
if (dialog_type == DialogType::User || dialog_type == DialogType::SecretChat) {
|
||||
if (!td_->contacts_manager_->is_user_bot(user_id) && !td_->contacts_manager_->is_user_status_exact(user_id) &&
|
||||
!get_dialog(dialog_id)->is_opened && !is_canceled) {
|
||||
@ -7952,6 +7968,30 @@ void MessagesManager::remove_dialog_action_bar(DialogId dialog_id, Promise<Unit>
|
||||
change_dialog_report_spam_state_on_server(dialog_id, false, 0, std::move(promise));
|
||||
}
|
||||
|
||||
void MessagesManager::repair_dialog_active_group_call_id(DialogId dialog_id) {
|
||||
if (have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
create_actor<SleepActor>("RepairChatActiveVoiceChatId", 1.0,
|
||||
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id](Result<Unit> result) {
|
||||
send_closure(actor_id, &MessagesManager::do_repair_dialog_active_group_call_id,
|
||||
dialog_id);
|
||||
}))
|
||||
.release();
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::do_repair_dialog_active_group_call_id(DialogId dialog_id) {
|
||||
Dialog *d = get_dialog(dialog_id);
|
||||
CHECK(d != nullptr);
|
||||
if (!d->has_active_group_call || d->active_group_call_id.is_valid()) {
|
||||
return;
|
||||
}
|
||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
return;
|
||||
}
|
||||
|
||||
reload_dialog_info_full(dialog_id);
|
||||
}
|
||||
|
||||
class MessagesManager::ChangeDialogReportSpamStateOnServerLogEvent {
|
||||
public:
|
||||
DialogId dialog_id_;
|
||||
@ -19335,6 +19375,8 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
||||
// TODO hide/show draft message when can_send_message(dialog_id) changes
|
||||
auto draft_message = can_send_message(d->dialog_id).is_ok() ? get_draft_message_object(d->draft_message) : nullptr;
|
||||
|
||||
auto active_group_call_id = td_->group_call_manager_->get_group_call_id(d->active_group_call_id, d->dialog_id);
|
||||
|
||||
return make_tl_object<td_api::chat>(
|
||||
d->dialog_id.get(), get_chat_type_object(d->dialog_id), get_dialog_title(d->dialog_id),
|
||||
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
||||
@ -19345,6 +19387,7 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
||||
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
|
||||
d->last_read_outbox_message_id.get(), d->unread_mention_count,
|
||||
get_chat_notification_settings_object(&d->notification_settings), get_chat_action_bar_object(d),
|
||||
active_group_call_id.get(), active_group_call_id.is_valid() ? d->is_group_call_empty : true,
|
||||
d->reply_markup_message_id.get(), std::move(draft_message), d->client_data);
|
||||
}
|
||||
|
||||
@ -27781,6 +27824,20 @@ void MessagesManager::send_update_chat_action_bar(const Dialog *d) {
|
||||
send_update_secret_chats_with_user_action_bar(d);
|
||||
}
|
||||
|
||||
void MessagesManager::send_update_chat_voice_chat(const Dialog *d) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK(d != nullptr);
|
||||
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_voice_chat";
|
||||
on_dialog_updated(d->dialog_id, "send_update_chat_voice_chat");
|
||||
auto group_call_id = td_->group_call_manager_->get_group_call_id(d->active_group_call_id, d->dialog_id);
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateChatVoiceChat>(d->dialog_id.get(), group_call_id.get(),
|
||||
d->is_group_call_empty));
|
||||
}
|
||||
|
||||
void MessagesManager::send_update_chat_has_scheduled_messages(Dialog *d, bool from_deletion) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
@ -28914,6 +28971,71 @@ void MessagesManager::do_set_dialog_folder_id(Dialog *d, FolderId folder_id) {
|
||||
on_dialog_updated(d->dialog_id, "do_set_dialog_folder_id");
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_group_call(DialogId dialog_id, bool has_active_group_call,
|
||||
bool is_group_call_empty) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK(dialog_id.is_valid());
|
||||
Dialog *d = get_dialog(dialog_id); // must not create the Dialog, because is called from on_get_chat
|
||||
if (d == nullptr) {
|
||||
pending_dialog_group_call_updates_[dialog_id] = {has_active_group_call, is_group_call_empty};
|
||||
return;
|
||||
}
|
||||
|
||||
if (!has_active_group_call) {
|
||||
is_group_call_empty = false;
|
||||
}
|
||||
if (d->has_active_group_call == has_active_group_call && d->is_group_call_empty == is_group_call_empty) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->has_active_group_call && !has_active_group_call && d->active_group_call_id.is_valid()) {
|
||||
d->active_group_call_id = InputGroupCallId();
|
||||
d->has_active_group_call = false;
|
||||
d->is_group_call_empty = false;
|
||||
send_update_chat_voice_chat(d);
|
||||
} else if (d->has_active_group_call && has_active_group_call) {
|
||||
d->is_group_call_empty = is_group_call_empty;
|
||||
send_update_chat_voice_chat(d);
|
||||
} else {
|
||||
d->has_active_group_call = has_active_group_call;
|
||||
d->is_group_call_empty = is_group_call_empty;
|
||||
on_dialog_updated(dialog_id, "on_update_dialog_group_call");
|
||||
|
||||
if (has_active_group_call && !d->active_group_call_id.is_valid()) {
|
||||
repair_dialog_active_group_call_id(dialog_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_group_call_id(DialogId dialog_id, InputGroupCallId input_group_call_id) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto d = get_dialog_force(dialog_id);
|
||||
if (d == nullptr) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->active_group_call_id != input_group_call_id) {
|
||||
d->active_group_call_id = input_group_call_id;
|
||||
bool has_active_group_call = input_group_call_id.is_valid();
|
||||
if (has_active_group_call != d->has_active_group_call) {
|
||||
LOG(ERROR) << "Receive invalid has_active_group_call flag " << d->has_active_group_call << ", but have "
|
||||
<< input_group_call_id << " in " << dialog_id;
|
||||
d->has_active_group_call = has_active_group_call;
|
||||
if (!has_active_group_call) {
|
||||
d->is_group_call_empty = false;
|
||||
}
|
||||
}
|
||||
send_update_chat_voice_chat(d);
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_filters() {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
// just in case
|
||||
@ -33074,6 +33196,20 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr<Dialog> &&d,
|
||||
if (d->mention_notification_group.group_id.is_valid()) {
|
||||
notification_group_id_to_dialog_id_.emplace(d->mention_notification_group.group_id, d->dialog_id);
|
||||
}
|
||||
if (pending_dialog_group_call_updates_.count(dialog_id) > 0) {
|
||||
auto it = pending_dialog_group_call_updates_.find(dialog_id);
|
||||
bool has_active_group_call = it->second.first;
|
||||
bool is_group_call_empty = it->second.second;
|
||||
pending_dialog_group_call_updates_.erase(it);
|
||||
if (d->has_active_group_call != has_active_group_call || d->is_group_call_empty != is_group_call_empty) {
|
||||
if (!has_active_group_call) {
|
||||
d->active_group_call_id = InputGroupCallId();
|
||||
}
|
||||
d->has_active_group_call = has_active_group_call;
|
||||
d->is_group_call_empty = is_group_call_empty;
|
||||
on_dialog_updated(dialog_id, "pending update_dialog_group_call");
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_loaded_from_database) {
|
||||
CHECK(order == DEFAULT_ORDER);
|
||||
@ -33139,6 +33275,9 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
|
||||
// asynchronously get action bar from the server
|
||||
reget_dialog_action_bar(dialog_id, "fix_new_dialog");
|
||||
}
|
||||
if (d->has_active_group_call && !d->active_group_call_id.is_valid()) {
|
||||
repair_dialog_active_group_call_id(dialog_id);
|
||||
}
|
||||
|
||||
if (d->notification_settings.is_synchronized && !d->notification_settings.is_use_default_fixed &&
|
||||
have_input_peer(dialog_id, AccessRights::Read) && !td_->auth_manager_->is_bot()) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/InputDialogId.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/logevent/LogEventHelper.h"
|
||||
#include "td/telegram/MessageContentType.h"
|
||||
#include "td/telegram/MessageCopyOptions.h"
|
||||
@ -332,6 +333,10 @@ class MessagesManager : public Actor {
|
||||
|
||||
void on_update_dialog_folder_id(DialogId dialog_id, FolderId folder_id);
|
||||
|
||||
void on_update_dialog_group_call(DialogId dialog_id, bool has_active_group_call, bool is_group_call_empty);
|
||||
|
||||
void on_update_dialog_group_call_id(DialogId dialog_id, InputGroupCallId input_group_call_id);
|
||||
|
||||
void on_update_dialog_filters();
|
||||
|
||||
void on_update_service_notification(tl_object_ptr<telegram_api::updateServiceNotification> &&update,
|
||||
@ -1192,6 +1197,7 @@ class MessagesManager : public Actor {
|
||||
std::unordered_map<int64, LogEventIdWithGeneration> read_history_log_event_ids;
|
||||
std::unordered_set<MessageId, MessageIdHash> updated_read_history_message_ids;
|
||||
LogEventIdWithGeneration set_folder_id_log_event_id;
|
||||
InputGroupCallId active_group_call_id;
|
||||
|
||||
FolderId folder_id;
|
||||
vector<DialogListId> dialog_list_ids; // TODO replace with mask
|
||||
@ -1263,6 +1269,8 @@ class MessagesManager : public Actor {
|
||||
bool has_loaded_scheduled_messages_from_database = false;
|
||||
bool sent_scheduled_messages = false;
|
||||
bool had_last_yet_unsent_message = false; // whether the dialog was stored to database without last message
|
||||
bool has_active_group_call = false;
|
||||
bool is_group_call_empty = false;
|
||||
|
||||
bool increment_view_counter = false;
|
||||
|
||||
@ -2244,6 +2252,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
void send_update_chat_action_bar(const Dialog *d);
|
||||
|
||||
void send_update_chat_voice_chat(const Dialog *d);
|
||||
|
||||
void send_update_chat_has_scheduled_messages(Dialog *d, bool from_deletion);
|
||||
|
||||
void send_update_user_chat_action(DialogId dialog_id, MessageId top_thread_message_id, UserId user_id,
|
||||
@ -2253,6 +2263,10 @@ class MessagesManager : public Actor {
|
||||
|
||||
void hide_dialog_action_bar(Dialog *d);
|
||||
|
||||
void repair_dialog_active_group_call_id(DialogId dialog_id);
|
||||
|
||||
void do_repair_dialog_active_group_call_id(DialogId dialog_id);
|
||||
|
||||
static Result<int32> get_message_schedule_date(td_api::object_ptr<td_api::MessageSchedulingState> &&scheduling_state);
|
||||
|
||||
tl_object_ptr<td_api::MessageSendingState> get_message_sending_state_object(const Message *m) const;
|
||||
@ -3278,6 +3292,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
std::unordered_map<DialogId, OnlineMemberCountInfo, DialogIdHash> dialog_online_member_counts_;
|
||||
|
||||
std::unordered_map<DialogId, std::pair<bool, bool>, DialogIdHash> pending_dialog_group_call_updates_;
|
||||
|
||||
std::unordered_map<string, int32> auth_notification_id_date_;
|
||||
|
||||
std::unordered_map<DialogId, MessageId, DialogIdHash> previous_repaired_read_inbox_max_message_id_;
|
||||
|
@ -1359,6 +1359,7 @@ vector<td_api::object_ptr<td_api::closedVectorPath>> StickersManager::get_sticke
|
||||
|
||||
CHECK(!sb.is_error());
|
||||
path = sb.as_cslice();
|
||||
LOG(DEBUG) << "Transform SVG path " << path;
|
||||
|
||||
size_t pos = 0;
|
||||
auto skip_commas = [&path, &pos] {
|
||||
|
Loading…
Reference in New Issue
Block a user