summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp
index cae15c2..509e41e 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp
@@ -7,8 +7,8 @@
#include <Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h>
#include <memory>
+#include <string>
-#include <Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -25,16 +25,23 @@ std::string MIXJoinSerializer::serializePayload(std::shared_ptr<MIXJoin> payload
if (!payload) {
return "";
}
- XMLElement element("join", "urn:xmpp:mix:1");
+ XMLElement element("join", "urn:xmpp:mix:0");
if (payload->getChannel()) {
element.setAttribute("channel", *payload->getChannel());
}
if (payload->getJID()) {
element.setAttribute("jid", *payload->getJID());
}
- for (const auto& item : payload->getSubscriptions()) {
- element.addNode(std::make_shared<XMLRawTextNode>(MIXSubscribeSerializer().serialize(item)));
+ auto subscriptionData = payload->getSubscriptions();
+ std::vector<std::string> subscriptions(subscriptionData.begin(), subscriptionData.end());
+ std::sort(subscriptions.begin(), subscriptions.end());
+
+ for (const auto& item : subscriptions) {
+ auto subscribeElement = std::make_shared<XMLElement>("subscribe");
+ subscribeElement->setAttribute("node", item);
+ element.addNode(subscribeElement);
}
+
if (payload->getForm()) {
element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getForm())));
}