Add MessageOrigin::add_dependencies.

This commit is contained in:
levlam 2023-10-09 18:56:21 +03:00
parent c86d4d1036
commit c05b5ba3e5
3 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include "td/telegram/ChannelId.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h"
@ -102,6 +103,11 @@ bool MessageOrigin::is_sender_hidden() const {
return sender_dialog_id_ == hidden_sender_dialog_id && !author_signature_.empty() && !message_id_.is_valid();
}
void MessageOrigin::add_dependencies(Dependencies &dependencies) const {
dependencies.add(sender_user_id_);
dependencies.add_dialog_and_dependencies(sender_dialog_id_);
}
bool operator==(const MessageOrigin &lhs, const MessageOrigin &rhs) {
return lhs.sender_user_id_ == rhs.sender_user_id_ && lhs.sender_dialog_id_ == rhs.sender_dialog_id_ &&
lhs.message_id_ == rhs.message_id_ && lhs.author_signature_ == rhs.author_signature_ &&

View File

@ -18,6 +18,8 @@
namespace td {
class Dependencies;
class Td;
struct MessageOrigin {
@ -49,6 +51,8 @@ struct MessageOrigin {
return message_id_.is_valid();
}
void add_dependencies(Dependencies &dependencies) const;
friend bool operator==(const MessageOrigin &lhs, const MessageOrigin &rhs);
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageOrigin &origin);

View File

@ -24648,8 +24648,7 @@ void MessagesManager::add_message_dependencies(Dependencies &dependencies, const
dependencies.add_dialog_and_dependencies(m->real_forward_from_dialog_id);
dependencies.add(m->via_bot_user_id);
if (m->forward_info != nullptr) {
dependencies.add(m->forward_info->origin.sender_user_id_);
dependencies.add_dialog_and_dependencies(m->forward_info->origin.sender_dialog_id_);
m->forward_info->origin.add_dependencies(dependencies);
dependencies.add_dialog_and_dependencies(m->forward_info->from_dialog_id);
}
for (const auto &replier_min_channel : m->reply_info.replier_min_channels_) {