Send images as files if no way to send as photos.

Fixes #3710.
This commit is contained in:
John Preston 2017-08-17 12:45:23 +03:00
parent 25ffaaaa2d
commit c97227825f

View file

@ -422,9 +422,9 @@ void FileLoadTask::process() {
QVector<MTPDocumentAttribute> attributes(1, MTP_documentAttributeFilename(MTP_string(filename)));
MTPPhotoSize thumbSize(MTP_photoSizeEmpty(MTP_string("")));
MTPPhoto photo(MTP_photoEmpty(MTP_long(0)));
MTPDocument document(MTP_documentEmpty(MTP_long(0)));
auto thumbSize = MTP_photoSizeEmpty(MTP_string(""));
auto photo = MTP_photoEmpty(MTP_long(0));
auto document = MTP_documentEmpty(MTP_long(0));
if (!isVoice) {
if (!_information) {
@ -540,6 +540,10 @@ void FileLoadTask::process() {
}
}
if (_type == SendMediaType::Photo && photo.type() == mtpc_photoEmpty) {
_type = SendMediaType::File;
}
if (isVoice) {
auto flags = MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform;
attributes[0] = MTP_documentAttributeAudio(MTP_flags(flags), MTP_int(_duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(_waveform)));