diff options
| author | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2009-10-27 12:04:03 +0000 |
|---|---|---|
| committer | Manjeet Dahiya <manjeetdahiya@gmail.com> | 2009-10-27 12:04:03 +0000 |
| commit | 10c093a617929db5c6b201dbf03d6070b12b36b4 (patch) | |
| tree | d9b1c4507fdb1969c3225f27b4632258c4916dc0 /source/QXmppIbbTransferManager.h | |
| parent | 239b2b15c3cfd9e4d7cc085ed31645d6ae6942ee (diff) | |
| download | qxmpp-10c093a617929db5c6b201dbf03d6070b12b36b4.tar.gz | |
Issue 15: Implement XEP-0047
Diffstat (limited to 'source/QXmppIbbTransferManager.h')
| -rw-r--r-- | source/QXmppIbbTransferManager.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/source/QXmppIbbTransferManager.h b/source/QXmppIbbTransferManager.h new file mode 100644 index 00000000..d812b3fe --- /dev/null +++ b/source/QXmppIbbTransferManager.h @@ -0,0 +1,60 @@ +#ifndef QXMPPIBBTRANSFERMANAGER_H
+#define QXMPPIBBTRANSFERMANAGER_H
+
+#include <QObject>
+#include <QHash>
+#include "QXmppIbbTransferJob.h"
+
+class QXmppClient;
+
+class QXmppIbbTransferManager : public QObject
+{
+public:
+ QXmppIbbTransferManager(QXmppClient* client);
+
+signals:
+ /// Notifies that a XMPP bytestream request has been received. The
+ /// program must either reply with an acceptByteStreamRequest(...) or
+ /// a rejectByteStreamRequest(...) depending on the desired response.
+ void byteStreamRequestReceived( const QString &sid, const QString &remoteJid );
+ /// Notifies that a XMPP bytestream has been closed.
+ void byteStreamClosed( const QString &sid , const QString &reason );
+ /// Notifies that a XMPP bytestream was canceled by the remote peer.
+ /// The reason is given for the cancelation.
+ void byteStreamCanceled( const QString &sid , const QString &reason );
+ /// Notifes that the XMPP bytestream has been opened and the transfer
+ /// has started.
+ void byteStreamOpened( const QString &sid );
+
+public:
+ QXmppIbbTransferJob *getIbbTransferJob( const QString &id );
+ bool isIbbTransferJobId( const QString &id );
+
+public slots:
+ /// Send a request to open a bytestream to a specific jid. Once the
+ /// stream is opened then the data is read from the QIODevice. The
+ /// QIODevice MUST be be open and ready for reading otherwise the
+ /// transfer will fail. When there are no more bytes available to
+ /// send from the QIODevice then the bytestream is closed.
+ void sendByteStreamRequest( const QString &sid, const QString &bareJid, QIODevice *io);
+ /// Accept a bytestream with a specific sid. Data from the remote
+ /// peer is then written to the QIODevice. Therefor the QIODevice must
+ /// be open and ready for writing before this method is called.
+ void acceptByteStreamRequest( const QString &sid, QIODevice *io );
+ /// Rejects a bytestream from a specific sid.
+ void rejectByteStreamRequest( const QString &sid );
+ /// Cacels a currenly connected bytestream with a specific sid.
+ void cancelByteStreamRequest( const QString &sid );
+
+private slots:
+ void addIbbTransferManager( QXmppIbbTransferJob *mgr );
+ void teardownIbbTransferManager( const QString &sid );
+
+private:
+ QXmppIbbTransferJob *getIbbTransferJobBySid( const QString &sid );
+
+ QXmppClient* m_client;
+ QHash<QString, QXmppIbbTransferJob*> m_activeTransfers;
+};
+
+#endif // QXMPPIBBTRANSFERMANAGER_H
|
