2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Add saving of shared contacts vcards in export.

This commit is contained in:
John Preston
2018-06-28 18:03:44 +01:00
parent a43dfc567c
commit 5cdc563c9e
7 changed files with 77 additions and 41 deletions

View File

@@ -297,6 +297,9 @@ ApiWrap::LoadedFileCache::LoadedFileCache(int limit) : _limit(limit) {
void ApiWrap::LoadedFileCache::save(
const Location &location,
const QString &relativePath) {
if (!location) {
return;
}
const auto key = ComputeLocationKey(location);
_map[key] = relativePath;
_list.push_back(key);
@@ -309,6 +312,9 @@ void ApiWrap::LoadedFileCache::save(
base::optional<QString> ApiWrap::LoadedFileCache::find(
const Location &location) const {
if (!location) {
return base::none;
}
const auto key = ComputeLocationKey(location);
if (const auto i = _map.find(key); i != end(_map)) {
return i->second;
@@ -1307,7 +1313,7 @@ bool ApiWrap::processFileLoad(
if (!file.relativePath.isEmpty()) {
return true;
} else if (!file.location) {
} else if (!file.location && file.content.isEmpty()) {
file.skipReason = SkipReason::Unavailable;
return true;
} else if (writePreloadedFile(file)) {
@@ -1355,8 +1361,7 @@ bool ApiWrap::writePreloadedFile(Data::File &file) {
return true;
} else if (!file.content.isEmpty()) {
const auto process = prepareFileProcess(file);
auto &output = _fileProcess->file;
if (const auto result = output.writeBlock(file.content)) {
if (const auto result = process->file.writeBlock(file.content)) {
file.relativePath = process->relativePath;
_fileCache->save(file.location, file.relativePath);
} else {