Commit Graph

9 Commits

Author SHA1 Message Date
Florian Schmaus 77e26fc575 Re-work data form API
Apply builder pattern to form fields and replace getVariable() with
getFieldName(). Refer to the field name as "field name" instead of
"variable" everyone, just as XEP-0004 does.

Improve the high-level form API: introduce FilledForm and FillableForm
which perform stronger validation and consistency checks.

Also add FormFieldRegistry to enable processing of 'submit' forms
where the form field types are omitted.

Smack also now does omit the form field type declaration on 'submit'
type forms, as it is allowed by XEP-0004.
2020-05-13 20:14:41 +02:00
Florian Schmaus 4ca2c7cc69 Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks 2019-07-24 09:18:39 +02:00
Florian Schmaus 4d36e3b521 Introduce FormFieldChildElement and make FormField immutable 2019-06-11 12:47:39 +02:00
Florian Schmaus a48e8ef843 Merge branch '4.2' 2018-02-21 20:13:05 +01:00
Florian Schmaus 245a3b3851 Use the correct ad-hoc action in ServiceAdministrationManager
Fixes SMACK-804. Thanks to Holger Weiß for his help with the issue.

Smack would always use the 'next' action only 'execute' (which is
always allowed) and 'complete' where candidates.

Example XMPP trace:

SENT: <iq to='salem.geekplace.eu' id='f0JiQ-45' type='set'><command xmlns='http://jabber.org/protocol/commands' node='http://jabber.org/protocol/admin#add-user' action='execute'></command></iq><r xmlns='urn:xmpp:sm:3'/>

RECV: <iq xml:lang='en' to='sinttest-admin@salem.geekplace.eu/one-phx8g' from='salem.geekplace.eu' type='result' id='f0JiQ-45'>
<command status='executing' sessionid='2018-02-21T14:48:13.508812Z' node='http://jabber.org/protocol/admin#add-user' xmlns='http://jabber.org/protocol/commands'>
<actions execute='complete'>
  <complete/>
</actions>
<x type='form' xmlns='jabberdata'>
<title>Add User</title>
<field var='FORM_TYPE' type='hidden'><value>http://jabber.org/protocol/admin</value></field>
<field var='accountjid' type='jid-single' label='Jabber ID'><required/></field>
<field var='password' type='text-private' label='Password'><required/></field>
<field var='password-verify' type='text-private' label='Password Verification'><required/></field>
</x>
</command>
</iq>

SENT:
<iq to='salem.geekplace.eu' id='f0JiQ-49' type='set'>
<command xmlns='http://jabber.org/protocol/commands' node='http://jabber.org/protocol/admin#add-user' sessionid='2018-02-21T14:48:13.508812Z' action='next'>
<x xmlns='jabberdata' type='submit'>
<field var='FORM_TYPE' type='hidden'><value>http://jabber.org/protocol/admin</value></field>
<field var='accountjid' type='jid-single'><value>smack-inttest-one-phx8g@salem.geekplace.eu</value></field>
<field var='password' type='text-private'><value>L2Cz2gKeVsBAEBRJ</value></field>
<field var='password-verify' type='text-private'><value>L2Cz2gKeVsBAEBRJ</value></field>
</x>
</command>
</iq>

RECV:
<iq xml:lang='en' to='sinttest-admin@salem.geekplace.eu/one-phx8g' from='salem.geekplace.eu' type='error' id='f0JiQ-49'>
<command action='next' sessionid='2018-02-21T14:48:13.508812Z' node='http://jabber.org/protocol/admin#add-user' xmlns='http://jabber.org/protocol/commands'>
<x type='submit' xmlns='jabberdata'>
<field var='FORM_TYPE' type='hidden'><value>http://jabber.org/protocol/admin</value></field>
<field var='accountjid' type='jid-single'><value>smack-inttest-one-phx8g@salem.geekplace.eu</value></field>
<field var='password' type='text-private'><value>L2Cz2gKeVsBAEBRJ</value></field>
<field var='password-verify' type='text-private'><value>L2Cz2gKeVsBAEBRJ</value></field>
</x>
</command>
<error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Unexpected action</text>
</error>
</iq>
2018-02-21 16:34:03 +01:00
Florian Schmaus 0602ae064a Remove deprecated methods from XMPPConnection 2017-08-12 13:36:47 +02:00
Florian Schmaus 08e897113d Add CustomImportOrder checkstyle rule
And matching ImportOrder settings for Eclipse in
resources/eclipse/smack.importorder
2017-06-14 17:12:43 +02:00
Florian Schmaus ce1cddc722 More checkstyle whitespace related checks 2017-05-24 14:42:38 +02:00
Florian Schmaus 274e5630c4 Add support for XEP-0133: Service Administration
also extend Smack's integration test framework to use XEP-0133 as a
means for of throw away account creation.

Fixes SMACK-742
2016-12-04 21:42:50 +01:00