Store identifier of inaccessible pinned message.

This commit is contained in:
levlam 2023-12-04 15:32:17 +03:00
parent 6fdb4d2416
commit 83a49569ab
2 changed files with 5 additions and 9 deletions

View File

@ -896,9 +896,9 @@ class Client::JsonChat final : public td::Jsonable {
int64 pinned_message_id_;
};
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 {
@ -2557,6 +2557,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;
@ -2838,7 +2839,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_);
@ -11745,11 +11746,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

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