2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 07:56:03 +00:00

HistoryMedia always holds a pointer to its parent HistoryItem.

Using local cached data when sending media inline bot results.
This commit is contained in:
John Preston
2016-04-10 18:53:01 +04:00
parent 1fe562ec13
commit fe59c815b2
13 changed files with 673 additions and 576 deletions

View File

@@ -1441,6 +1441,27 @@ void DocumentData::setContentUrl(const QString &url) {
_url = url;
}
void DocumentData::collectLocalData(DocumentData *local) {
if (local == this) return;
if (!local->_data.isEmpty()) {
_data = local->_data;
if (voice()) {
if (!Local::copyAudio(local->mediaKey(), mediaKey())) {
Local::writeAudio(mediaKey(), _data);
}
} else {
if (!Local::copyStickerImage(local->mediaKey(), mediaKey())) {
Local::writeStickerImage(mediaKey(), _data);
}
}
}
if (!local->_location.isEmpty()) {
_location = local->_location;
Local::writeFileLocation(mediaKey(), _location);
}
}
DocumentData::~DocumentData() {
if (loading()) {
_loader->deleteLater();