Don't send url, if we send an encrypted file

Fix issues when sending images to some clients.
master
Nicolas Werner 4 years ago
parent f23d733cff
commit 147ae68c31
  1. 27
      src/timeline/TimelineViewManager.cpp

@ -361,10 +361,13 @@ TimelineViewManager::queueImageMessage(const QString &roomid,
image.info.size = dsize; image.info.size = dsize;
image.info.blurhash = blurhash.toStdString(); image.info.blurhash = blurhash.toStdString();
image.body = filename.toStdString(); image.body = filename.toStdString();
image.url = url.toStdString();
image.info.h = dimensions.height(); image.info.h = dimensions.height();
image.info.w = dimensions.width(); image.info.w = dimensions.width();
image.file = file;
if (file)
image.file = file;
else
image.url = url.toStdString();
auto model = models.value(roomid); auto model = models.value(roomid);
if (!model->reply().isEmpty()) { if (!model->reply().isEmpty()) {
@ -388,8 +391,11 @@ TimelineViewManager::queueFileMessage(
file.info.mimetype = mime.toStdString(); file.info.mimetype = mime.toStdString();
file.info.size = dsize; file.info.size = dsize;
file.body = filename.toStdString(); file.body = filename.toStdString();
file.url = url.toStdString();
file.file = encryptedFile; if (encryptedFile)
file.file = encryptedFile;
else
file.url = url.toStdString();
auto model = models.value(roomid); auto model = models.value(roomid);
if (!model->reply().isEmpty()) { if (!model->reply().isEmpty()) {
@ -413,7 +419,11 @@ TimelineViewManager::queueAudioMessage(const QString &roomid,
audio.info.size = dsize; audio.info.size = dsize;
audio.body = filename.toStdString(); audio.body = filename.toStdString();
audio.url = url.toStdString(); audio.url = url.toStdString();
audio.file = file;
if (file)
audio.file = file;
else
audio.url = url.toStdString();
auto model = models.value(roomid); auto model = models.value(roomid);
if (!model->reply().isEmpty()) { if (!model->reply().isEmpty()) {
@ -436,8 +446,11 @@ TimelineViewManager::queueVideoMessage(const QString &roomid,
video.info.mimetype = mime.toStdString(); video.info.mimetype = mime.toStdString();
video.info.size = dsize; video.info.size = dsize;
video.body = filename.toStdString(); video.body = filename.toStdString();
video.url = url.toStdString();
video.file = file; if (file)
video.file = file;
else
video.url = url.toStdString();
auto model = models.value(roomid); auto model = models.value(roomid);
if (!model->reply().isEmpty()) { if (!model->reply().isEmpty()) {

Loading…
Cancel
Save