QXmpp  Version:1.1.0
QXmppUploadRequestManager.h
1 /*
2  * Copyright (C) 2008-2019 The QXmpp developers
3  *
4  * Author:
5  * Linus Jahn <lnj@kaidan.im>
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 #include <QSharedDataPointer>
29 
30 class QFileInfo;
31 class QMimeType;
34 class QXmppUploadServicePrivate;
35 class QXmppUploadRequestManagerPrivate;
36 
40 
41 class QXMPP_EXPORT QXmppUploadService
42 {
43 public:
47 
48  QXmppUploadService &operator=(const QXmppUploadService &);
49 
50  QString jid() const;
51  void setJid(const QString &jid);
52 
53  qint64 sizeLimit() const;
54  void setSizeLimit(qint64 sizeLimit);
55 
56 private:
57  QSharedDataPointer<QXmppUploadServicePrivate> d;
58 };
59 
94 
96 {
97  Q_OBJECT
98 
99 public:
102 
103  QString requestUploadSlot(const QFileInfo &file,
104  const QString &uploadService = QString());
105  QString requestUploadSlot(const QFileInfo &file,
106  const QString &customFileName,
107  const QString &uploadService = QString());
108  QString requestUploadSlot(const QString &fileName,
109  qint64 fileSize,
110  const QMimeType &mimeType,
111  const QString &uploadService = QString());
112 
113  bool serviceFound() const;
114 
115  QVector<QXmppUploadService> uploadServices() const;
116 
117  bool handleStanza(const QDomElement &stanza) override;
118 
119 signals:
121  void slotReceived(const QXmppHttpUploadSlotIq &slot);
122 
126  void requestFailed(const QXmppHttpUploadRequestIq &request);
127 
129  void serviceFoundChanged();
130 
131 protected:
132  void setClient(QXmppClient *client) override;
133 
134 private:
135  void handleDiscoInfo(const QXmppDiscoveryIq &iq);
136 
137  QSharedDataPointer<QXmppUploadRequestManagerPrivate> d;
138 };
139 
140 #endif // QXMPPUPLOADREQUESTMANAGER_H
QXmppUploadService represents an HTTP File Upload service.
Definition: QXmppUploadRequestManager.h:41
The QXmppUploadRequestManager implements the core of XEP-0369: HTTP File Upload.
Definition: QXmppUploadRequestManager.h:95
Represents an HTTP File Upload IQ for requesting an upload slot as defined by XEP-0363: HTTP File Upl...
Definition: QXmppHttpUploadIq.h:44
Represents an HTTP File Upload IQ result for receiving an upload slot as defined by XEP-0363: HTTP Fi...
Definition: QXmppHttpUploadIq.h:81
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
virtual void setClient(QXmppClient *client)
Definition: QXmppClientExtension.cpp:79
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:80