summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-06 15:48:27 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-11 21:53:43 (GMT)
commit6f31cc8a329d15767d54511edd14339ac3dfdd7a (patch)
treed41bdb8af487fed788f7a9bc88b1ab08ff567272 /Swiften/Elements
parentebccdadcae24932b299a8612a9c6e0cdc4e00249 (diff)
downloadswift-6f31cc8a329d15767d54511edd14339ac3dfdd7a.zip
swift-6f31cc8a329d15767d54511edd14339ac3dfdd7a.tar.bz2
Added support for Entity Capabilities.
Resolves: #94
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/CapsInfo.h39
-rw-r--r--Swiften/Elements/DiscoInfo.h3
-rw-r--r--Swiften/Elements/Presence.h4
3 files changed, 39 insertions, 7 deletions
diff --git a/Swiften/Elements/CapsInfo.h b/Swiften/Elements/CapsInfo.h
index 6fde13b..0fce90c 100644
--- a/Swiften/Elements/CapsInfo.h
+++ b/Swiften/Elements/CapsInfo.h
@@ -4,20 +4,49 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_CapsInfo_H
-#define SWIFTEN_CapsInfo_H
+#pragma once
#include "Swiften/Base/String.h"
+#include "Swiften/Base/Shared.h"
#include "Swiften/Elements/Payload.h"
namespace Swift {
- class CapsInfo : public Payload {
+ class CapsInfo : public Payload, public Shared<CapsInfo> {
public:
- CapsInfo(const String& node, const String& version, const String& hash = "sha-1") : node_(node), version_(version), hash_(hash) {}
+ CapsInfo(const String& node = "", const String& version = "", const String& hash = "sha-1") : node_(node), version_(version), hash_(hash) {}
+
+ bool operator==(const CapsInfo& o) const {
+ return o.node_ == node_ && o.version_ == version_ && o.hash_ == hash_;
+ }
+
+ bool operator<(const CapsInfo& o) const {
+ if (o.node_ == node_) {
+ if (o.version_ == version_) {
+ return hash_ < o.hash_;
+ }
+ else {
+ return version_ < o.version_;
+ }
+ }
+ else {
+ return node_ < o.node_;
+ }
+ }
const String& getNode() const { return node_; }
+ void setNode(const String& node) {
+ node_ = node;
+ }
+
const String& getVersion() const { return version_; }
+ void setVersion(const String& version) {
+ version_ = version;
+ }
+
const String& getHash() const { return hash_; }
+ void setHash(const String& hash) {
+ hash_ = hash;
+ }
private:
String node_;
@@ -25,5 +54,3 @@ namespace Swift {
String hash_;
};
}
-
-#endif
diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h
index af4a5dc..cee9200 100644
--- a/Swiften/Elements/DiscoInfo.h
+++ b/Swiften/Elements/DiscoInfo.h
@@ -12,9 +12,10 @@
#include "Swiften/Elements/Payload.h"
#include "Swiften/Base/String.h"
+#include "Swiften/Base/Shared.h"
namespace Swift {
- class DiscoInfo : public Payload {
+ class DiscoInfo : public Payload, public Shared<DiscoInfo> {
public:
const static std::string SecurityLabels;
class Identity {
diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h
index 0789b18..7297339 100644
--- a/Swiften/Elements/Presence.h
+++ b/Swiften/Elements/Presence.h
@@ -62,6 +62,10 @@ namespace Swift {
return boost::shared_ptr<Presence>(new Presence(*this));
}
+ bool isAvailable() const {
+ return type_ == Available;
+ }
+
private:
Presence::Type type_;
};