summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-02-25 23:20:59 (GMT)
committerSwift Review <review@swift.im>2013-03-04 15:18:47 (GMT)
commit836925a5cdc7017da7fb84416c803e652b48e399 (patch)
tree2f659c2bc3e6db70cbc09e0cb13953c1a8ccd8e4 /Swiften/Parser/PayloadParsers/IdleParser.cpp
parentffbd6feb875a9d50ec834fd6dfe967528697a9ff (diff)
downloadswift-836925a5cdc7017da7fb84416c803e652b48e399.zip
swift-836925a5cdc7017da7fb84416c803e652b48e399.tar.bz2
Adding support for idle time.
Change-Id: I1b14edb97a0c87431ec377b084362e9761caded9 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swiften/Parser/PayloadParsers/IdleParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/IdleParser.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/IdleParser.cpp b/Swiften/Parser/PayloadParsers/IdleParser.cpp
new file mode 100644
index 0000000..51aa34b
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/IdleParser.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/IdleParser.h>
+
+#include <Swiften/Base/DateTime.h>
+
+namespace Swift {
+
+IdleParser::IdleParser() : level_(0) {
+}
+
+void IdleParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ boost::posix_time::ptime since = stringToDateTime(attributes.getAttribute("since"));
+ getPayloadInternal()->setSince(since);
+ }
+ ++level_;
+}
+
+void IdleParser::handleEndElement(const std::string&, const std::string&) {
+ --level_;
+}
+
+void IdleParser::handleCharacterData(const std::string&) {
+
+}
+
+}