summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-03-04 10:56:07 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-03-04 10:58:16 (GMT)
commit37bfeaf6f2e0145731c32f79291ff3d48ae0e1b1 (patch)
treee6455b4f21b3a5ba716526916a67cfd4b7e55051 /Swiften/Elements
parent12024229138787d7df91cb8101d0986996880e3d (diff)
downloadswift-contrib-37bfeaf6f2e0145731c32f79291ff3d48ae0e1b1.zip
swift-contrib-37bfeaf6f2e0145731c32f79291ff3d48ae0e1b1.tar.bz2
Upgrade XEP-0258 support to match 0.6.
Resolves: #183 Release-Notes: Security labels (XEP-0258) support has been updated to match the latest version of the specification.
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/DiscoInfo.cpp2
-rw-r--r--Swiften/Elements/DiscoInfo.h2
-rw-r--r--Swiften/Elements/SecurityLabelsCatalog.h37
3 files changed, 34 insertions, 7 deletions
diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp
index 9c43ef4..7ed8e88 100644
--- a/Swiften/Elements/DiscoInfo.cpp
+++ b/Swiften/Elements/DiscoInfo.cpp
@@ -10,6 +10,7 @@ namespace Swift {
const std::string DiscoInfo::ChatStatesFeature = std::string("http://jabber.org/protocol/chatstates");
const std::string DiscoInfo::SecurityLabelsFeature = std::string("urn:xmpp:sec-label:0");
+const std::string DiscoInfo::SecurityLabelsCatalogueFeature = std::string("urn:xmpp:sec-label:catalog:2");
const std::string DiscoInfo::JabberSearchFeature = std::string("jabber:iq:search");
@@ -32,5 +33,4 @@ bool DiscoInfo::Identity::operator<(const Identity& other) const {
}
}
-const std::string DiscoInfo::SecurityLabels = "urn:xmpp:sec-label:0";
}
diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h
index 5101884..e433b26 100644
--- a/Swiften/Elements/DiscoInfo.h
+++ b/Swiften/Elements/DiscoInfo.h
@@ -21,9 +21,9 @@ namespace Swift {
static const std::string ChatStatesFeature;
static const std::string SecurityLabelsFeature;
+ static const std::string SecurityLabelsCatalogueFeature;
static const std::string JabberSearchFeature;
- const static std::string SecurityLabels;
class Identity {
public:
Identity(const std::string& name, const std::string& category = "client", const std::string& type = "pc", const std::string& lang = "") : name_(name), category_(category), type_(type), lang_(lang) {
diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h
index 1c13fdf..10ef459 100644
--- a/Swiften/Elements/SecurityLabelsCatalog.h
+++ b/Swiften/Elements/SecurityLabelsCatalog.h
@@ -17,14 +17,41 @@
namespace Swift {
class SecurityLabelsCatalog : public Payload {
public:
+ class Item {
+ public:
+ Item() : default_(false) {}
+ const boost::shared_ptr<SecurityLabel> getLabel() const {
+ return label_;
+ }
+
+ void setLabel(boost::shared_ptr<SecurityLabel> label) {
+ label_ = label;
+ }
+
+ const std::string& getSelector() const { return selector_; }
+
+ void setSelector(const std::string& selector) {
+ selector_ = selector;
+ }
+
+ bool getIsDefault() const { return default_; }
+
+ void setIsDefault(bool isDefault) {
+ default_ = isDefault;
+ }
+ private:
+ boost::shared_ptr<SecurityLabel> label_;
+ std::string selector_;
+ bool default_;
+ };
SecurityLabelsCatalog(const JID& to = JID()) : to_(to) {}
- const std::vector<SecurityLabel>& getLabels() const {
- return labels_;
+ const std::vector<Item>& getItems() const {
+ return items_;
}
- void addLabel(const SecurityLabel& label) {
- labels_.push_back(label);
+ void addItem(const Item& item) {
+ items_.push_back(item);
}
const JID& getTo() const {
@@ -55,7 +82,7 @@ namespace Swift {
JID to_;
std::string name_;
std::string description_;
- std::vector<SecurityLabel> labels_;
+ std::vector<Item> items_;
};
}