diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp | 38 |
2 files changed, 0 insertions, 38 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp deleted file mode 100644 index dcce4dc..0000000 --- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h" -#include "Swiften/Base/foreach.h" -#include "Swiften/Serializer/XML/XMLRawTextNode.h" -#include "Swiften/Serializer/XML/XMLTextNode.h" -#include "Swiften/Serializer/XML/XMLElement.h" - -namespace Swift { - -SecurityLabelSerializer::SecurityLabelSerializer() : GenericPayloadSerializer<SecurityLabel>() { -} - -String SecurityLabelSerializer::serializePayload(boost::shared_ptr<SecurityLabel> label) const { - XMLElement element("securitylabel", "urn:xmpp:sec-label:0"); - if (!label->getDisplayMarking().isEmpty()) { - boost::shared_ptr<XMLElement> displayMarking(new XMLElement("displaymarking")); - if (!label->getForegroundColor().isEmpty()) { - displayMarking->setAttribute("fgcolor", label->getForegroundColor()); - } - if (!label->getBackgroundColor().isEmpty()) { - displayMarking->setAttribute("bgcolor", label->getBackgroundColor()); - } - displayMarking->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(label->getDisplayMarking()))); - element.addNode(displayMarking); - } - - boost::shared_ptr<XMLElement> labelElement(new XMLElement("label")); - labelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(label->getLabel()))); - element.addNode(labelElement); - - foreach(const String& equivalentLabel, label->getEquivalentLabels()) { - boost::shared_ptr<XMLElement> equivalentLabelElement(new XMLElement("equivalentlabel")); - equivalentLabelElement->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(equivalentLabel))); - element.addNode(equivalentLabelElement); - } - return element.serialize(); -} - -} |