diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/FormSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/FormSerializer.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp index e82f2d0..ece8fd8 100644 --- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp @@ -128,10 +128,20 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF fieldType = "text-multi"; multiLineify(boost::dynamic_pointer_cast<TextMultiFormField>(field)->getValue(), "value", fieldElement); } + else if (boost::dynamic_pointer_cast<UntypedFormField>(field)) { + std::vector<String> lines = boost::dynamic_pointer_cast<UntypedFormField>(field)->getValue(); + foreach(const String& line, lines) { + boost::shared_ptr<XMLElement> valueElement(new XMLElement("value")); + valueElement->addNode(XMLTextNode::create(line)); + fieldElement->addNode(valueElement); + } + } else { assert(false); } - fieldElement->setAttribute("type", fieldType); + if (!fieldType.isEmpty()) { + fieldElement->setAttribute("type", fieldType); + } foreach (const FormField::Option& option, field->getOptions()) { boost::shared_ptr<XMLElement> optionElement(new XMLElement("option")); |