void HistoryItem::addLogEntryOriginal( WebPageId localId, const QString &label, const TextWithEntities &content) { Expects(isLogEntry()); AddComponents(HistoryMessageLogEntryOriginal::Bit()); Get<HistoryMessageLogEntryOriginal>()->page = _history->owner().webpage( localId, label, content); }
bool HistoryItem::canDelete() const { if (isLogEntry() || (!IsServerMsgId(id) && serviceMsg())) { return false; } auto channel = _history->peer->asChannel(); if (!channel) { return !isGroupMigrate(); } if (id == 1) { return false; } if (channel->canDeleteMessages()) { return true; } if (out() && toHistoryMessage()) { return isPost() ? channel->canPublish() : true; } return false; }
void HistoryItem::destroy() { if (isLogEntry()) { Assert(!mainView()); } else { // All this must be done for all items manually in History::clear()! eraseFromUnreadMentions(); if (IsServerMsgId(id)) { if (const auto types = sharedMediaTypes()) { _history->session().storage().remove(Storage::SharedMediaRemoveOne( _history->peer->id, types, id)); } } else { _history->session().api().cancelLocalItem(this); } _history->itemRemoved(this); } delete this; }
bool HistoryMessage::allowsForward() const { if (id < 0 || isLogEntry()) { return false; } return !_media || _media->allowsForward(); }