Better name for has_scheduled_messages.

GitOrigin-RevId: 8563f78409e3142baa21ac70f6c5bdeb1728c274
This commit is contained in:
levlam 2019-12-04 20:51:52 +03:00
parent 7bd137889b
commit bf0bc88e19
3 changed files with 27 additions and 24 deletions

View File

@ -8142,7 +8142,7 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
}
td_->messages_manager_->on_update_dialog_folder_id(DialogId(user_id), folder_id);
}
td_->messages_manager_->on_update_dialog_has_scheduled_messages(
td_->messages_manager_->on_update_dialog_has_scheduled_server_messages(
DialogId(user_id), (user_full->flags_ & USER_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
UserFull *user = add_user_full(user_id);
@ -8362,7 +8362,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
}
td_->messages_manager_->on_update_dialog_folder_id(DialogId(chat_id), folder_id);
}
td_->messages_manager_->on_update_dialog_has_scheduled_messages(
td_->messages_manager_->on_update_dialog_has_scheduled_server_messages(
DialogId(chat_id), (chat_full->flags_ & CHAT_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
ChatFull *chat = add_chat_full(chat_id);
@ -8504,7 +8504,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
}
td_->messages_manager_->on_update_dialog_folder_id(DialogId(channel_id), folder_id);
}
td_->messages_manager_->on_update_dialog_has_scheduled_messages(
td_->messages_manager_->on_update_dialog_has_scheduled_server_messages(
DialogId(channel_id), (channel_full->flags_ & CHANNEL_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
if (participant_count >= 190) {

View File

@ -4306,7 +4306,7 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
STORE_FLAG(can_block_user);
STORE_FLAG(can_share_phone_number);
STORE_FLAG(can_report_location);
STORE_FLAG(has_scheduled_messages);
STORE_FLAG(has_scheduled_server_messages);
END_STORE_FLAGS();
}
@ -4465,7 +4465,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
PARSE_FLAG(can_block_user);
PARSE_FLAG(can_share_phone_number);
PARSE_FLAG(can_report_location);
PARSE_FLAG(has_scheduled_messages);
PARSE_FLAG(has_scheduled_server_messages);
END_PARSE_FLAGS();
} else {
is_folder_id_inited = false;
@ -14921,13 +14921,14 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
}
}
bool has_scheduled_messages = d->has_scheduled_server_messages || d->scheduled_messages != nullptr;
return make_tl_object<td_api::chat>(
d->dialog_id.get(), get_chat_type_object(d->dialog_id), get_chat_list_object(d), get_dialog_title(d->dialog_id),
get_chat_photo_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
get_dialog_permissions(d->dialog_id).get_chat_permissions_object(),
get_message_object(d->dialog_id, get_message(d, d->last_message_id)), get_dialog_public_order(d),
d->pinned_order != DEFAULT_ORDER, d->is_marked_as_unread, d->order == SPONSORED_DIALOG_ORDER,
d->has_scheduled_messages, can_delete_for_self, can_delete_for_all_users, can_report_dialog(d->dialog_id),
has_scheduled_messages, can_delete_for_self, can_delete_for_all_users, can_report_dialog(d->dialog_id),
d->notification_settings.silent_send_message, 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),
@ -16871,7 +16872,7 @@ vector<MessageId> MessagesManager::get_dialog_scheduled_messages(DialogId dialog
}
auto hash = get_vector_hash(numbers);
// TODO reload synchronously, if there is no known server messages and (has_scheduled_messages == true or
// TODO reload synchronously, if there is no known server messages and (has_scheduled_server_messages == true or
// d->scheduled_messages_sync_generation == 0 && !G()->parameters().use_message_db)
load_dialog_scheduled_messages(dialog_id, false, hash, Promise<Unit>());
}
@ -16895,8 +16896,6 @@ void MessagesManager::load_dialog_scheduled_messages(DialogId dialog_id, bool fr
}
} else {
// TODO reload scheduled messages from server
// reload synchronously, if there is no known server messages and (has_scheduled_messages == true or
// d->scheduled_messages_sync_generation == 0 && !G()->parameters().use_message_db)
}
}
@ -22901,9 +22900,10 @@ void MessagesManager::set_dialog_pinned_message_id(Dialog *d, MessageId pinned_m
make_tl_object<td_api::updateChatPinnedMessage>(d->dialog_id.get(), pinned_message_id.get()));
}
void MessagesManager::on_update_dialog_has_scheduled_messages(DialogId dialog_id, bool has_scheduled_messages) {
void MessagesManager::on_update_dialog_has_scheduled_server_messages(DialogId dialog_id,
bool has_scheduled_server_messages) {
if (!dialog_id.is_valid()) {
LOG(ERROR) << "Receive has_scheduled_messages in invalid " << dialog_id;
LOG(ERROR) << "Receive has_scheduled_server_messages in invalid " << dialog_id;
return;
}
@ -22913,21 +22913,24 @@ void MessagesManager::on_update_dialog_has_scheduled_messages(DialogId dialog_id
return;
}
if (d->has_scheduled_messages != has_scheduled_messages) {
set_dialog_has_scheduled_messages(d, has_scheduled_messages);
if (d->has_scheduled_server_messages != has_scheduled_server_messages) {
set_dialog_has_scheduled_server_messages(d, has_scheduled_server_messages);
}
}
void MessagesManager::set_dialog_has_scheduled_messages(Dialog *d, bool has_scheduled_messages) {
void MessagesManager::set_dialog_has_scheduled_server_messages(Dialog *d, bool has_scheduled_server_messages) {
CHECK(d != nullptr);
CHECK(d->has_scheduled_messages != has_scheduled_messages);
d->has_scheduled_messages = has_scheduled_messages;
on_dialog_updated(d->dialog_id, "set_dialog_has_scheduled_messages");
CHECK(d->has_scheduled_server_messages != has_scheduled_server_messages);
d->has_scheduled_server_messages = has_scheduled_server_messages;
on_dialog_updated(d->dialog_id, "set_dialog_has_scheduled_server_messages");
LOG(INFO) << "Set " << d->dialog_id << " has_scheduled_messages to " << has_scheduled_messages;
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_has_scheduled_messages";
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatHasScheduledMessages>(d->dialog_id.get(), has_scheduled_messages));
LOG(INFO) << "Set " << d->dialog_id << " has_scheduled_server_messages to " << has_scheduled_server_messages;
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_has_scheduled_server_messages";
if (d->scheduled_messages == nullptr) {
send_closure(
G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatHasScheduledMessages>(d->dialog_id.get(), has_scheduled_server_messages));
}
}
void MessagesManager::on_update_dialog_folder_id(DialogId dialog_id, FolderId folder_id) {

View File

@ -283,7 +283,7 @@ class MessagesManager : public Actor {
void on_update_dialog_pinned_message_id(DialogId dialog_id, MessageId pinned_message_id);
void on_update_dialog_has_scheduled_messages(DialogId dialog_id, bool has_scheduled_messages);
void on_update_dialog_has_scheduled_server_messages(DialogId dialog_id, bool has_scheduled_server_messages);
void on_update_dialog_folder_id(DialogId dialog_id, FolderId folder_id);
@ -1089,7 +1089,7 @@ class MessagesManager : public Actor {
bool is_folder_id_inited = false;
bool need_repair_server_unread_count = false;
bool is_marked_as_unread = false;
bool has_scheduled_messages = false;
bool has_scheduled_server_messages = false;
bool has_loaded_scheduled_messages_from_database = false;
bool increment_view_counter = false;
@ -1926,7 +1926,7 @@ class MessagesManager : public Actor {
void set_dialog_pinned_message_id(Dialog *d, MessageId pinned_message_id);
void set_dialog_has_scheduled_messages(Dialog *d, bool has_scheduled_messages);
void set_dialog_has_scheduled_server_messages(Dialog *d, bool has_scheduled_server_messages);
void set_dialog_folder_id(Dialog *d, FolderId folder_id);