summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-17 12:13:36 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-21 18:25:00 (GMT)
commit1b58ef2af54456004390a0888c3edf104e3baa99 (patch)
treedbe4ae29de1b765a88ea704dfaa1c03af4b196b3 /Swiften/Elements/StreamInitiation.h
parent07402c4e3451f2084a1c3ddc5bacfb38a66899a7 (diff)
downloadswift-1b58ef2af54456004390a0888c3edf104e3baa99.zip
swift-1b58ef2af54456004390a0888c3edf104e3baa99.tar.bz2
Added beginnings of outgoing file transfer to Swiften.
Diffstat (limited to 'Swiften/Elements/StreamInitiation.h')
-rw-r--r--Swiften/Elements/StreamInitiation.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h
new file mode 100644
index 0000000..fdf2399
--- /dev/null
+++ b/Swiften/Elements/StreamInitiation.h
@@ -0,0 +1,76 @@
+/*
+ * 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 <vector>
+#include <boost/optional.hpp>
+
+#include "Swiften/Base/String.h"
+#include "Swiften/Base/Shared.h"
+#include "Swiften/Elements/Payload.h"
+
+namespace Swift {
+ class StreamInitiation : public Payload, public Shared<StreamInitiation> {
+ public:
+ struct FileInfo {
+ FileInfo(const String& name = "", const String& description = "", int size = -1) : name(name), description(description), size(size) {}
+
+ String name;
+ String description;
+ int size;
+ };
+
+ StreamInitiation() : isFileTransfer(true) {}
+
+ const String& getID() const {
+ return id;
+ }
+
+ void setID(const String& id) {
+ this->id = id;
+ }
+
+ const boost::optional<FileInfo>& getFileInfo() const {
+ return fileInfo;
+ }
+
+ void setFileInfo(const FileInfo& info) {
+ fileInfo = info;
+ }
+
+ const std::vector<String>& getProvidedMethods() const {
+ return providedMethods;
+ }
+
+ void addProvidedMethod(const String& method) {
+ providedMethods.push_back(method);
+ }
+
+ void setRequestedMethod(const String& method) {
+ requestedMethod = method;
+ }
+
+ const String& getRequestedMethod() const {
+ return requestedMethod;
+ }
+
+ bool getIsFileTransfer() const {
+ return isFileTransfer;
+ }
+
+ void setIsFileTransfer(bool b) {
+ isFileTransfer = b;
+ }
+
+ private:
+ bool isFileTransfer;
+ String id;
+ boost::optional<FileInfo> fileInfo;
+ std::vector<String> providedMethods;
+ String requestedMethod;
+ };
+}