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

Method sendFiles

Telegram/SourceFiles/apiwrap.cpp:3976–4037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3974}
3975
3976void ApiWrap::sendFiles(
3977 Ui::PreparedList &&list,
3978 SendMediaType type,
3979 std::shared_ptr<SendingAlbum> album,
3980 const SendAction &action) {
3981 const auto to = FileLoadTaskOptions(action);
3982 if (album) {
3983 album->options = to.options;
3984 }
3985 auto tasks = std::vector<std::unique_ptr<Task>>();
3986 tasks.reserve(list.files.size());
3987 for (auto &file : list.files) {
3988 const auto uploadWithType = !album
3989 ? type
3990 : (file.type == Ui::PreparedFile::Type::Photo
3991 && type != SendMediaType::File)
3992 ? SendMediaType::Photo
3993 : SendMediaType::File;
3994 const auto forceFile = (type == SendMediaType::File)
3995 && (file.type == Ui::PreparedFile::Type::Video);
3996 tasks.push_back(std::make_unique<FileLoadTask>(FileLoadTask::Args{
3997 .session = &session(),
3998 .filepath = file.path,
3999 .content = file.content,
4000 .information = std::move(file.information),
4001 .videoCover = (file.videoCover
4002 ? std::make_unique<FileLoadTask>(FileLoadTask::Args{
4003 .session = &session(),
4004 .filepath = file.videoCover->path,
4005 .content = file.videoCover->content,
4006 .information = std::move(file.videoCover->information),
4007 .videoCover = nullptr,
4008 .type = SendMediaType::Photo,
4009 .to = to,
4010 .caption = TextWithTags(),
4011 .spoiler = false,
4012 .album = nullptr,
4013 .forceFile = false,
4014 .sendLargePhotos = false,
4015 .idOverride = 0,
4016 })
4017 : nullptr),
4018 .type = uploadWithType,
4019 .to = to,
4020 .caption = std::move(file.caption),
4021 .spoiler = file.spoiler,
4022 .album = album,
4023 .forceFile = forceFile,
4024 .sendLargePhotos = file.sendLargePhotos,
4025 .idOverride = 0,
4026 .displayName = file.displayName,
4027 }));
4028 }
4029 if (album) {
4030 _sendingAlbums.emplace(album->groupId, album);
4031 album->items.reserve(tasks.size());
4032 for (const auto &task : tasks) {
4033 album->items.emplace_back(task->id());

Callers 7

sendingFilesConfirmedMethod · 0.80
sendDrawToReplyFilesMethod · 0.80
sendingFilesConfirmedMethod · 0.80
sendingFilesConfirmedMethod · 0.80
sendingFilesConfirmedMethod · 0.80
sendingFilesConfirmedMethod · 0.80
InterpretSendPathFunction · 0.80

Calls 6

FileLoadTaskOptionsFunction · 0.85
emplaceMethod · 0.80
addTasksMethod · 0.80
TextWithTagsClass · 0.50
sizeMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected