MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / fileRequest

Method fileRequest

Telegram/SourceFiles/export/export_api_wrap.cpp:402–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402auto ApiWrap::fileRequest(const Data::FileLocation &location, int64 offset) {
403 Expects(location.dcId != 0
404 || location.data.type() == mtpc_inputTakeoutFileLocation);
405 Expects(_takeoutId.has_value());
406 Expects(_fileProcess->requestId == 0);
407
408 return std::move(_mtp.request(MTPInvokeWithTakeout<MTPupload_GetFile>(
409 MTP_long(*_takeoutId),
410 MTPupload_GetFile(
411 MTP_flags(0),
412 location.data,
413 MTP_long(offset),
414 MTP_int(kFileChunkSize))
415 )).fail([=](const MTP::Error &result) {
416 _fileProcess->requestId = 0;
417 if (result.type() == u"TAKEOUT_FILE_EMPTY"_q
418 && _otherDataProcess != nullptr) {
419 filePartDone(
420 0,
421 MTP_upload_file(
422 MTP_storage_filePartial(),
423 MTP_int(0),
424 MTP_bytes()));
425 } else if (result.type() == u"LOCATION_INVALID"_q
426 || result.type() == u"VERSION_INVALID"_q
427 || result.type() == u"LOCATION_NOT_AVAILABLE"_q) {
428 filePartUnavailable();
429 } else if (result.code() == 400
430 && result.type().startsWith(u"FILE_REFERENCE_"_q)) {
431 filePartRefreshReference(offset);
432 } else {
433 error(std::move(result));
434 }
435 }).toDC(MTP::ShiftDcId(location.dcId, MTP::kExportMediaDcShift)));
436}
437
438ApiWrap::ApiWrap(
439 base::weak_qptr<MTP::Instance> weak,

Callers

nothing calls this directly

Calls 12

MTP_longFunction · 0.85
MTP_flagsFunction · 0.85
MTP_bytesFunction · 0.85
errorFunction · 0.85
ShiftDcIdFunction · 0.85
has_valueMethod · 0.80
toDCMethod · 0.80
MTP_intFunction · 0.50
typeMethod · 0.45
failMethod · 0.45
requestMethod · 0.45
codeMethod · 0.45

Tested by

no test coverage detected