nicoco 8d984cd8a1 XEP-0004: fix: prevent multiple <values> for 'text-single' field
According to XEP-0004:
- if there is no "type" attribute on a <field />, we should assume it is
  "text-single";
- "text-single" MUST NOT contain morethan one <value />.

Before this patch, not specifying a field type and passing a multi-line
string would result in an illegal stanza.

While it would be cleaner to log a warning or even raise an exception if
set_value() is called with an incompatible type, this breaks a lot of
tests and backward-compatibility, so we introduce some heuristic in
FormField.set_value() to infer the field type based on the provided
value instead.

I also changed FormField.get_value() so that it returns a list by
default for 'text-multi' fields. This is a breaking change, but I have
not found the justification for the previous behaviour.
2025-01-24 14:33:16 +00:00
..
2010-10-07 19:42:28 -04:00
2014-07-17 14:19:04 +02:00
2020-12-04 00:20:51 +01:00
2015-02-12 12:23:47 +01:00
2014-07-17 14:19:04 +02:00
2014-07-17 14:19:04 +02:00
2021-02-26 00:08:56 +01:00