summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp31
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..9025e3f
--- /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:1");
+ if (payload->getChannel()) {
+ element.setAttribute("channel", *payload->getChannel());
+ }
+ return element.serialize();
+}
+}