Make remaining OrderedMessage fields private.

This commit is contained in:
levlam 2023-05-03 12:59:10 +03:00
parent 4b048c4bbf
commit bba924f6a9
2 changed files with 11 additions and 7 deletions

View File

@ -10071,7 +10071,7 @@ void MessagesManager::on_get_history(DialogId dialog_id, MessageId from_message_
CHECK(d->first_database_message_id.is_valid()); CHECK(d->first_database_message_id.is_valid());
{ {
auto it = d->ordered_messages.get_const_iterator(d->first_database_message_id); auto it = d->ordered_messages.get_const_iterator(d->first_database_message_id);
if (*it != nullptr && ((*it)->get_message_id() == d->first_database_message_id || (*it)->have_next_)) { if (*it != nullptr && ((*it)->get_message_id() == d->first_database_message_id || (*it)->have_next())) {
MessageId new_first_database_message_id = d->first_database_message_id; MessageId new_first_database_message_id = d->first_database_message_id;
while (*it != nullptr) { while (*it != nullptr) {
auto message_id = (*it)->get_message_id(); auto message_id = (*it)->get_message_id();
@ -10088,7 +10088,7 @@ void MessagesManager::on_get_history(DialogId dialog_id, MessageId from_message_
} }
{ {
auto it = d->ordered_messages.get_const_iterator(d->last_database_message_id); auto it = d->ordered_messages.get_const_iterator(d->last_database_message_id);
if (*it != nullptr && ((*it)->get_message_id() == d->last_database_message_id || (*it)->have_next_)) { if (*it != nullptr && ((*it)->get_message_id() == d->last_database_message_id || (*it)->have_next())) {
MessageId new_last_database_message_id = d->last_database_message_id; MessageId new_last_database_message_id = d->last_database_message_id;
while (*it != nullptr) { while (*it != nullptr) {
auto message_id = (*it)->get_message_id(); auto message_id = (*it)->get_message_id();
@ -16205,7 +16205,7 @@ void MessagesManager::fix_dialog_last_notification_id(Dialog *d, bool from_menti
auto &group_info = get_notification_group_info(d, from_mentions); auto &group_info = get_notification_group_info(d, from_mentions);
VLOG(notifications) << "Trying to fix last notification identifier in " << group_info.group_id << " from " VLOG(notifications) << "Trying to fix last notification identifier in " << group_info.group_id << " from "
<< d->dialog_id << " from " << message_id << "/" << group_info.last_notification_id; << d->dialog_id << " from " << message_id << "/" << group_info.last_notification_id;
if (*it != nullptr && ((*it)->get_message_id() == message_id || (*it)->have_next_)) { if (*it != nullptr && ((*it)->get_message_id() == message_id || (*it)->have_next())) {
while (*it != nullptr) { while (*it != nullptr) {
const Message *m = get_message(d, (*it)->get_message_id()); const Message *m = get_message(d, (*it)->get_message_id());
if (is_from_mention_notification_group(m) == from_mentions && m->notification_id.is_valid() && if (is_from_mention_notification_group(m) == from_mentions && m->notification_id.is_valid() &&
@ -21036,7 +21036,7 @@ tl_object_ptr<td_api::messages> MessagesManager::get_dialog_history(DialogId dia
} }
} else if ((*p)->get_message_id() != from_message_id) { } else if ((*p)->get_message_id() != from_message_id) {
CHECK((*p)->get_message_id() < from_message_id); CHECK((*p)->get_message_id() < from_message_id);
if (!(*p)->have_next_ && (d->last_message_id == MessageId() || (*p)->get_message_id() < d->last_message_id)) { if (!(*p)->have_next() && (d->last_message_id == MessageId() || (*p)->get_message_id() < d->last_message_id)) {
have_a_gap = true; have_a_gap = true;
} }
} }
@ -22761,7 +22761,7 @@ int64 MessagesManager::get_dialog_message_by_date(DialogId dialog_id, int32 date
auto message_id = d->ordered_messages.find_message_by_date(date, get_get_message_date(d)); auto message_id = d->ordered_messages.find_message_by_date(date, get_get_message_date(d));
if (message_id.is_valid() && if (message_id.is_valid() &&
(message_id == d->last_message_id || (*d->ordered_messages.get_const_iterator(message_id))->have_next_)) { (message_id == d->last_message_id || (*d->ordered_messages.get_const_iterator(message_id))->have_next())) {
get_dialog_message_by_date_results_[random_id] = {dialog_id, message_id}; get_dialog_message_by_date_results_[random_id] = {dialog_id, message_id};
promise.set_value(Unit()); promise.set_value(Unit());
return random_id; return random_id;

View File

@ -20,12 +20,16 @@ class OrderedMessage {
return message_id_; return message_id_;
} }
bool have_previous_ = false; bool have_next() const {
bool have_next_ = false; return have_next_;
}
private: private:
int32 random_y_ = 0; int32 random_y_ = 0;
bool have_previous_ = false;
bool have_next_ = false;
MessageId message_id_; MessageId message_id_;
unique_ptr<OrderedMessage> left_; unique_ptr<OrderedMessage> left_;