示例#1
0
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);
}
示例#2
0
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;
}
示例#3
0
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;
}
示例#4
0
bool HistoryMessage::allowsForward() const {
	if (id < 0 || isLogEntry()) {
		return false;
	}
	return !_media || _media->allowsForward();
}