parent
5a3733b5b6
commit
cd506dfff5
|
@ -374,18 +374,22 @@ MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer) {
|
||||||
return result;
|
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) {
|
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) {
|
||||||
if (const auto id = action.replyTo) {
|
if (const auto id = action.replyTo) {
|
||||||
const auto history = action.history;
|
if (const auto replyToTop = LookupReplyToTop(action.history, id)) {
|
||||||
const auto &owner = history->owner();
|
return MTP_messageReplyHeader(
|
||||||
if (const auto item = owner.message(history->channelId(), id)) {
|
MTP_flags(MTPDmessageReplyHeader::Flag::f_reply_to_top_id),
|
||||||
if (item->replyToId()) {
|
MTP_int(id),
|
||||||
return MTP_messageReplyHeader(
|
MTPPeer(),
|
||||||
MTP_flags(MTPDmessageReplyHeader::Flag::f_reply_to_top_id),
|
MTP_int(replyToTop));
|
||||||
MTP_int(id),
|
|
||||||
MTPPeer(),
|
|
||||||
MTP_int(item->replyToTop()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return MTP_messageReplyHeader(
|
return MTP_messageReplyHeader(
|
||||||
MTP_flags(0),
|
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_via_bot_id) config.viaBotId = viaBotId;
|
||||||
if (flags & MTPDmessage::Flag::f_reply_to) {
|
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_reply_markup) config.mtpMarkup = &markup;
|
||||||
if (flags & MTPDmessage::Flag::f_post_author) config.author = postAuthor;
|
if (flags & MTPDmessage::Flag::f_post_author) config.author = postAuthor;
|
||||||
|
|
|
@ -21,16 +21,20 @@ struct HistoryMessageEdited;
|
||||||
struct HistoryMessageReply;
|
struct HistoryMessageReply;
|
||||||
struct HistoryMessageViews;
|
struct HistoryMessageViews;
|
||||||
|
|
||||||
Fn<void(ChannelData*, MsgId)> HistoryDependentItemCallback(
|
[[nodiscard]] Fn<void(ChannelData*, MsgId)> HistoryDependentItemCallback(
|
||||||
not_null<HistoryItem*> item);
|
not_null<HistoryItem*> item);
|
||||||
MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer);
|
[[nodiscard]] MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer);
|
||||||
MTPDmessage_ClientFlags NewMessageClientFlags();
|
[[nodiscard]] MTPDmessage_ClientFlags NewMessageClientFlags();
|
||||||
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action);
|
[[nodiscard]] MsgId LookupReplyToTop(
|
||||||
QString GetErrorTextForSending(
|
not_null<History*> history,
|
||||||
|
MsgId replyToId);
|
||||||
|
[[nodiscard]] MTPMessageReplyHeader NewMessageReplyHeader(
|
||||||
|
const Api::SendAction &action);
|
||||||
|
[[nodiscard]] QString GetErrorTextForSending(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const HistoryItemsList &items,
|
const HistoryItemsList &items,
|
||||||
bool ignoreSlowmodeCountdown = false);
|
bool ignoreSlowmodeCountdown = false);
|
||||||
QString GetErrorTextForSending(
|
[[nodiscard]] QString GetErrorTextForSending(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const HistoryItemsList &items,
|
const HistoryItemsList &items,
|
||||||
const TextWithTags &comment,
|
const TextWithTags &comment,
|
||||||
|
|
Loading…
Reference in New Issue