From 68f167995e7ba71a6f2e556a7a0eab3d234e2d1a Mon Sep 17 00:00:00 2001 From: Jonah BrĂ¼chert Date: Fri, 9 Sep 2022 23:15:10 +0200 Subject: Implement XEP-0448: Stateless File Sharing This adds a file sharing manager that is capable of using multiple back ends. Currently implemented are a normal HTTP File Upload backend and an encrypted HTTP File Upload. Jingle File Transfer could be implemented later. Co-authored-by: Linus Jahn --- src/base/QXmppUtils.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/base/QXmppUtils.cpp') diff --git a/src/base/QXmppUtils.cpp b/src/base/QXmppUtils.cpp index 7ae74ba3..e0225d77 100644 --- a/src/base/QXmppUtils.cpp +++ b/src/base/QXmppUtils.cpp @@ -403,4 +403,15 @@ void QXmpp::Private::generateRandomBytes(uint8_t *bytes, uint32_t byteCount) #endif } +float QXmpp::Private::calculateProgress(qint64 transferred, qint64 total) +{ + if (total > 0) { + if (transferred > total) { + return 1; + } + return float(transferred) / total; + } + + return 0; +} /// \endcond -- cgit v1.2.3