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/QXmppIbbTransferJob.h | |
| parent | 239b2b15c3cfd9e4d7cc085ed31645d6ae6942ee (diff) | |
| download | qxmpp-10c093a617929db5c6b201dbf03d6070b12b36b4.tar.gz | |
Issue 15: Implement XEP-0047
Diffstat (limited to 'source/QXmppIbbTransferJob.h')
| -rw-r--r-- | source/QXmppIbbTransferJob.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/source/QXmppIbbTransferJob.h b/source/QXmppIbbTransferJob.h new file mode 100644 index 00000000..2c14c03d --- /dev/null +++ b/source/QXmppIbbTransferJob.h @@ -0,0 +1,66 @@ +#ifndef QXMPPIBBTRANSFERJOB_H
+#define QXMPPIBBTRANSFERJOB_H
+
+#include <QObject>
+class QIODevice;
+class QXmppIbbOpenIq;
+class QXmppIbbCloseIq;
+class QXmppIbbErrorIq;
+class QXmppDataIq;
+class QXmppClient;
+
+class QXmppIbbTransferJob : public QObject
+{
+ Q_OBJECT
+public:
+
+ QXmppIbbTransferJob(QXmppClient *parent = 0);
+ ~QXmppIbbTransferJob();
+ QString getSid() const;
+ void setSid( const QString &sid );
+ QString getRemoteJid( ) const;
+ void setRemoteJid( const QString &jid );
+ QString getId() const;
+ void setId( const QString &id );
+
+// Used by the client
+public slots:
+ void requestTransfer( );
+ void acceptTransfer( );
+ void cancelTransfer( );
+
+signals:
+ void transferRequested( const QString &sid, const QString &remoteJid );
+ void transferStarted( const QString &sid );
+ void transferFinished( const QString &sid, const QString &reason);
+ void transferCanceled( const QString &sid, const QString &reason );
+ void readyForTeardown( const QString &sid );
+
+public:
+ void setIoDevice( QIODevice *io );
+ void setBlockSize( long size);
+
+ // Used by the stream.
+ void gotAck();
+ void gotOpen( const QXmppIbbOpenIq &open );
+ void gotClose( const QXmppIbbCloseIq &close );
+ void gotError( const QXmppIbbErrorIq &err );
+ void gotData( const QXmppDataIq &data );
+
+private:
+ enum TransferState { Idle, Requesting, Pending, TransferringIn, TransferringOut };
+ void sendNextBlock();
+
+ QXmppClient *m_client;
+ QIODevice *m_io;
+ long m_blockSize;
+ qint64 m_streamBlockSize;
+ quint16 m_sequence;
+ QString m_sid;
+ QString m_id;
+ QString m_localJid;
+ QString m_remoteJid;
+ TransferState m_state;
+};
+
+#endif // QXMPPIBBTRANSFERJOB_H
|
