mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Revert "Remove SendMediaReady legacy helper."
This reverts commit 91f8989f70
.
This commit is contained in:
@@ -34,7 +34,7 @@ namespace {
|
||||
|
||||
constexpr auto kSharedMediaLimit = 100;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<FilePrepareResult> PreparePeerPhoto(
|
||||
[[nodiscard]] SendMediaReady PreparePeerPhoto(
|
||||
MTP::DcId dcId,
|
||||
PeerId peerId,
|
||||
QImage &&image) {
|
||||
@@ -80,17 +80,24 @@ constexpr auto kSharedMediaLimit = 100;
|
||||
MTPVector<MTPVideoSize>(),
|
||||
MTP_int(dcId));
|
||||
|
||||
auto result = MakePreparedFile({
|
||||
.id = id,
|
||||
.type = SendMediaType::Photo,
|
||||
});
|
||||
result->type = SendMediaType::Photo;
|
||||
result->setFileData(jpeg);
|
||||
result->thumbId = id;
|
||||
result->thumbname = "thumb.jpg";
|
||||
result->photo = photo;
|
||||
result->photoThumbs = photoThumbs;
|
||||
return result;
|
||||
QString file, filename;
|
||||
int64 filesize = 0;
|
||||
QByteArray data;
|
||||
|
||||
return SendMediaReady(
|
||||
SendMediaType::Photo,
|
||||
file,
|
||||
filename,
|
||||
filesize,
|
||||
data,
|
||||
id,
|
||||
id,
|
||||
u"jpg"_q,
|
||||
peerId,
|
||||
photo,
|
||||
photoThumbs,
|
||||
MTP_documentEmpty(MTP_long(0)),
|
||||
jpeg);
|
||||
}
|
||||
|
||||
[[nodiscard]] std::optional<MTPVideoSize> PrepareMtpMarkup(
|
||||
@@ -232,7 +239,7 @@ void PeerPhoto::upload(
|
||||
_api.instance().mainDcId(),
|
||||
peer->id,
|
||||
base::take(photo.image));
|
||||
_session->uploader().upload(fakeId, ready);
|
||||
_session->uploader().uploadMedia(fakeId, ready);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,25 +24,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
||||
std::shared_ptr<FilePrepareResult> PrepareRingtoneDocument(
|
||||
SendMediaReady PrepareRingtoneDocument(
|
||||
MTP::DcId dcId,
|
||||
const QString &filename,
|
||||
const QString &filemime,
|
||||
const QByteArray &content) {
|
||||
const auto id = base::RandomValue<DocumentId>();
|
||||
auto attributes = QVector<MTPDocumentAttribute>(
|
||||
1,
|
||||
MTP_documentAttributeFilename(MTP_string(filename)));
|
||||
|
||||
auto result = MakePreparedFile({
|
||||
.id = id,
|
||||
.type = SendMediaType::File,
|
||||
});
|
||||
result->filename = filename;
|
||||
result->content = content;
|
||||
result->filesize = content.size();
|
||||
result->setFileData(content);
|
||||
result->document = MTP_document(
|
||||
const auto id = base::RandomValue<DocumentId>();
|
||||
const auto document = MTP_document(
|
||||
MTP_flags(0),
|
||||
MTP_long(id),
|
||||
MTP_long(0),
|
||||
@@ -54,7 +45,21 @@ std::shared_ptr<FilePrepareResult> PrepareRingtoneDocument(
|
||||
MTPVector<MTPVideoSize>(),
|
||||
MTP_int(dcId),
|
||||
MTP_vector<MTPDocumentAttribute>(std::move(attributes)));
|
||||
return result;
|
||||
|
||||
return SendMediaReady(
|
||||
SendMediaType::File,
|
||||
QString(), // filepath
|
||||
filename,
|
||||
content.size(),
|
||||
content,
|
||||
id,
|
||||
0,
|
||||
QString(),
|
||||
PeerId(),
|
||||
MTP_photoEmpty(MTP_long(0)),
|
||||
PreparedPhotoThumbs(),
|
||||
document,
|
||||
QByteArray());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -97,7 +102,7 @@ void Ringtones::upload(
|
||||
_uploads.erase(already);
|
||||
}
|
||||
_uploads.emplace(fakeId, uploadedData);
|
||||
_session->uploader().upload(fakeId, ready);
|
||||
_session->uploader().uploadMedia(fakeId, ready);
|
||||
}
|
||||
|
||||
void Ringtones::ready(const FullMsgId &msgId, const MTPInputFile &file) {
|
||||
|
@@ -353,7 +353,7 @@ void FillMessagePostFlags(
|
||||
|
||||
void SendConfirmedFile(
|
||||
not_null<Main::Session*> session,
|
||||
const std::shared_ptr<FilePrepareResult> &file) {
|
||||
const std::shared_ptr<FileLoadResult> &file) {
|
||||
const auto isEditing = (file->type != SendMediaType::Audio)
|
||||
&& (file->to.replaceMediaOf != 0);
|
||||
const auto newId = FullMsgId(
|
||||
|
@@ -14,7 +14,7 @@ class Session;
|
||||
class History;
|
||||
class PhotoData;
|
||||
class DocumentData;
|
||||
struct FilePrepareResult;
|
||||
struct FileLoadResult;
|
||||
|
||||
namespace Api {
|
||||
|
||||
@@ -40,6 +40,6 @@ void FillMessagePostFlags(
|
||||
|
||||
void SendConfirmedFile(
|
||||
not_null<Main::Session*> session,
|
||||
const std::shared_ptr<FilePrepareResult> &file);
|
||||
const std::shared_ptr<FileLoadResult> &file);
|
||||
|
||||
} // namespace Api
|
||||
|
Reference in New Issue
Block a user