QXmpp  Version:1.3.0
QXmppUploadRequestManager.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Author:
5  * Linus Jahn
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPUPLOADREQUESTMANAGER_H
25 #define QXMPPUPLOADREQUESTMANAGER_H
26 
27 #include <QXmppClientExtension.h>
28 
29 #include <QSharedDataPointer>
30 
31 class QFileInfo;
32 class QMimeType;
35 class QXmppUploadServicePrivate;
36 class QXmppUploadRequestManagerPrivate;
37 
41 
42 class QXMPP_EXPORT QXmppUploadService
43 {
44 public:
48 
49  QXmppUploadService &operator=(const QXmppUploadService &);
50 
51  QString jid() const;
52  void setJid(const QString &jid);
53 
54  qint64 sizeLimit() const;
55  void setSizeLimit(qint64 sizeLimit);
56 
57 private:
58  QSharedDataPointer<QXmppUploadServicePrivate> d;
59 };
60 
98 {
99  Q_OBJECT
100 
101 public:
104 
105  QString requestUploadSlot(const QFileInfo &file,
106  const QString &uploadService = QString());
107  QString requestUploadSlot(const QFileInfo &file,
108  const QString &customFileName,
109  const QString &uploadService = QString());
110  QString requestUploadSlot(const QString &fileName,
111  qint64 fileSize,
112  const QMimeType &mimeType,
113  const QString &uploadService = QString());
114 
115  bool serviceFound() const;
116 
117  QVector<QXmppUploadService> uploadServices() const;
118 
119  bool handleStanza(const QDomElement &stanza) override;
120 
121 Q_SIGNALS:
123  void slotReceived(const QXmppHttpUploadSlotIq &slot);
124 
128  void requestFailed(const QXmppHttpUploadRequestIq &request);
129 
131  void serviceFoundChanged();
132 
133 protected:
134  void setClient(QXmppClient *client) override;
135 
136 private:
137  void handleDiscoInfo(const QXmppDiscoveryIq &iq);
138 
139  QSharedDataPointer<QXmppUploadRequestManagerPrivate> d;
140 };
141 
142 #endif // QXMPPUPLOADREQUESTMANAGER_H
QXmppUploadService
QXmppUploadService represents an HTTP File Upload service.
Definition: QXmppUploadRequestManager.h:42
QXmppHttpUploadSlotIq
Represents an HTTP File Upload IQ result for receiving an upload slot as defined by XEP-0363: HTTP Fi...
Definition: QXmppHttpUploadIq.h:81
QXmppHttpUploadRequestIq
Represents an HTTP File Upload IQ for requesting an upload slot as defined by XEP-0363: HTTP File Upl...
Definition: QXmppHttpUploadIq.h:44
QXmppClientExtension
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
QXmppClientExtension::setClient
virtual void setClient(QXmppClient *client)
Definition: QXmppClientExtension.cpp:79
QXmppUploadRequestManager
The QXmppUploadRequestManager implements the core of XEP-0369: HTTP File Upload.
Definition: QXmppUploadRequestManager.h:97
QXmppClient
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:94
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
QXmppDiscoveryIq
QXmppDiscoveryIq represents a discovery IQ request or result containing a list of features and other ...
Definition: QXmppDiscoveryIq.h:43