From a64dba8a7e524b31c6f77db7ab6b2f6f74beb12f Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Sat, 24 Oct 2015 18:36:03 -0700 Subject: [PATCH] Correctly format numbers in outgoing MMS // FREEBIE --- .../thoughtcrime/securesms/jobs/MmsSendJob.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java b/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java index 6e995bfa28..4d3d71c9b9 100644 --- a/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java @@ -25,9 +25,12 @@ import org.thoughtcrime.securesms.util.Hex; import org.thoughtcrime.securesms.util.NumberUtil; import org.thoughtcrime.securesms.util.SmilUtil; import org.thoughtcrime.securesms.util.TelephonyUtil; +import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.Util; import org.whispersystems.jobqueue.JobParameters; import org.whispersystems.jobqueue.requirements.NetworkRequirement; +import org.whispersystems.textsecure.api.util.InvalidNumberException; +import org.whispersystems.textsecure.api.util.PhoneNumberFormatter; import java.io.IOException; import java.util.Arrays; @@ -175,14 +178,15 @@ public class MmsSendJob extends SendJob { private SendReq constructSendPdu(MasterSecret masterSecret, OutgoingMediaMessage message) throws UndeliverableMessageException { - SendReq sendReq = new SendReq(); - PduBody body = new PduBody(); + SendReq sendReq = new SendReq(); + PduBody body = new PduBody(); + List numbers = message.getRecipients().toNumberStringList(true); - for (Recipient recipient : message.getRecipients()) { + for (String number : numbers) { if (message.getDistributionType() == DistributionTypes.CONVERSATION) { - sendReq.addTo(new EncodedStringValue(Util.toIsoBytes(recipient.getNumber()))); + sendReq.addTo(new EncodedStringValue(Util.toIsoBytes(number))); } else { - sendReq.addBcc(new EncodedStringValue(Util.toIsoBytes(recipient.getNumber()))); + sendReq.addBcc(new EncodedStringValue(Util.toIsoBytes(number))); } }