summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp b/Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp
new file mode 100644
index 0000000..6330925
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXLeaveParser.h>
+
+#include <boost/optional.hpp>
+
+namespace Swift {
+
+MIXLeaveParser::MIXLeaveParser() : level_(0) {
+}
+
+MIXLeaveParser::~MIXLeaveParser() {
+}
+
+void MIXLeaveParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ if (auto attributeValue = attributes.getAttributeValue("channel")) {
+ if (auto jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setChannel(*jid);
+ }
+ }
+ }
+ ++level_;
+}
+
+void MIXLeaveParser::handleEndElement(const std::string&, const std::string&) {
+ --level_;
+}
+
+void MIXLeaveParser::handleCharacterData(const std::string&) {
+
+}
+}