diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-17 12:13:36 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-21 18:25:00 (GMT) |
commit | 1b58ef2af54456004390a0888c3edf104e3baa99 (patch) | |
tree | dbe4ae29de1b765a88ea704dfaa1c03af4b196b3 /Swiften/Elements/IBB.h | |
parent | 07402c4e3451f2084a1c3ddc5bacfb38a66899a7 (diff) | |
download | swift-contrib-1b58ef2af54456004390a0888c3edf104e3baa99.zip swift-contrib-1b58ef2af54456004390a0888c3edf104e3baa99.tar.bz2 |
Added beginnings of outgoing file transfer to Swiften.
Diffstat (limited to 'Swiften/Elements/IBB.h')
-rw-r--r-- | Swiften/Elements/IBB.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h new file mode 100644 index 0000000..da9c18a --- /dev/null +++ b/Swiften/Elements/IBB.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/Base/String.h" +#include "Swiften/Base/Shared.h" +#include "Swiften/Base/ByteArray.h" +#include "Swiften/Elements/Payload.h" + +namespace Swift { + class IBB : public Payload, public Shared<IBB> { + public: + enum Action { + Open, + Close, + Data, + }; + enum StanzaType { + IQStanza, + MessageStanza, + }; + + IBB(Action action = Open, const String& streamID = "") : action(action), streamID(streamID), stanzaType(IQStanza), blockSize(-1), sequenceNumber(-1) { + } + + static IBB::ref createIBBOpen(const String& streamID, int blockSize) { + IBB::ref result(new IBB(Open, streamID)); + result->setBlockSize(blockSize); + return result; + } + + static IBB::ref createIBBData(const String& streamID, int sequenceNumber, const ByteArray& data) { + IBB::ref result(new IBB(Data, streamID)); + result->setSequenceNumber(sequenceNumber); + result->setData(data); + return result; + } + + static IBB::ref createIBBClose(const String& streamID) { + return IBB::ref(new IBB(Close, streamID)); + } + + void setAction(Action action) { + this->action = action; + } + + Action getAction() const { + return action; + } + + void setStanzaType(StanzaType stanzaType) { + this->stanzaType = stanzaType; + } + + StanzaType getStanzaType() const { + return stanzaType; + } + + void setStreamID(const String& id) { + streamID = id; + } + + const String& getStreamID() const { + return streamID; + } + + const ByteArray& getData() const { + return data; + } + + void setData(const ByteArray& data) { + this->data = data; + } + + int getBlockSize() const { + return blockSize; + } + + void setBlockSize(int blockSize) { + this->blockSize = blockSize; + } + + int getSequenceNumber() const { + return sequenceNumber; + } + + void setSequenceNumber(int i) { + sequenceNumber = i; + } + + private: + Action action; + String streamID; + ByteArray data; + StanzaType stanzaType; + int blockSize; + int sequenceNumber; + }; +} |