本文整理汇总了C++中not_null::authorOriginal方法的典型用法代码示例。如果您正苦于以下问题:C++ not_null::authorOriginal方法的具体用法?C++ not_null::authorOriginal怎么用?C++ not_null::authorOriginal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类not_null
的用法示例。
在下文中一共展示了not_null::authorOriginal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HistoryItem
HistoryMessage::HistoryMessage(
not_null<History*> history,
MsgId id,
MTPDmessage::Flags flags,
TimeId date,
UserId from,
const QString &postAuthor,
not_null<HistoryMessage*> original)
: HistoryItem(
history,
id,
NewForwardedFlags(history->peer, from, original) | flags,
date,
from) {
CreateConfig config;
if (original->Has<HistoryMessageForwarded>() || !original->history()->peer->isSelf()) {
// Server doesn't add "fwd_from" to non-forwarded messages from chat with yourself.
config.originalDate = original->dateOriginal();
auto senderOriginal = original->senderOriginal();
config.senderOriginal = senderOriginal->id;
config.authorOriginal = original->authorOriginal();
if (senderOriginal->isChannel()) {
config.originalId = original->idOriginal();
}
}
if (history->peer->isSelf()) {
//
// iOS app sends you to the original post if we forward a forward from channel.
// But server returns not the original post but the forward in saved_from_...
//
//if (config.originalId) {
// config.savedFromPeer = config.senderOriginal;
// config.savedFromMsgId = config.originalId;
//} else {
config.savedFromPeer = original->history()->peer->id;
config.savedFromMsgId = original->id;
//}
}
if (flags & MTPDmessage::Flag::f_post_author) {
config.author = postAuthor;
}
auto fwdViaBot = original->viaBot();
if (fwdViaBot) config.viaBotId = peerToUser(fwdViaBot->id);
int fwdViewsCount = original->viewsCount();
if (fwdViewsCount > 0) {
config.viewsCount = fwdViewsCount;
} else if (isPost()) {
config.viewsCount = 1;
}
// Copy inline keyboard when forwarding messages with a game.
auto mediaOriginal = original->media();
if (mediaOriginal && mediaOriginal->game()) {
config.inlineMarkup = original->inlineReplyMarkup();
}
createComponents(config);
auto ignoreMedia = [&] {
if (mediaOriginal && mediaOriginal->webpage()) {
if (const auto channel = history->peer->asChannel()) {
if (channel->restricted(ChannelRestriction::f_embed_links)) {
return true;
}
}
}
return false;
};
if (mediaOriginal && !ignoreMedia()) {
_media = mediaOriginal->clone(this);
}
setText(original->originalText());
}