summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers/NicknameParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/NicknameParser.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/NicknameParser.cpp b/Swiften/Parser/PayloadParsers/NicknameParser.cpp
new file mode 100644
index 0000000..c60bc72
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/NicknameParser.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include "Swiften/Parser/PayloadParsers/NicknameParser.h"
+
+namespace Swift {
+
+NicknameParser::NicknameParser() : level(0) {
+}
+
+void NicknameParser::handleStartElement(const String&, const String&, const AttributeMap&) {
+ ++level;
+}
+
+void NicknameParser::handleEndElement(const String&, const String&) {
+ --level;
+ if (level == 0) {
+ getPayloadInternal()->setNickname(text);
+ }
+}
+
+void NicknameParser::handleCharacterData(const String& data) {
+ text += data;
+}
+
+}