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

Method upload

Telegram/SourceFiles/api/api_ringtones.cpp:75–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void Ringtones::upload(
76 const QString &filename,
77 const QString &filemime,
78 const QByteArray &content) {
79 const auto ready = PrepareRingtoneDocument(
80 _api.instance().mainDcId(),
81 filename,
82 filemime,
83 content);
84
85 const auto uploadedData = UploadedData{ filename, filemime, content };
86 const auto fakeId = FullMsgId(
87 _session->userPeerId(),
88 _session->data().nextLocalMessageId());
89 const auto already = ranges::find_if(
90 _uploads,
91 [&](const auto &d) {
92 return uploadedData.filemime == d.second.filemime
93 && uploadedData.filename == d.second.filename;
94 });
95 if (already != end(_uploads)) {
96 _session->uploader().cancel(already->first);
97 _uploads.erase(already);
98 }
99 _uploads.emplace(fakeId, uploadedData);
100 _session->uploader().upload(fakeId, ready);
101}
102
103void Ringtones::ready(const FullMsgId &msgId, const MTPInputFile &file) {
104 const auto maybeUploadedData = _uploads.take(msgId);

Callers 15

paintButtonMethod · 0.45
paintUsingRasterMethod · 0.45
createSessionMethod · 0.45
startMethod · 0.45
SavePreparedThemeFunction · 0.45
uploadForPeerMethod · 0.45
setupContentMethod · 0.45
RingtonesBoxFunction · 0.45
ChatCreateDoneFunction · 0.45
createChannelMethod · 0.45

Calls 10

PrepareRingtoneDocumentFunction · 0.85
userPeerIdMethod · 0.80
nextLocalMessageIdMethod · 0.80
emplaceMethod · 0.80
FullMsgIdClass · 0.50
mainDcIdMethod · 0.45
instanceMethod · 0.45
dataMethod · 0.45
cancelMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected