QXmppUploadRequestManager.h
/*
* Copyright (C) 2008-2021 The QXmpp developers
*
* Author:
* Linus Jahn
*
* Source:
* https://github.com/qxmpp-project/qxmpp
*
* This file is a part of QXmpp library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
#ifndef QXMPPUPLOADREQUESTMANAGER_H
#define QXMPPUPLOADREQUESTMANAGER_H
#include <QXmppClientExtension.h>
#include <QSharedDataPointer>
class QFileInfo;
class QMimeType;
class QXmppHttpUploadRequestIq;
class QXmppHttpUploadSlotIq;
class QXmppUploadServicePrivate;
class QXmppUploadRequestManagerPrivate;
class QXMPP_EXPORT QXmppUploadService
{
public:
QXmppUploadService();
QXmppUploadService(const QXmppUploadService &);
~QXmppUploadService();
QXmppUploadService &operator=(const QXmppUploadService &);
QString jid() const;
void setJid(const QString &jid);
qint64 sizeLimit() const;
void setSizeLimit(qint64 sizeLimit);
private:
QSharedDataPointer<QXmppUploadServicePrivate> d;
};
class QXMPP_EXPORT QXmppUploadRequestManager : public QXmppClientExtension
{
Q_OBJECT
public:
QXmppUploadRequestManager();
~QXmppUploadRequestManager();
QString requestUploadSlot(const QFileInfo &file,
const QString &uploadService = QString());
QString requestUploadSlot(const QFileInfo &file,
const QString &customFileName,
const QString &uploadService = QString());
QString requestUploadSlot(const QString &fileName,
qint64 fileSize,
const QMimeType &mimeType,
const QString &uploadService = QString());
bool serviceFound() const;
QVector<QXmppUploadService> uploadServices() const;
bool handleStanza(const QDomElement &stanza) override;
Q_SIGNALS:
void slotReceived(const QXmppHttpUploadSlotIq &slot);
void requestFailed(const QXmppHttpUploadRequestIq &request);
void serviceFoundChanged();
protected:
void setClient(QXmppClient *client) override;
private:
void handleDiscoInfo(const QXmppDiscoveryIq &iq);
QSharedDataPointer<QXmppUploadRequestManagerPrivate> d;
};
#endif // QXMPPUPLOADREQUESTMANAGER_H
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppClient
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:94
QXmppDiscoveryIq
QXmppDiscoveryIq represents a discovery IQ request or result containing a list of features and other ...
Definition: QXmppDiscoveryIq.h:44
QXmppHttpUploadRequestIq
Represents an HTTP File Upload IQ for requesting an upload slot as defined by XEP-0363: HTTP File Upl...
Definition: QXmppHttpUploadIq.h:45
QXmppHttpUploadSlotIq
Represents an HTTP File Upload IQ result for receiving an upload slot as defined by XEP-0363: HTTP Fi...
Definition: QXmppHttpUploadIq.h:82
QXmppUploadRequestManager
The QXmppUploadRequestManager implements the core of XEP-0369: HTTP File Upload.
Definition: QXmppUploadRequestManager.h:98
QXmppUploadRequestManager::requestFailed
void requestFailed(const QXmppHttpUploadRequestIq &request)
QXmppUploadRequestManager::serviceFoundChanged
void serviceFoundChanged()
Emitted when the first upload service has been found.
QXmppUploadRequestManager::slotReceived
void slotReceived(const QXmppHttpUploadSlotIq &slot)
Emitted when an upload slot was received.
QXmppUploadService
QXmppUploadService represents an HTTP File Upload service.
Definition: QXmppUploadRequestManager.h:43
QXmppUploadService::QXmppUploadService
QXmppUploadService(const QXmppUploadService &)
Copy constructor.
QXmppUploadService::operator=
QXmppUploadService & operator=(const QXmppUploadService &)
Equal operator.