Merge branch '4.4'

master
Florian Schmaus 1 year ago
commit 3fde4830e4
  1. 17
      smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java
  2. 11
      smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/form/FillableForm.java

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.address;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
@ -228,18 +229,16 @@ public class MultipleRecipientManager {
throw new AssertionError();
}
if (to == null) to = Collections.emptyList();
if (cc == null) cc = Collections.emptyList();
if (bcc == null) bcc = Collections.emptyList();
final int numRecipients = to.size() + cc.size() + bcc.size();
final List<Jid> recipients = new ArrayList<>(numRecipients);
if (to != null) {
recipients.addAll(to);
}
if (cc != null) {
recipients.addAll(cc);
}
if (bcc != null) {
recipients.addAll(bcc);
}
recipients.addAll(to);
recipients.addAll(cc);
recipients.addAll(bcc);
final List<Stanza> stanzasToSend = new ArrayList<>(numRecipients);
for (Jid recipient : recipients) {

@ -58,7 +58,13 @@ public class FillableForm extends FilledForm {
if (formField.isRequired()) {
String fieldName = formField.getFieldName();
requiredFields.add(fieldName);
missingRequiredFields.add(fieldName);
if (formField.hasValueSet()) {
// This is a form field with a default value.
write(formField);
} else {
missingRequiredFields.add(fieldName);
}
}
}
this.requiredFields = Collections.unmodifiableSet(requiredFields);
@ -223,9 +229,6 @@ public class FillableForm extends FilledForm {
if (!getDataForm().hasField(fieldName)) {
throw new IllegalArgumentException();
}
if (filledFields.containsKey(fieldName)) {
throw new IllegalArgumentException();
}
// Perform validation, e.g. using XEP-0122.
// TODO: We could also perform list-* option validation, but this has to take xep122's <open/> into account.

Loading…
Cancel
Save