mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 11:52:58 +00:00
Merge tag 'v7.0.4' into dev
This commit is contained in:
@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_histories.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "data/components/ephemeral_messages.h"
|
||||
#include "data/stickers/data_stickers.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
@@ -79,6 +80,28 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
|
||||
action.generateLocal = false;
|
||||
api->sendAction(action);
|
||||
|
||||
if (!action.options.scheduled
|
||||
&& !action.options.shortcutId
|
||||
&& session->ephemeralMessages().sendSimpleMedia(
|
||||
history,
|
||||
action.replyTo,
|
||||
inputMedia)) {
|
||||
api->finishForwarding(action);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action.replyTo.messageId
|
||||
&& !IsServerMsgId(action.replyTo.messageId.msg)
|
||||
&& !session->data().message(action.replyTo.messageId)) {
|
||||
action.replyTo = {
|
||||
.messageId = (action.replyTo.topicRootId
|
||||
? FullMsgId(peer->id, action.replyTo.topicRootId)
|
||||
: FullMsgId()),
|
||||
.topicRootId = action.replyTo.topicRootId,
|
||||
.monoforumPeerId = action.replyTo.monoforumPeerId,
|
||||
};
|
||||
}
|
||||
|
||||
const auto randomId = base::RandomValue<uint64>();
|
||||
|
||||
auto flags = NewMessageFlags(peer);
|
||||
@@ -189,6 +212,14 @@ void SendExistingMedia(
|
||||
flags |= MessageFlag::HasReplyInfo;
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||
}
|
||||
if (!action.options.scheduled
|
||||
&& !action.options.shortcutId
|
||||
&& session->ephemeralMessages().wouldSendMedia(
|
||||
peer,
|
||||
action.replyTo,
|
||||
message.textWithTags.text)) {
|
||||
flags |= MessageFlag::Ephemeral;
|
||||
}
|
||||
const auto silentPost = ShouldSendSilent(peer, action.options);
|
||||
InnerFillMessagePostFlags(action.options, peer, flags);
|
||||
if (silentPost) {
|
||||
@@ -243,12 +274,13 @@ void SendExistingMedia(
|
||||
|
||||
session->data().registerMessageRandomId(randomId, newId);
|
||||
|
||||
history->addNewLocalMessage({
|
||||
const auto item = history->addNewLocalMessage({
|
||||
.id = newId.msg,
|
||||
.flags = flags,
|
||||
.from = NewMessageFromId(action),
|
||||
.replyTo = action.replyTo,
|
||||
.date = NewMessageDate(action.options),
|
||||
.scheduleRepeatPeriod = action.options.scheduleRepeatPeriod,
|
||||
.shortcutId = action.options.shortcutId,
|
||||
.starsPaid = starsPaid,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
@@ -257,6 +289,15 @@ void SendExistingMedia(
|
||||
.mediaSpoiler = action.options.mediaSpoiler,
|
||||
}, media, caption);
|
||||
|
||||
if (session->ephemeralMessages().sendMedia(
|
||||
item,
|
||||
inputMedia(),
|
||||
origin,
|
||||
inputMedia)) {
|
||||
api->finishForwarding(action);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto performRequest = [=](const auto &repeatRequest) -> void {
|
||||
auto &histories = history->owner().histories();
|
||||
const auto session = &history->session();
|
||||
@@ -475,6 +516,7 @@ bool SendDice(MessageToSend &message) {
|
||||
.from = NewMessageFromId(action),
|
||||
.replyTo = action.replyTo,
|
||||
.date = NewMessageDate(action.options),
|
||||
.scheduleRepeatPeriod = action.options.scheduleRepeatPeriod,
|
||||
.shortcutId = action.options.shortcutId,
|
||||
.starsPaid = starsPaid,
|
||||
.postAuthor = NewMessagePostAuthor(action),
|
||||
@@ -638,6 +680,16 @@ void SendConfirmedFile(
|
||||
if (file->to.replyTo) {
|
||||
flags |= MessageFlag::HasReplyInfo;
|
||||
}
|
||||
if (!isEditing
|
||||
&& !groupId
|
||||
&& !file->to.options.scheduled
|
||||
&& !file->to.options.shortcutId
|
||||
&& session->ephemeralMessages().wouldSendMedia(
|
||||
peer,
|
||||
file->to.replyTo,
|
||||
caption.text)) {
|
||||
flags |= MessageFlag::Ephemeral;
|
||||
}
|
||||
FillMessagePostFlags(action, peer, flags);
|
||||
if (file->to.options.scheduled) {
|
||||
flags |= MessageFlag::IsOrWasScheduled;
|
||||
@@ -734,6 +786,7 @@ void SendConfirmedFile(
|
||||
.from = NewMessageFromId(action),
|
||||
.replyTo = file->to.replyTo,
|
||||
.date = NewMessageDate(file->to.options),
|
||||
.scheduleRepeatPeriod = file->to.options.scheduleRepeatPeriod,
|
||||
.shortcutId = file->to.options.shortcutId,
|
||||
.starsPaid = std::min(
|
||||
history->peer->starsPerMessageChecked(),
|
||||
|
||||
Reference in New Issue
Block a user