mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
parent
5a3733b5b6
commit
cd506dfff5
2 changed files with 27 additions and 17 deletions
|
@ -374,18 +374,22 @@ MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer) {
|
|||
return result;
|
||||
}
|
||||
|
||||
MsgId LookupReplyToTop(not_null<History*> history, MsgId replyToId) {
|
||||
const auto &owner = history->owner();
|
||||
if (const auto item = owner.message(history->channelId(), replyToId)) {
|
||||
return item->replyToTop();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) {
|
||||
if (const auto id = action.replyTo) {
|
||||
const auto history = action.history;
|
||||
const auto &owner = history->owner();
|
||||
if (const auto item = owner.message(history->channelId(), id)) {
|
||||
if (item->replyToId()) {
|
||||
return MTP_messageReplyHeader(
|
||||
MTP_flags(MTPDmessageReplyHeader::Flag::f_reply_to_top_id),
|
||||
MTP_int(id),
|
||||
MTPPeer(),
|
||||
MTP_int(item->replyToTop()));
|
||||
}
|
||||
if (const auto replyToTop = LookupReplyToTop(action.history, id)) {
|
||||
return MTP_messageReplyHeader(
|
||||
MTP_flags(MTPDmessageReplyHeader::Flag::f_reply_to_top_id),
|
||||
MTP_int(id),
|
||||
MTPPeer(),
|
||||
MTP_int(replyToTop));
|
||||
}
|
||||
return MTP_messageReplyHeader(
|
||||
MTP_flags(0),
|
||||
|
@ -741,7 +745,9 @@ void HistoryMessage::createComponentsHelper(
|
|||
|
||||
if (flags & MTPDmessage::Flag::f_via_bot_id) config.viaBotId = viaBotId;
|
||||
if (flags & MTPDmessage::Flag::f_reply_to) {
|
||||
config.replyToTop = config.replyTo = replyTo;
|
||||
config.replyTo = replyTo;
|
||||
const auto replyToTop = LookupReplyToTop(history(), replyTo);
|
||||
config.replyToTop = replyToTop ? replyToTop : replyTo;
|
||||
}
|
||||
if (flags & MTPDmessage::Flag::f_reply_markup) config.mtpMarkup = &markup;
|
||||
if (flags & MTPDmessage::Flag::f_post_author) config.author = postAuthor;
|
||||
|
|
|
@ -21,16 +21,20 @@ struct HistoryMessageEdited;
|
|||
struct HistoryMessageReply;
|
||||
struct HistoryMessageViews;
|
||||
|
||||
Fn<void(ChannelData*, MsgId)> HistoryDependentItemCallback(
|
||||
[[nodiscard]] Fn<void(ChannelData*, MsgId)> HistoryDependentItemCallback(
|
||||
not_null<HistoryItem*> item);
|
||||
MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer);
|
||||
MTPDmessage_ClientFlags NewMessageClientFlags();
|
||||
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action);
|
||||
QString GetErrorTextForSending(
|
||||
[[nodiscard]] MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer);
|
||||
[[nodiscard]] MTPDmessage_ClientFlags NewMessageClientFlags();
|
||||
[[nodiscard]] MsgId LookupReplyToTop(
|
||||
not_null<History*> history,
|
||||
MsgId replyToId);
|
||||
[[nodiscard]] MTPMessageReplyHeader NewMessageReplyHeader(
|
||||
const Api::SendAction &action);
|
||||
[[nodiscard]] QString GetErrorTextForSending(
|
||||
not_null<PeerData*> peer,
|
||||
const HistoryItemsList &items,
|
||||
bool ignoreSlowmodeCountdown = false);
|
||||
QString GetErrorTextForSending(
|
||||
[[nodiscard]] QString GetErrorTextForSending(
|
||||
not_null<PeerData*> peer,
|
||||
const HistoryItemsList &items,
|
||||
const TextWithTags &comment,
|
||||
|
|
Loading…
Add table
Reference in a new issue