Store identifier of inaccessible pinned message.

This commit is contained in:
levlam 2023-12-04 15:32:17 +03:00 committed by David Guillen Fandos
parent e6e6cbc72f
commit 3161f9a00b
2 changed files with 5 additions and 9 deletions

View File

@ -998,9 +998,9 @@ class Client::JsonChat final : public td::Jsonable {
int32 distance_;
};
class Client::JsonDeletedMessage final : public td::Jsonable {
class Client::JsonInaccessibleMessage final : public td::Jsonable {
public:
JsonDeletedMessage(int64 chat_id, int64 message_id, const Client *client)
JsonInaccessibleMessage(int64 chat_id, int64 message_id, const Client *client)
: chat_id_(chat_id), message_id_(message_id), client_(client) {
}
void store(td::JsonValueScope *scope) const {
@ -2675,6 +2675,7 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
object("pinned_message", JsonMessage(pinned_message, false, "pin in " + source_, client_));
} else if (need_reply_) {
LOG(INFO) << "Pinned unknown, inaccessible or deleted message " << message_id;
object("pinned_message", JsonInaccessibleMessage(message_->chat_id, message_id, client_));
}
}
break;
@ -2956,7 +2957,7 @@ class Client::JsonCallbackQuery final : public td::Jsonable {
if (message_info_ != nullptr) {
object("message", JsonMessage(message_info_, true, "callback query", client_));
} else {
object("message", JsonDeletedMessage(chat_id_, message_id_, client_));
object("message", JsonInaccessibleMessage(chat_id_, message_id_, client_));
}
object("chat_instance", td::to_string(chat_instance_));
client_->json_store_callback_query_payload(object, payload_);
@ -13144,11 +13145,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
if (pinned_message_id <= 0) {
return true;
}
const MessageInfo *pinned_message = get_message(chat_id, pinned_message_id, true);
if (pinned_message == nullptr) {
LOG(INFO) << "Pinned unknown, inaccessible or deleted message " << pinned_message_id << " in " << chat_id;
return true;
}
break;
}
case td_api::messageProximityAlertTriggered::ID: {

View File

@ -144,7 +144,7 @@ class Client final : public WebhookActor::Callback {
class JsonReplyMarkup;
class JsonMessage;
class JsonMessages;
class JsonDeletedMessage;
class JsonInaccessibleMessage;
class JsonMessageId;
class JsonInlineQuery;
class JsonChosenInlineResult;