aboutsummaryrefslogtreecommitdiff
path: root/lib/room.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-26 08:51:22 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-29 08:17:56 +0200
commit0b5e72a2c6502f22a752b72b4df5fa25746fdd25 (patch)
treedba7f9d9030f884f37253c3a1d370784707726f1 /lib/room.h
parent729ba7da174eacc88bf9bd4e2e80eeab3fc92716 (diff)
downloadlibquotient-0b5e72a2c6502f22a752b72b4df5fa25746fdd25.tar.gz
libquotient-0b5e72a2c6502f22a752b72b4df5fa25746fdd25.zip
Refactor EncryptedFile and EC::FileInfo::file
Besides having a misleading name (and it goes back to the spec), EncryptedFile under `file` key preempts the `url` (or `thumbnail_url`) string value so only one of the two should exist. This is a case for using std::variant<> - despite its clumsy syntax, it can actually simplify and streamline code when all the necessary bits are in place (such as conversion to JSON and getting the common piece - the URL - out of it). This commit replaces `FileInfo::url` and `FileInfo::file` with a common field `source` of type `FileSourceInfo` that is an alias for a variant type covering both underlying types; and `url()` is reintroduced as a function instead, to allow simplified access to whichever URL is available inside the variant. Oh, and EncryptedFile is EncryptedFileMetadata now, to clarify that it does not represent the file payload itself but rather the data necessary to obtain that payload.
Diffstat (limited to 'lib/room.h')
-rw-r--r--lib/room.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/room.h b/lib/room.h
index c3bdc4a0..0636c4bb 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -999,7 +999,8 @@ Q_SIGNALS:
void newFileTransfer(QString id, QUrl localFile);
void fileTransferProgress(QString id, qint64 progress, qint64 total);
- void fileTransferCompleted(QString id, QUrl localFile, QUrl mxcUrl, Omittable<EncryptedFile> encryptedFile);
+ void fileTransferCompleted(QString id, QUrl localFile,
+ FileSourceInfo fileMetadata);
void fileTransferFailed(QString id, QString errorMessage = {});
// fileTransferCancelled() is no more here; use fileTransferFailed() and
// check the transfer status instead