+
+ List<TextSecureAddress> recipientsTS = new ArrayList<>(recipients.size());
+ for (String recipient : recipients) {
+ try {
+ recipientsTS.add(getPushAddress(recipient));
+ } catch (InvalidNumberException e) {
+ System.err.println("Failed to add recipient \"" + recipient + "\": " + e.getMessage());
+ System.err.println("Aborting sending.");
+ return;
+ }
+ }
+
+ messageSender.sendMessage(recipientsTS, message);
+
+ if (message.isEndSession()) {
+ for (TextSecureAddress recipient : recipientsTS) {
+ handleEndSession(recipient.getNumber());
+ }
+ }