diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-13 20:40:40 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-13 20:43:34 (GMT) |
commit | 7f9c693b3d90ebd5bbb7a99d99ba0dc6213dcb47 (patch) | |
tree | 8c332e98b7fbfeeee6df5c82f3cdd2307db4008f /Swiften/Parser/PayloadParsers | |
parent | 43eadfb5d884407c54ccd41cf46881ae374fdf15 (diff) | |
download | swift-contrib-7f9c693b3d90ebd5bbb7a99d99ba0dc6213dcb47.zip swift-contrib-7f9c693b3d90ebd5bbb7a99d99ba0dc6213dcb47.tar.bz2 |
Implement a clean full login procedure.
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp | 14 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/VCardParser.cpp | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp index 2d16636..bfae4f0 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp @@ -10,6 +10,7 @@ class VCardParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(VCardParserTest); CPPUNIT_TEST(testParse_Photo); + CPPUNIT_TEST(testParse_Nickname); CPPUNIT_TEST_SUITE_END(); public: @@ -34,6 +35,19 @@ class VCardParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), payload->getPhotoType()); CPPUNIT_ASSERT_EQUAL(ByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"), payload->getPhoto()); } + + void testParse_Nickname() { + VCardParser testling; + PayloadParserTester parser(&testling); + + CPPUNIT_ASSERT(parser.parse( + "<vCard xmlns='vcard-temp'>" + "<NICKNAME>mynick</NICKNAME>" + "</vCard>")); + + VCard* payload = dynamic_cast<VCard*>(testling.getPayload().get()); + CPPUNIT_ASSERT_EQUAL(String("mynick"), payload->getNickname()); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(VCardParserTest); diff --git a/Swiften/Parser/PayloadParsers/VCardParser.cpp b/Swiften/Parser/PayloadParsers/VCardParser.cpp index a6fe2be..b7845a7 100644 --- a/Swiften/Parser/PayloadParsers/VCardParser.cpp +++ b/Swiften/Parser/PayloadParsers/VCardParser.cpp @@ -20,6 +20,9 @@ void VCardParser::handleEndElement(const String&, const String&) { else if (elementHierarchy == "/vCard/PHOTO/BINVAL") { getPayloadInternal()->setPhoto(Base64::decode(currentText_)); } + else if (elementHierarchy == "/vCard/NICKNAME") { + getPayloadInternal()->setNickname(currentText_); + } elementStack_.pop_back(); } |