diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp new file mode 100644 index 0000000..111186a --- /dev/null +++ b/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017 Tarun Gupta + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include <Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h> + +#include <memory> + +#include <Swiften/Serializer/XML/XMLElement.h> + +namespace Swift { + +MIXLeaveSerializer::MIXLeaveSerializer() { +} + +MIXLeaveSerializer::~MIXLeaveSerializer() { +} + +std::string MIXLeaveSerializer::serializePayload(std::shared_ptr<MIXLeave> payload) const { + if (!payload) { + return ""; + } + XMLElement element("leave", "urn:xmpp:mix:0"); + if (payload->getChannel()) { + element.setAttribute("channel", *payload->getChannel()); + } + return element.serialize(); +} +} |