2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-10-05 13:36:18 +00:00

Fix missing messages when forwarding to open chat

This commit is contained in:
RadRussianRus
2021-04-06 06:56:17 +03:00
parent 8d0b9ce1b5
commit 74cd006cac
6 changed files with 156 additions and 90 deletions

View File

@@ -122,20 +122,18 @@ void SendExistingMedia(
session->data().registerMessageRandomId(randomId, newId);
if (!forwarding) {
history->addNewLocalMessage(
newId.msg,
flags,
clientFlags,
0,
replyTo,
HistoryItem::NewMessageDate(message.action.options.scheduled),
messageFromId,
messagePostAuthor,
media,
caption,
MTPReplyMarkup());
}
history->addNewLocalMessage(
newId.msg,
flags,
clientFlags,
0,
replyTo,
HistoryItem::NewMessageDate(message.action.options.scheduled),
messageFromId,
messagePostAuthor,
media,
caption,
MTPReplyMarkup());
auto performRequest = [=](const auto &repeatRequest) -> void {
auto &histories = history->owner().histories();
@@ -301,36 +299,34 @@ bool SendDice(
session->data().registerMessageRandomId(randomId, newId);
if (!forwarding) {
const auto views = 1;
const auto forwards = 0;
history->addNewMessage(
MTP_message(
MTP_flags(flags),
MTP_int(newId.msg),
peerToMTP(messageFromId),
peerToMTP(history->peer->id),
MTPMessageFwdHeader(),
MTPint(), // via_bot_id
replyHeader,
MTP_int(HistoryItem::NewMessageDate(
message.action.options.scheduled)),
MTP_string(),
MTP_messageMediaDice(MTP_int(0), MTP_string(emoji)),
MTPReplyMarkup(),
MTP_vector<MTPMessageEntity>(),
MTP_int(views),
MTP_int(forwards),
MTPMessageReplies(),
MTPint(), // edit_date
MTP_string(messagePostAuthor),
MTPlong(),
//MTPMessageReactions(),
MTPVector<MTPRestrictionReason>(),
MTPint()), // ttl_period
clientFlags,
NewMessageType::Unread);
}
const auto views = 1;
const auto forwards = 0;
history->addNewMessage(
MTP_message(
MTP_flags(flags),
MTP_int(newId.msg),
peerToMTP(messageFromId),
peerToMTP(history->peer->id),
MTPMessageFwdHeader(),
MTPint(), // via_bot_id
replyHeader,
MTP_int(HistoryItem::NewMessageDate(
message.action.options.scheduled)),
MTP_string(),
MTP_messageMediaDice(MTP_int(0), MTP_string(emoji)),
MTPReplyMarkup(),
MTP_vector<MTPMessageEntity>(),
MTP_int(views),
MTP_int(forwards),
MTPMessageReplies(),
MTPint(), // edit_date
MTP_string(messagePostAuthor),
MTPlong(),
//MTPMessageReactions(),
MTPVector<MTPRestrictionReason>(),
MTPint()), // ttl_period
clientFlags,
NewMessageType::Unread);
const auto requestType = Data::Histories::RequestType::Send;
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {