To start with, thanks for the quick work on SMACK-902 regarding the DataForm reported types.
In our chat client we heavily rely on data forms, and have an implementation of XEP-0346: Form Discovery and Publishing which has been in use for a number of years now.
This feature allows our administrators to create and publish forms, which can then be filled out by users and submitted. These forms have to adhere to XEP-0004, and may use some XEP’s related to additional form field types (for example: XEP-350: Data Forms Geolocation Element). The forms do not have a FORM_TYPE field set.
We are now trying to migrate from Smack 4.3.4 to 4.4.0, but are having a lot of problems with the new DataForm’s API in 4.4.0. In 4.4.0 the use of a FORM_TYPE seems to be mandatory. Even DataForms that do not have the FORM_TYPE field set lookup field types in the FormFieldRegistry, and DataForms without a FORM_TYPE are registered in the FormFieldRegistry.
This causes all sorts of problems for us, because forms are registered, and their registered field types are imposed to other forms that do not have a FORM_TYPE set. In many cases a plain DataForm without a FORM_TYPE will not even get successfully parsed by the DataFormProvider.
I would like to request a change to the Data Form API so that it treats forms without a FORM_TYPE set as unregistered forms: not registered in the FormFieldRegistry, and the FormFieldRegistry is not uses when deciding upon their type.
This would result in the following logic:
If no FORM_TYPE field is set, the form fields are parsed as specified in XEP-0004, and the
field type is determined as follows:
- the field type set to the field itself
- the field type set in the <reported> section of result forms
- the field type default of text-single is used
If a FORM_TYPE field is set, the lookup of form field types looks like this:
- the field type set to the field itself
- the field type set in the <reported> section of result forms
- the FormFieldRegistry is checked for a preregistered type of the field for this FORM_TYPE
- the field type default of text-single is used
To improve the support for DataForms without a FORM_TYPE, the FilledForm and FillableForm’s
should also be able to handle forms without a FORM_TYPE. The FilledForm and FillableForm subclasses for specific FORM_TYPE’s already use ensureFormType() to make sure the proper FORM_TYPE is set.
These changes would allow us to parse and interact with plain old DataForm’s (without a FORM_TYPE) using the API’s in Smack.
I’ve created a commit which makes these changes (https://github.com/fenuz/Smack/commit/323dfe77408f1f7805c1c49d40bbfe930b43e49b). I would much appreciate it if you could discuss our problem and our proposed solution.
Thank you all your work,
Frank