void HistoryMessage::applyEdition(const MTPDmessage &message) { int keyboardTop = -1; //if (!pendingResize()) {// #TODO edit bot message // if (auto keyboard = inlineReplyKeyboard()) { // int h = st::msgBotKbButton.margin + keyboard->naturalHeight(); // keyboardTop = _height - h + st::msgBotKbButton.margin - marginBottom(); // } //} if (message.has_edit_date()) { _flags |= MTPDmessage::Flag::f_edit_date; if (!Has<HistoryMessageEdited>()) { AddComponents(HistoryMessageEdited::Bit()); } auto edited = Get<HistoryMessageEdited>(); edited->date = message.vedit_date.v; } TextWithEntities textWithEntities = { qs(message.vmessage), EntitiesInText() }; if (message.has_entities()) { textWithEntities.entities = TextUtilities::EntitiesFromMTP(message.ventities.v); } setReplyMarkup(message.has_reply_markup() ? (&message.vreply_markup) : nullptr); refreshMedia(message.has_media() ? (&message.vmedia) : nullptr); setViewsCount(message.has_views() ? message.vviews.v : -1); setText(textWithEntities); finishEdition(keyboardTop); }
void HistoryMessage::applyEditionToEmpty() { setReplyMarkup(nullptr); refreshMedia(nullptr); setEmptyText(); setViewsCount(-1); finishEditionToEmpty(); }
void HistoryMessage::refreshSentMedia(const MTPMessageMedia *media) { const auto wasGrouped = Auth().data().groups().isGrouped(this); refreshMedia(media); if (wasGrouped) { Auth().data().groups().refreshMessage(this); } else { Auth().data().requestItemViewRefresh(this); } }
Element::Element( not_null<ElementDelegate*> delegate, not_null<HistoryItem*> data) : _delegate(delegate) , _data(data) , _dateTime(ItemDateTime(data)) , _context(delegate->elementContext()) { history()->owner().registerItemView(this); refreshMedia(); if (_context == Context::History) { history()->setHasPendingResizedItems(); } }