powered by Jive Software

Implementation of XEP-0221 Data Form Media ELement


#1

I did some slight reading related to Data Form Media Element in #321.
Link to the PR

Now the only part which is left is, integrating DataForm s with MediaElements.

AFAIK, there is no way in FormField which will allow encapsulation to child element (In this case <media>) other than <value>.
This is because,
all extensions based on XEP-004:Data Form such as

  1. XEP-0077: In-Band Registration <https://xmpp.org/extensions/xep-0077.html>.

  2. XEP-0055: Jabber Search <https://xmpp.org/extensions/xep-0055.html>.

  3. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

never needed an extension to field.
whereas XEP-0221 is quite different and is based upon wrapping <media/> element inside <field/>.

So I am proposing some ways to face this scenario,

  1. add method ‘addMediaElementToField(MediaElement)’ to FormField.java :
    But Formfield is defined as per XEP-004 so it might be a contravention to the existing implementation.
  2. Custom made FormField :
    customFormField extends FormField(){}
    An explicit FormField to encapsulate MediaElement.
  3. add method ‘wrapInsideField(FormField)’ to MediaElement.java :
    This will generate
    <field>
    <media/>
    </field>
    But will return XmlStringBuilder(which is pretty much like hardcoding) which is a reason I want to discard this option.

I think for the second option, please let me know what you think,
Also if there is some other way, please let me know :slight_smile:


#2

Thanks for bringing this up. Yes, it appears that there is a extension mechanism for FormField missing. I have to give this a little bit more thought, but right now my champion is also a class hierarchy. I am just now sure how it exactly should look like.