diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-29 12:46:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-29 12:46:11 +0200 |
commit | 346c36768e145435a54ce0ba6138af916410cbea (patch) | |
tree | fb78230a898754b2df982b890a4129839937f110 /lib/eventitem.cpp | |
parent | 729ba7da174eacc88bf9bd4e2e80eeab3fc92716 (diff) | |
parent | 0f8335a32debc4c61d9fc9875c79c0ba6ba05357 (diff) | |
download | libquotient-346c36768e145435a54ce0ba6138af916410cbea.tar.gz libquotient-346c36768e145435a54ce0ba6138af916410cbea.zip |
Merge pull request #556 from quotient-im/kitsune/fixes
Cleanup and refactoring
Diffstat (limited to 'lib/eventitem.cpp')
-rw-r--r-- | lib/eventitem.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/eventitem.cpp b/lib/eventitem.cpp index 302ae053..a2e2a156 100644 --- a/lib/eventitem.cpp +++ b/lib/eventitem.cpp @@ -8,32 +8,23 @@ using namespace Quotient; -void PendingEventItem::setFileUploaded(const QUrl& remoteUrl) +void PendingEventItem::setFileUploaded(const FileSourceInfo& uploadedFileData) { // TODO: eventually we might introduce hasFileContent to RoomEvent, // and unify the code below. if (auto* rme = getAs<RoomMessageEvent>()) { Q_ASSERT(rme->hasFileContent()); - rme->editContent([remoteUrl](EventContent::TypedBase& ec) { - ec.fileInfo()->url = remoteUrl; + rme->editContent([&uploadedFileData](EventContent::TypedBase& ec) { + ec.fileInfo()->source = uploadedFileData; }); } if (auto* rae = getAs<RoomAvatarEvent>()) { Q_ASSERT(rae->content().fileInfo()); - rae->editContent( - [remoteUrl](EventContent::FileInfo& fi) { fi.url = remoteUrl; }); - } - setStatus(EventStatus::FileUploaded); -} - -void PendingEventItem::setEncryptedFile(const EncryptedFile& encryptedFile) -{ - if (auto* rme = getAs<RoomMessageEvent>()) { - Q_ASSERT(rme->hasFileContent()); - rme->editContent([encryptedFile](EventContent::TypedBase& ec) { - ec.fileInfo()->file = encryptedFile; + rae->editContent([&uploadedFileData](EventContent::FileInfo& fi) { + fi.source = uploadedFileData; }); } + setStatus(EventStatus::FileUploaded); } // Not exactly sure why but this helps with the linker not finding |