diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp b/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp new file mode 100644 index 0000000..e195eb7 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp @@ -0,0 +1,26 @@ +#include "Swiften/Parser/PayloadParsers/VCardUpdateParser.h" + +namespace Swift { + +VCardUpdateParser::VCardUpdateParser() : level_(TopLevel) { +} + +void VCardUpdateParser::handleStartElement(const String&, const String&, const AttributeMap&) { + if (level_ == PayloadLevel) { + currentText_ = ""; + } + ++level_; +} + +void VCardUpdateParser::handleEndElement(const String& element, const String&) { + --level_; + if (level_ == PayloadLevel && element == "photo") { + getPayloadInternal()->setPhotoHash(currentText_); + } +} + +void VCardUpdateParser::handleCharacterData(const String& text) { + currentText_ += text; +} + +} |