summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-01-29 17:48:13 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-01-29 18:45:34 (GMT)
commit869c52b244c2d03313e9eda83fac05bf0fc3a619 (patch)
tree63f0518e15d0c23ece6eb55733c2ef44f710bf01 /Swiften/Elements/JinglePayload.h
parent11a7f5c48ea9c90e9adaaa06a96e0a9116234bff (diff)
downloadswift-869c52b244c2d03313e9eda83fac05bf0fc3a619.zip
swift-869c52b244c2d03313e9eda83fac05bf0fc3a619.tar.bz2
Added some experimental Jingle classes.
Diffstat (limited to 'Swiften/Elements/JinglePayload.h')
-rw-r--r--Swiften/Elements/JinglePayload.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h
new file mode 100644
index 0000000..66b6d43
--- /dev/null
+++ b/Swiften/Elements/JinglePayload.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2011 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/JID/JID.h>
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/JingleContent.h>
+
+
+namespace Swift {
+ class JinglePayload : public Payload {
+ public:
+ typedef boost::shared_ptr<JinglePayload> ref;
+ struct Reason {
+ enum Type {
+ AlternativeSession,
+ Busy,
+ Cancel,
+ ConnectivityError,
+ Decline,
+ Expired,
+ FailedApplication,
+ FailedTransport,
+ GeneralError,
+ Gone,
+ IncompatibleParameters,
+ MediaError,
+ SecurityError,
+ Success,
+ Timeout,
+ UnsupportedApplications,
+ UnsupportedTransports
+ };
+
+ Reason(Type type, const String& text = "") : type(type), text(text) {}
+ Type type;
+ String text;
+ };
+
+ enum Action {
+ ContentAccept,
+ ContentAdd,
+ ContentModify,
+ ContentReject,
+ ContentRemove,
+ DescriptionInfo,
+ SecurityInfo,
+ SessionAccept,
+ SessionInfo,
+ SessionInitiate,
+ SessionTerminate,
+ TransportAccept,
+ TransportInfo,
+ TransportReject,
+ TransportReplace
+ };
+
+ JinglePayload(Action action, const String& sessionID) : action(action), sessionID(sessionID) {
+ }
+
+ void setAction(Action action) {
+ this->action = action;
+ }
+
+ Action getAction() const {
+ return action;
+ }
+
+ void setInitiator(const JID& initiator) {
+ this->initiator = initiator;
+ }
+
+ const JID& getInitiator() const {
+ return initiator;
+ }
+
+ void setResponder(const JID& responder) {
+ this->responder = responder;
+ }
+
+ const JID& getResponder() const {
+ return responder;
+ }
+
+ void setSessionID(const String& id) {
+ sessionID = id;
+ }
+
+ const String& getSessionID() const {
+ return sessionID;
+ }
+
+ void addContent(JingleContent::ref content) {
+ this->contents.push_back(content);
+ }
+
+ const std::vector<JingleContent::ref> getContents() const {
+ return contents;
+ }
+
+ void setReason(const Reason& reason) {
+ this->reason = reason;
+ }
+
+ const boost::optional<Reason>& getReason() const {
+ return reason;
+ }
+
+ private:
+ Action action;
+ JID initiator;
+ JID responder;
+ String sessionID;
+ std::vector<JingleContent::ref> contents;
+ boost::optional<Reason> reason;
+ };
+}