diff options
author | Remko Tronçon <git@el-tramo.be> | 2013-08-22 21:07:51 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2013-08-23 08:02:12 (GMT) |
commit | 00284e5f4445a7bbab482196901c5927ea7d5488 (patch) | |
tree | f2ca6e0c51632a8aa5a7a884f3b312bacc3a2fb0 /Swiften/Disco | |
parent | 54da0a4c0cceae947afbde586a97d1cc60c50ed8 (diff) | |
download | swift-00284e5f4445a7bbab482196901c5927ea7d5488.zip swift-00284e5f4445a7bbab482196901c5927ea7d5488.tar.bz2 |
FormField element refactoring.
This should make FormField easier to use.
Change-Id: Ia5eeedcdb673e2fe5e38fd23d5ab00970178bc44
Diffstat (limited to 'Swiften/Disco')
-rw-r--r-- | Swiften/Disco/CapsInfoGenerator.cpp | 2 | ||||
-rw-r--r-- | Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp | 23 |
2 files changed, 9 insertions, 16 deletions
diff --git a/Swiften/Disco/CapsInfoGenerator.cpp b/Swiften/Disco/CapsInfoGenerator.cpp index cb93182..4332f76 100644 --- a/Swiften/Disco/CapsInfoGenerator.cpp +++ b/Swiften/Disco/CapsInfoGenerator.cpp @@ -49,7 +49,7 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const { continue; } serializedCaps += field->getName() + "<"; - std::vector<std::string> values(field->getRawValues()); + std::vector<std::string> values(field->getValues()); std::sort(values.begin(), values.end()); foreach(const std::string& value, values) { serializedCaps += value + "<"; diff --git a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp index a1b1a7b..67d27c0 100644 --- a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp +++ b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp @@ -51,32 +51,25 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture { discoInfo.addFeature("http://jabber.org/protocol/muc"); Form::ref extension(new Form(Form::ResultType)); - FormField::ref field = HiddenFormField::create("urn:xmpp:dataforms:softwareinfo"); + FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "urn:xmpp:dataforms:softwareinfo"); field->setName("FORM_TYPE"); extension->addField(field); - std::vector<std::string> ipVersions; - ipVersions.push_back("ipv6"); - ipVersions.push_back("ipv4"); - field = ListMultiFormField::create(ipVersions); - field->addRawValue("ipv6"); - field->addRawValue("ipv4"); + field = boost::make_shared<FormField>(FormField::ListMultiType); + field->addValue("ipv6"); + field->addValue("ipv4"); field->setName("ip_version"); extension->addField(field); - field = TextSingleFormField::create("Psi"); - field->addRawValue("Psi"); + field = boost::make_shared<FormField>(FormField::TextSingleType, "Psi"); field->setName("software"); extension->addField(field); - field = TextSingleFormField::create("0.11"); - field->addRawValue("0.11"); + field = boost::make_shared<FormField>(FormField::TextSingleType, "0.11"); field->setName("software_version"); extension->addField(field); - field = TextSingleFormField::create("Mac"); + field = boost::make_shared<FormField>(FormField::TextSingleType, "Mac"); field->setName("os"); - field->addRawValue("Mac"); extension->addField(field); - field = TextSingleFormField::create("10.5.1"); + field = boost::make_shared<FormField>(FormField::TextSingleType, "10.5.1"); field->setName("os_version"); - field->addRawValue("10.5.1"); extension->addField(field); discoInfo.addExtension(extension); |