summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-09 16:03:14 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-09 16:03:14 +0300
commitb89257a34b2a98b737f4ae544f7e436b9000b240 (patch)
tree81d7f355721541afbd91dc9a085abbb4666f3565 /src/timeline
parentInstall missing dependencies in travis-ci/appveyor (diff)
downloadnheko-b89257a34b2a98b737f4ae544f7e436b9000b240.tar.xz
Migrate to mtxclient for the http calls
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineItem.cc20
-rw-r--r--src/timeline/TimelineView.cc217
-rw-r--r--src/timeline/TimelineViewManager.cc35
-rw-r--r--src/timeline/widgets/AudioItem.cc32
-rw-r--r--src/timeline/widgets/FileItem.cc44
-rw-r--r--src/timeline/widgets/ImageItem.cc138
-rw-r--r--src/timeline/widgets/VideoItem.cc16
7 files changed, 318 insertions, 184 deletions
diff --git a/src/timeline/TimelineItem.cc b/src/timeline/TimelineItem.cc

index 250373e4..83a0aaed 100644 --- a/src/timeline/TimelineItem.cc +++ b/src/timeline/TimelineItem.cc
@@ -62,9 +62,27 @@ TimelineItem::init() ChatPage::instance()->showReadReceipts(event_id_); }); + connect(this, &TimelineItem::eventRedacted, this, [this](const QString &event_id) { + emit ChatPage::instance()->removeTimelineEvent(room_id_, event_id); + }); + connect(this, &TimelineItem::redactionFailed, this, [](const QString &msg) { + emit ChatPage::instance()->showNotification(msg); + }); connect(redactMsg_, &QAction::triggered, this, [this]() { if (!event_id_.isEmpty()) - http::client()->redactEvent(room_id_, event_id_); + http::v2::client()->redact_event( + room_id_.toStdString(), + event_id_.toStdString(), + [this](const mtx::responses::EventId &, mtx::http::RequestErr err) { + if (err) { + emit redactionFailed(tr("Message redaction failed: %1") + .arg(QString::fromStdString( + err->matrix_error.error))); + return; + } + + emit eventRedacted(event_id_); + }); }); connect(markAsRead_, &QAction::triggered, this, [this]() { sendReadReceipt(); }); diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc
index 71058d74..5ef390a9 100644 --- a/src/timeline/TimelineView.cc +++ b/src/timeline/TimelineView.cc
@@ -23,6 +23,7 @@ #include "ChatPage.h" #include "Config.h" #include "FloatingButton.h" +#include "Logging.hpp" #include "UserSettingsPage.h" #include "Utils.h" @@ -100,7 +101,7 @@ TimelineView::TimelineView(const QString &room_id, QWidget *parent) , room_id_{room_id} { init(); - http::client()->messages(room_id_, ""); + getMessages(); } void @@ -140,7 +141,7 @@ TimelineView::fetchHistory() return; isPaginationInProgress_ = true; - http::client()->messages(room_id_, prev_batch_token_); + getMessages(); paginationTimer_->start(5000); return; @@ -189,18 +190,13 @@ TimelineView::sliderMoved(int position) isPaginationInProgress_ = true; - // FIXME: Maybe move this to TimelineViewManager to remove the - // extra calls? - http::client()->messages(room_id_, prev_batch_token_); + getMessages(); } } void -TimelineView::addBackwardsEvents(const QString &room_id, const mtx::responses::Messages &msgs) +TimelineView::addBackwardsEvents(const mtx::responses::Messages &msgs) { - if (room_id_ != room_id) - return; - // We've reached the start of the timline and there're no more messages. if ((msgs.end == msgs.start) && msgs.chunk.size() == 0) { isTimelineFinished = true; @@ -427,10 +423,10 @@ TimelineView::init() paginationTimer_ = new QTimer(this); connect(paginationTimer_, &QTimer::timeout, this, &TimelineView::fetchHistory); - connect(http::client(), - &MatrixClient::messagesRetrieved, - this, - &TimelineView::addBackwardsEvents); + connect(this, &TimelineView::messagesRetrieved, this, &TimelineView::addBackwardsEvents); + + connect(this, &TimelineView::messageFailed, this, &TimelineView::handleFailedMessage); + connect(this, &TimelineView::messageSent, this, &TimelineView::updatePendingMessage); connect(scroll_area_->verticalScrollBar(), SIGNAL(valueChanged(int)), @@ -443,6 +439,27 @@ TimelineView::init() } void +TimelineView::getMessages() +{ + mtx::http::MessagesOpts opts; + opts.room_id = room_id_.toStdString(); + opts.from = prev_batch_token_.toStdString(); + + http::v2::client()->messages( + opts, [this, opts](const mtx::responses::Messages &res, mtx::http::RequestErr err) { + if (err) { + log::net()->error("failed to call /messages ({}): {} - {}", + opts.room_id, + mtx::errors::to_string(err->matrix_error.errcode), + err->matrix_error.error); + return; + } + + emit messagesRetrieved(std::move(res)); + }); +} + +void TimelineView::updateLastSender(const QString &user_id, TimelineDirection direction) { if (direction == TimelineDirection::Bottom) @@ -513,7 +530,7 @@ TimelineView::addTimelineItem(TimelineItem *item, TimelineDirection direction) } void -TimelineView::updatePendingMessage(int txn_id, QString event_id) +TimelineView::updatePendingMessage(const std::string &txn_id, const QString &event_id) { if (!pending_msgs_.isEmpty() && pending_msgs_.head().txn_id == txn_id) { // We haven't received it yet @@ -548,8 +565,11 @@ TimelineView::addUserMessage(mtx::events::MessageType ty, const QString &body) saveLastMessageInfo(local_user_, QDateTime::currentDateTime()); - int txn_id = http::client()->incrementTransactionId(); - PendingMessage message(ty, txn_id, body, "", "", -1, "", view_item); + PendingMessage message; + message.ty = ty; + message.txn_id = mtx::client::utils::random_token(); + message.body = body; + message.widget = view_item; handleNewUserMessage(message); } @@ -567,19 +587,119 @@ TimelineView::sendNextPendingMessage() if (pending_msgs_.size() == 0) return; + using namespace mtx::events; + PendingMessage &m = pending_msgs_.head(); switch (m.ty) { - case mtx::events::MessageType::Audio: - case mtx::events::MessageType::Image: - case mtx::events::MessageType::Video: - case mtx::events::MessageType::File: - // FIXME: Improve the API - http::client()->sendRoomMessage( - m.ty, m.txn_id, room_id_, m.filename, m.mime, m.media_size, m.body); + case mtx::events::MessageType::Audio: { + msg::Audio audio; + audio.info.mimetype = m.mime.toStdString(); + audio.info.size = m.media_size; + audio.body = m.filename.toStdString(); + audio.url = m.body.toStdString(); + + http::v2::client()->send_room_message<msg::Audio, EventType::RoomMessage>( + room_id_.toStdString(), + m.txn_id, + audio, + std::bind(&TimelineView::sendRoomMessageHandler, + this, + m.txn_id, + std::placeholders::_1, + std::placeholders::_2)); + + break; + } + case mtx::events::MessageType::Image: { + msg::Image image; + image.info.mimetype = m.mime.toStdString(); + image.info.size = m.media_size; + image.body = m.filename.toStdString(); + image.url = m.body.toStdString(); + + http::v2::client()->send_room_message<msg::Image, EventType::RoomMessage>( + room_id_.toStdString(), + m.txn_id, + image, + std::bind(&TimelineView::sendRoomMessageHandler, + this, + m.txn_id, + std::placeholders::_1, + std::placeholders::_2)); + + break; + } + case mtx::events::MessageType::Video: { + msg::Video video; + video.info.mimetype = m.mime.toStdString(); + video.info.size = m.media_size; + video.body = m.filename.toStdString(); + video.url = m.body.toStdString(); + + http::v2::client()->send_room_message<msg::Video, EventType::RoomMessage>( + room_id_.toStdString(), + m.txn_id, + video, + std::bind(&TimelineView::sendRoomMessageHandler, + this, + m.txn_id, + std::placeholders::_1, + std::placeholders::_2)); + + break; + } + case mtx::events::MessageType::File: { + msg::File file; + file.info.mimetype = m.mime.toStdString(); + file.info.size = m.media_size; + file.body = m.filename.toStdString(); + file.url = m.body.toStdString(); + + http::v2::client()->send_room_message<msg::File, EventType::RoomMessage>( + room_id_.toStdString(), + m.txn_id, + file, + std::bind(&TimelineView::sendRoomMessageHandler, + this, + m.txn_id, + std::placeholders::_1, + std::placeholders::_2)); + + break; + } + case mtx::events::MessageType::Text: { + msg::Text text; + text.body = m.body.toStdString(); + + http::v2::client()->send_room_message<msg::Text, EventType::RoomMessage>( + room_id_.toStdString(), + m.txn_id, + text, + std::bind(&TimelineView::sendRoomMessageHandler, + this, + m.txn_id, + std::placeholders::_1, + std::placeholders::_2)); + + break; + } + case mtx::events::MessageType::Emote: { + msg::Emote emote; + emote.body = m.body.toStdString(); + + http::v2::client()->send_room_message<msg::Emote, EventType::RoomMessage>( + room_id_.toStdString(), + m.txn_id, + emote, + std::bind(&TimelineView::sendRoomMessageHandler, + this, + m.txn_id, + std::placeholders::_1, + std::placeholders::_2)); break; + } default: - http::client()->sendRoomMessage( - m.ty, m.txn_id, room_id_, m.body, m.mime, m.media_size); + log::main()->warn("cannot send unknown message type: {}", m.body.toStdString()); break; } } @@ -593,7 +713,7 @@ TimelineView::notifyForLastEvent() if (lastTimelineItem) emit updateLastTimelineMessage(room_id_, lastTimelineItem->descriptionMessage()); else - qWarning() << "Cast to TimelineView failed" << room_id_; + log::main()->warn("cast to TimelineView failed: {}", room_id_.toStdString()); } void @@ -606,29 +726,27 @@ TimelineView::notifyForLastEvent(const TimelineEvent &event) } bool -TimelineView::isPendingMessage(const QString &txnid, +TimelineView::isPendingMessage(const std::string &txn_id, const QString &sender, const QString &local_userid) { if (sender != local_userid) return false; - auto match_txnid = [txnid](const auto &msg) -> bool { - return QString::number(msg.txn_id) == txnid; - }; + auto match_txnid = [txn_id](const auto &msg) -> bool { return msg.txn_id == txn_id; }; return std::any_of(pending_msgs_.cbegin(), pending_msgs_.cend(), match_txnid) || std::any_of(pending_sent_msgs_.cbegin(), pending_sent_msgs_.cend(), match_txnid); } void -TimelineView::removePendingMessage(const QString &txnid) +TimelineView::removePendingMessage(const std::string &txn_id) { - if (txnid.isEmpty()) + if (txn_id.empty()) return; for (auto it = pending_sent_msgs_.begin(); it != pending_sent_msgs_.end(); ++it) { - if (QString::number(it->txn_id) == txnid) { + if (it->txn_id == txn_id) { int index = std::distance(pending_sent_msgs_.begin(), it); pending_sent_msgs_.removeAt(index); @@ -639,7 +757,7 @@ TimelineView::removePendingMessage(const QString &txnid) } } for (auto it = pending_msgs_.begin(); it != pending_msgs_.end(); ++it) { - if (QString::number(it->txn_id) == txnid) { + if (it->txn_id == txn_id) { int index = std::distance(pending_msgs_.begin(), it); pending_msgs_.removeAt(index); return; @@ -648,9 +766,9 @@ TimelineView::removePendingMessage(const QString &txnid) } void -TimelineView::handleFailedMessage(int txnid) +TimelineView::handleFailedMessage(const std::string &txn_id) { - Q_UNUSED(txnid); + Q_UNUSED(txn_id); // Note: We do this even if the message has already been echoed. QTimer::singleShot(2000, this, SLOT(sendNextPendingMessage())); } @@ -673,7 +791,16 @@ TimelineView::readLastEvent() const const auto eventId = getLastEventId(); if (!eventId.isEmpty()) - http::client()->readEvent(room_id_, eventId); + http::v2::client()->read_event(room_id_.toStdString(), + eventId.toStdString(), + [this, eventId](mtx::http::RequestErr err) { + if (err) { + log::net()->warn( + "failed to read event ({}, {})", + room_id_.toStdString(), + eventId.toStdString()); + } + }); } QString @@ -743,7 +870,8 @@ void TimelineView::removeEvent(const QString &event_id) { if (!eventIds_.contains(event_id)) { - qWarning() << "unknown event_id couldn't be removed:" << event_id; + log::main()->warn("cannot remove widget with unknown event_id: {}", + event_id.toStdString()); return; } @@ -860,3 +988,16 @@ TimelineView::isDateDifference(const QDateTime &first, const QDateTime &second) return diffInSeconds > fifteenMins; } + +void +TimelineView::sendRoomMessageHandler(const std::string &txn_id, + const mtx::responses::EventId &res, + mtx::http::RequestErr err) +{ + if (err) { + emit messageFailed(txn_id); + return; + } + + emit messageSent(txn_id, QString::fromStdString(res.event_id.to_string())); +} diff --git a/src/timeline/TimelineViewManager.cc b/src/timeline/TimelineViewManager.cc
index b7ce53ae..9026463d 100644 --- a/src/timeline/TimelineViewManager.cc +++ b/src/timeline/TimelineViewManager.cc
@@ -35,42 +35,15 @@ TimelineViewManager::TimelineViewManager(QWidget *parent) : QStackedWidget(parent) { setStyleSheet("border: none;"); - - connect( - http::client(), &MatrixClient::messageSent, this, &TimelineViewManager::messageSent); - - connect(http::client(), - &MatrixClient::messageSendFailed, - this, - &TimelineViewManager::messageSendFailed); - - connect(http::client(), - &MatrixClient::redactionCompleted, - this, - [this](const QString &room_id, const QString &event_id) { - auto view = views_[room_id]; - - if (view) - view->removeEvent(event_id); - }); } void -TimelineViewManager::messageSent(const QString &event_id, const QString &roomid, int txn_id) +TimelineViewManager::removeTimelineEvent(const QString &room_id, const QString &event_id) { - // We save the latest valid transaction ID for later use. - QSettings settings; - settings.setValue("client/transaction_id", txn_id + 1); + auto view = views_[room_id]; - auto view = views_[roomid]; - view->updatePendingMessage(txn_id, event_id); -} - -void -TimelineViewManager::messageSendFailed(const QString &roomid, int txn_id) -{ - auto view = views_[roomid]; - view->handleFailedMessage(txn_id); + if (view) + view->removeEvent(event_id); } void diff --git a/src/timeline/widgets/AudioItem.cc b/src/timeline/widgets/AudioItem.cc
index 65ca401b..1ad47747 100644 --- a/src/timeline/widgets/AudioItem.cc +++ b/src/timeline/widgets/AudioItem.cc
@@ -50,21 +50,12 @@ AudioItem::init() playIcon_.addFile(":/icons/icons/ui/play-sign.png"); pauseIcon_.addFile(":/icons/icons/ui/pause-symbol.png"); - QList<QString> url_parts = url_.toString().split("mxc://"); - if (url_parts.size() != 2) { - qDebug() << "Invalid format for image" << url_.toString(); - return; - } - - QString media_params = url_parts[1]; - url_ = QString("%1/_matrix/media/r0/download/%2") - .arg(http::client()->getHomeServer().toString(), media_params); - player_ = new QMediaPlayer; player_->setMedia(QUrl(url_)); player_->setVolume(100); player_->setNotifyInterval(1000); + connect(this, &AudioItem::fileDownloadedCb, this, &AudioItem::fileDownloaded); connect(player_, &QMediaPlayer::stateChanged, this, [this](QMediaPlayer::State state) { if (state == QMediaPlayer::StoppedState) { state_ = AudioState::Play; @@ -129,14 +120,19 @@ AudioItem::mousePressEvent(QMouseEvent *event) if (filenameToSave_.isEmpty()) return; - auto proxy = http::client()->downloadFile(url_); - connect(proxy.data(), - &DownloadMediaProxy::fileDownloaded, - this, - [proxy, this](const QByteArray &data) { - proxy->deleteLater(); - fileDownloaded(data); - }); + http::v2::client()->download( + url_.toString().toStdString(), + [this](const std::string &data, + const std::string &, + const std::string &, + mtx::http::RequestErr err) { + if (err) { + qWarning() << "failed to retrieve m.audio content:" << url_; + return; + } + + emit fileDownloadedCb(QByteArray(data.data(), data.size())); + }); } } diff --git a/src/timeline/widgets/FileItem.cc b/src/timeline/widgets/FileItem.cc
index f3906a04..43689243 100644 --- a/src/timeline/widgets/FileItem.cc +++ b/src/timeline/widgets/FileItem.cc
@@ -49,17 +49,9 @@ FileItem::init() icon_.addFile(":/icons/icons/ui/arrow-pointing-down.png"); - QList<QString> url_parts = url_.toString().split("mxc://"); - if (url_parts.size() != 2) { - qDebug() << "Invalid format for image" << url_.toString(); - return; - } - - QString media_params = url_parts[1]; - url_ = QString("%1/_matrix/media/r0/download/%2") - .arg(http::client()->getHomeServer().toString(), media_params); - setFixedHeight(Height); + + connect(this, &FileItem::fileDownloadedCb, this, &FileItem::fileDownloaded); } FileItem::FileItem(const mtx::events::RoomEvent<mtx::events::msg::File> &event, QWidget *parent) @@ -89,8 +81,15 @@ FileItem::openUrl() if (url_.toString().isEmpty()) return; - if (!QDesktopServices::openUrl(url_)) - qWarning() << "Could not open url" << url_.toString(); + auto mxc_parts = mtx::client::utils::parse_mxc_url(url_.toString().toStdString()); + auto urlToOpen = QString("https://%1:%2/_matrix/media/r0/download/%3/%4") + .arg(QString::fromStdString(http::v2::client()->server())) + .arg(http::v2::client()->port()) + .arg(QString::fromStdString(mxc_parts.server)) + .arg(QString::fromStdString(mxc_parts.media_id)); + + if (!QDesktopServices::openUrl(urlToOpen)) + qWarning() << "Could not open url" << urlToOpen; } QSize @@ -115,14 +114,19 @@ FileItem::mousePressEvent(QMouseEvent *event) if (filenameToSave_.isEmpty()) return; - auto proxy = http::client()->downloadFile(url_); - connect(proxy.data(), - &DownloadMediaProxy::fileDownloaded, - this, - [proxy, this](const QByteArray &data) { - proxy->deleteLater(); - fileDownloaded(data); - }); + http::v2::client()->download( + url_.toString().toStdString(), + [this](const std::string &data, + const std::string &, + const std::string &, + mtx::http::RequestErr err) { + if (err) { + qWarning() << "failed to retrieve m.file content:" << url_; + return; + } + + emit fileDownloadedCb(QByteArray(data.data(), data.size())); + }); } else { openUrl(); } diff --git a/src/timeline/widgets/ImageItem.cc b/src/timeline/widgets/ImageItem.cc
index 66cd31ab..6aa010a4 100644 --- a/src/timeline/widgets/ImageItem.cc +++ b/src/timeline/widgets/ImageItem.cc
@@ -30,37 +30,62 @@ #include "dialogs/ImageOverlay.h" #include "timeline/widgets/ImageItem.h" -ImageItem::ImageItem(const mtx::events::RoomEvent<mtx::events::msg::Image> &event, QWidget *parent) - : QWidget(parent) - , event_{event} +void +ImageItem::downloadMedia(const QUrl &url) { - setMouseTracking(true); - setCursor(Qt::PointingHandCursor); - setAttribute(Qt::WA_Hover, true); + http::v2::client()->download(url.toString().toStdString(), + [this, url](const std::string &data, + const std::string &, + const std::string &, + mtx::http::RequestErr err) { + if (err) { + qWarning() + << "failed to retrieve image:" << url; + return; + } - url_ = QString::fromStdString(event.content.url); - text_ = QString::fromStdString(event.content.body); + QPixmap img; + img.loadFromData(QByteArray(data.data(), data.size())); + emit imageDownloaded(img); + }); +} - QList<QString> url_parts = url_.toString().split("mxc://"); +void +ImageItem::saveImage(const QString &filename, const QByteArray &data) +{ + try { + QFile file(filename); - if (url_parts.size() != 2) { - qDebug() << "Invalid format for image" << url_.toString(); - return; + if (!file.open(QIODevice::WriteOnly)) + return; + + file.write(data); + file.close(); + } catch (const std::exception &ex) { + qDebug() << "Error while saving file to:" << ex.what(); } +} + +void +ImageItem::init() +{ + setMouseTracking(true); + setCursor(Qt::PointingHandCursor); + setAttribute(Qt::WA_Hover, true); - QString media_params = url_parts[1]; - url_ = QString("%1/_matrix/media/r0/download/%2") - .arg(http::client()->getHomeServer().toString(), media_params); + connect(this, &ImageItem::imageDownloaded, this, &ImageItem::setImage); + connect(this, &ImageItem::imageSaved, this, &ImageItem::saveImage); + downloadMedia(url_); +} - auto proxy = http::client()->downloadImage(url_); +ImageItem::ImageItem(const mtx::events::RoomEvent<mtx::events::msg::Image> &event, QWidget *parent) + : QWidget(parent) + , event_{event} +{ + url_ = QString::fromStdString(event.content.url); + text_ = QString::fromStdString(event.content.body); - connect(proxy.data(), - &DownloadMediaProxy::imageDownloaded, - this, - [this, proxy](const QPixmap &img) { - proxy->deleteLater(); - setImage(img); - }); + init(); } ImageItem::ImageItem(const QString &url, const QString &filename, uint64_t size, QWidget *parent) @@ -69,31 +94,7 @@ ImageItem::ImageItem(const QString &url, const QString &filename, uint64_t size, , text_{filename} { Q_UNUSED(size); - - setMouseTracking(true); - setCursor(Qt::PointingHandCursor); - setAttribute(Qt::WA_Hover, true); - - QList<QString> url_parts = url_.toString().split("mxc://"); - - if (url_parts.size() != 2) { - qDebug() << "Invalid format for image" << url_.toString(); - return; - } - - QString media_params = url_parts[1]; - url_ = QString("%1/_matrix/media/r0/download/%2") - .arg(http::client()->getHomeServer().toString(), media_params); - - auto proxy = http::client()->downloadImage(url_); - - connect(proxy.data(), - &DownloadMediaProxy::imageDownloaded, - this, - [proxy, this](const QPixmap &img) { - proxy->deleteLater(); - setImage(img); - }); + init(); } void @@ -102,8 +103,15 @@ ImageItem::openUrl() if (url_.toString().isEmpty()) return; - if (!QDesktopServices::openUrl(url_)) - qWarning() << "Could not open url" << url_.toString(); + auto mxc_parts = mtx::client::utils::parse_mxc_url(url_.toString().toStdString()); + auto urlToOpen = QString("https://%1:%2/_matrix/media/r0/download/%3/%4") + .arg(QString::fromStdString(http::v2::client()->server())) + .arg(http::v2::client()->port()) + .arg(QString::fromStdString(mxc_parts.server)) + .arg(QString::fromStdString(mxc_parts.media_id)); + + if (!QDesktopServices::openUrl(urlToOpen)) + qWarning() << "Could not open url" << urlToOpen; } QSize @@ -231,23 +239,17 @@ ImageItem::saveAs() if (filename.isEmpty()) return; - auto proxy = http::client()->downloadFile(url_); - connect(proxy.data(), - &DownloadMediaProxy::fileDownloaded, - this, - [proxy, filename](const QByteArray &data) { - proxy->deleteLater(); - - try { - QFile file(filename); - - if (!file.open(QIODevice::WriteOnly)) - return; + http::v2::client()->download( + url_.toString().toStdString(), + [this, filename](const std::string &data, + const std::string &, + const std::string &, + mtx::http::RequestErr err) { + if (err) { + qWarning() << "failed to retrieve image:" << url_; + return; + } - file.write(data); - file.close(); - } catch (const std::exception &ex) { - qDebug() << "Error while saving file to:" << ex.what(); - } - }); + emit imageSaved(filename, QByteArray(data.data(), data.size())); + }); } diff --git a/src/timeline/widgets/VideoItem.cc b/src/timeline/widgets/VideoItem.cc
index f5bcfd6e..c1f68847 100644 --- a/src/timeline/widgets/VideoItem.cc +++ b/src/timeline/widgets/VideoItem.cc
@@ -27,15 +27,15 @@ void VideoItem::init() { - QList<QString> url_parts = url_.toString().split("mxc://"); - if (url_parts.size() != 2) { - qDebug() << "Invalid format for image" << url_.toString(); - return; - } + // QList<QString> url_parts = url_.toString().split("mxc://"); + // if (url_parts.size() != 2) { + // qDebug() << "Invalid format for image" << url_.toString(); + // return; + // } - QString media_params = url_parts[1]; - url_ = QString("%1/_matrix/media/r0/download/%2") - .arg(http::client()->getHomeServer().toString(), media_params); + // QString media_params = url_parts[1]; + // url_ = QString("%1/_matrix/media/r0/download/%2") + // .arg(http::client()->getHomeServer().toString(), media_params); } VideoItem::VideoItem(const mtx::events::RoomEvent<mtx::events::msg::Video> &event, QWidget *parent)