summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-06-03 18:11:02 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-06-03 18:11:02 (GMT)
commitc3fa606c7ac060c4929e7082e0e24531b093112f (patch)
tree394cf72c0b43fa706319592dfdb1438335b6116a /Swiften/Elements
parent8406d818fcb2a511b1e4264a10fd9069ec020d72 (diff)
downloadswift-contrib-c3fa606c7ac060c4929e7082e0e24531b093112f.zip
swift-contrib-c3fa606c7ac060c4929e7082e0e24531b093112f.tar.bz2
Distinguish an empty SASL message from no SASL message.
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/AuthChallenge.h13
-rw-r--r--Swiften/Elements/AuthRequest.h22
-rw-r--r--Swiften/Elements/AuthResponse.h16
-rw-r--r--Swiften/Elements/AuthSuccess.h8
4 files changed, 40 insertions, 19 deletions
diff --git a/Swiften/Elements/AuthChallenge.h b/Swiften/Elements/AuthChallenge.h
index 21486df..74d7dba 100644
--- a/Swiften/Elements/AuthChallenge.h
+++ b/Swiften/Elements/AuthChallenge.h
@@ -6,24 +6,29 @@
#pragma once
+#include <boost/optional.hpp>
+
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Elements/Element.h"
namespace Swift {
class AuthChallenge : public Element {
public:
- AuthChallenge(const ByteArray& value = "") : value(value) {
+ AuthChallenge() {
+ }
+
+ AuthChallenge(const ByteArray& value) : value(value) {
}
- const ByteArray& getValue() const {
+ const boost::optional<ByteArray>& getValue() const {
return value;
}
void setValue(const ByteArray& value) {
- this->value = value;
+ this->value = boost::optional<ByteArray>(value);
}
private:
- ByteArray value;
+ boost::optional<ByteArray> value;
};
}
diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h
index 45ea743..a1aac31 100644
--- a/Swiften/Elements/AuthRequest.h
+++ b/Swiften/Elements/AuthRequest.h
@@ -4,8 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_AuthRequest_H
-#define SWIFTEN_AuthRequest_H
+#pragma once
+
+#include <boost/optional.hpp>
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Elements/Element.h"
@@ -13,16 +14,23 @@
namespace Swift {
class AuthRequest : public Element {
public:
- AuthRequest(const String& mechanism = "", const ByteArray& message = "") :
+ AuthRequest(const String& mechanism = "") : mechanism_(mechanism) {
+ }
+
+ AuthRequest(const String& mechanism, const ByteArray& message) :
mechanism_(mechanism), message_(message) {
}
- const ByteArray& getMessage() const {
+ AuthRequest(const String& mechanism, const boost::optional<ByteArray>& message) :
+ mechanism_(mechanism), message_(message) {
+ }
+
+ const boost::optional<ByteArray>& getMessage() const {
return message_;
}
void setMessage(const ByteArray& message) {
- message_ = message;
+ message_ = boost::optional<ByteArray>(message);
}
const String& getMechanism() const {
@@ -35,8 +43,6 @@ namespace Swift {
private:
String mechanism_;
- ByteArray message_;
+ boost::optional<ByteArray> message_;
};
}
-
-#endif
diff --git a/Swiften/Elements/AuthResponse.h b/Swiften/Elements/AuthResponse.h
index baea83a..96d1b13 100644
--- a/Swiften/Elements/AuthResponse.h
+++ b/Swiften/Elements/AuthResponse.h
@@ -6,24 +6,32 @@
#pragma once
+#include <boost/optional.hpp>
+
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Elements/Element.h"
namespace Swift {
class AuthResponse : public Element {
public:
- AuthResponse(const ByteArray& value = "") : value(value) {
+ AuthResponse() {
+ }
+
+ AuthResponse(const ByteArray& value) : value(value) {
+ }
+
+ AuthResponse(const boost::optional<ByteArray>& value) : value(value) {
}
- const ByteArray& getValue() const {
+ const boost::optional<ByteArray>& getValue() const {
return value;
}
void setValue(const ByteArray& value) {
- this->value = value;
+ this->value = boost::optional<ByteArray>(value);
}
private:
- ByteArray value;
+ boost::optional<ByteArray> value;
};
}
diff --git a/Swiften/Elements/AuthSuccess.h b/Swiften/Elements/AuthSuccess.h
index 5c0faad..af5f9bb 100644
--- a/Swiften/Elements/AuthSuccess.h
+++ b/Swiften/Elements/AuthSuccess.h
@@ -6,6 +6,8 @@
#pragma once
+#include <boost/optional.hpp>
+
#include "Swiften/Elements/Element.h"
#include "Swiften/Base/ByteArray.h"
@@ -14,15 +16,15 @@ namespace Swift {
public:
AuthSuccess() {}
- const ByteArray& getValue() const {
+ const boost::optional<ByteArray>& getValue() const {
return value;
}
void setValue(const ByteArray& value) {
- this->value = value;
+ this->value = boost::optional<ByteArray>(value);
}
private:
- ByteArray value;
+ boost::optional<ByteArray> value;
};
}