Skip to content

Commit

Permalink
Merge branch '4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Jun 25, 2021
2 parents 2762325 + 899813a commit 3fde483
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;
Expand Down Expand Up @@ -228,18 +229,16 @@ private static void sendToIndividualRecipients(XMPPConnection connection, Stanza
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ public FillableForm(DataForm dataForm) {
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);
Expand Down Expand Up @@ -223,9 +229,6 @@ public final void write(FormField filledFormField) {
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.
Expand Down

0 comments on commit 3fde483

Please sign in to comment.