From a780d365fe9740d6533f4667fc8220eac148cd7d Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Tue, 13 Sep 2022 23:11:19 +0200 Subject: Implement XEP-0447: Stateless file sharing: File sharing element (#448) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements parsing for the file sharing element from XEP-0447: Stateless files sharing version 0.2. https://xmpp.org/extensions/xep-0447.html Co-authored-by: Jonah BrĂ¼chert --- src/base/QXmppFileShare.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/base/QXmppFileShare.h (limited to 'src/base/QXmppFileShare.h') diff --git a/src/base/QXmppFileShare.h b/src/base/QXmppFileShare.h new file mode 100644 index 00000000..7d38df23 --- /dev/null +++ b/src/base/QXmppFileShare.h @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: 2022 Linus Jahn +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifndef QXMPPFILESHARE_H +#define QXMPPFILESHARE_H + +#include "QXmppGlobal.h" + +#include + +class QDomElement; +class QUrl; +class QXmlStreamWriter; +class QXmppFileSharePrivate; +class QXmppFileMetadata; + +class QXMPP_EXPORT QXmppFileShare +{ +public: + enum Disposition { + Inline, + Attachment, + }; + + QXmppFileShare(); + QXmppFileShare(const QXmppFileShare &); + QXmppFileShare(QXmppFileShare &&) noexcept; + ~QXmppFileShare(); + + QXmppFileShare &operator=(const QXmppFileShare &); + QXmppFileShare &operator=(QXmppFileShare &&) noexcept; + + Disposition disposition() const; + void setDisposition(Disposition); + + const QXmppFileMetadata &metadata() const; + void setMetadata(const QXmppFileMetadata &); + + const QVector &httpSources() const; + void setHttpSources(const QVector &newHttpSources); + + /// \cond + bool parse(const QDomElement &el); + void toXml(QXmlStreamWriter *writer) const; + /// \endcond + +private: + QSharedDataPointer d; +}; + +#endif // QXMPPFILESHARE_H -- cgit v1.2.3