mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-18 17:01:08 +01:00
Introduce FormFieldChildElement and make FormField immutable
This commit is contained in:
parent
1a99801501
commit
4d36e3b521
36 changed files with 1191 additions and 490 deletions
|
|
@ -226,7 +226,7 @@ public final class FileTransferNegotiator extends Manager {
|
|||
boolean isByteStream = false;
|
||||
boolean isIBB = false;
|
||||
for (FormField.Option option : field.getOptions()) {
|
||||
variable = option.getValue();
|
||||
variable = option.getValueString();
|
||||
if (variable.equals(Bytestream.NAMESPACE) && !IBB_ONLY) {
|
||||
isByteStream = true;
|
||||
}
|
||||
|
|
@ -369,13 +369,15 @@ public final class FileTransferNegotiator extends Manager {
|
|||
|
||||
private static DataForm createDefaultInitiationForm() {
|
||||
DataForm form = new DataForm(DataForm.Type.form);
|
||||
FormField field = new FormField(STREAM_DATA_FIELD_NAME);
|
||||
field.setType(FormField.Type.list_single);
|
||||
FormField.Builder fieldBuilder = FormField.builder();
|
||||
fieldBuilder.setFieldName(STREAM_DATA_FIELD_NAME)
|
||||
.setType(FormField.Type.list_single);
|
||||
|
||||
if (!IBB_ONLY) {
|
||||
field.addOption(new FormField.Option(Bytestream.NAMESPACE));
|
||||
fieldBuilder.addOption(Bytestream.NAMESPACE);
|
||||
}
|
||||
field.addOption(new FormField.Option(DataPacketExtension.NAMESPACE));
|
||||
form.addField(field);
|
||||
fieldBuilder.addOption(DataPacketExtension.NAMESPACE);
|
||||
form.addField(fieldBuilder.build());
|
||||
return form;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,12 +81,12 @@ public abstract class StreamNegotiator extends Manager {
|
|||
response.setStanzaId(streamInitiationOffer.getStanzaId());
|
||||
|
||||
DataForm form = new DataForm(DataForm.Type.submit);
|
||||
FormField field = new FormField(
|
||||
FormField.Builder field = FormField.builder(
|
||||
FileTransferNegotiator.STREAM_DATA_FIELD_NAME);
|
||||
for (String namespace : namespaces) {
|
||||
field.addValue(namespace);
|
||||
}
|
||||
form.addField(field);
|
||||
form.addField(field.build());
|
||||
|
||||
response.setFeatureNegotiationForm(form);
|
||||
return response;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue