Correctly format numbers in outgoing MMS

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-10-24 18:36:03 -07:00
parent cb3f9a6805
commit a64dba8a7e

View File

@ -25,9 +25,12 @@ import org.thoughtcrime.securesms.util.Hex;
import org.thoughtcrime.securesms.util.NumberUtil; import org.thoughtcrime.securesms.util.NumberUtil;
import org.thoughtcrime.securesms.util.SmilUtil; import org.thoughtcrime.securesms.util.SmilUtil;
import org.thoughtcrime.securesms.util.TelephonyUtil; import org.thoughtcrime.securesms.util.TelephonyUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.jobqueue.JobParameters; import org.whispersystems.jobqueue.JobParameters;
import org.whispersystems.jobqueue.requirements.NetworkRequirement; 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.io.IOException;
import java.util.Arrays; import java.util.Arrays;
@ -175,14 +178,15 @@ public class MmsSendJob extends SendJob {
private SendReq constructSendPdu(MasterSecret masterSecret, OutgoingMediaMessage message) private SendReq constructSendPdu(MasterSecret masterSecret, OutgoingMediaMessage message)
throws UndeliverableMessageException throws UndeliverableMessageException
{ {
SendReq sendReq = new SendReq(); SendReq sendReq = new SendReq();
PduBody body = new PduBody(); PduBody body = new PduBody();
List<String> numbers = message.getRecipients().toNumberStringList(true);
for (Recipient recipient : message.getRecipients()) { for (String number : numbers) {
if (message.getDistributionType() == DistributionTypes.CONVERSATION) { if (message.getDistributionType() == DistributionTypes.CONVERSATION) {
sendReq.addTo(new EncodedStringValue(Util.toIsoBytes(recipient.getNumber()))); sendReq.addTo(new EncodedStringValue(Util.toIsoBytes(number)));
} else { } else {
sendReq.addBcc(new EncodedStringValue(Util.toIsoBytes(recipient.getNumber()))); sendReq.addBcc(new EncodedStringValue(Util.toIsoBytes(number)));
} }
} }