Don't transmit SMS contact information to multi-device on change

Fixes #5710

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2016-10-05 16:57:52 -07:00
parent 2f9bf27ed7
commit 7d1c5a0d40
2 changed files with 16 additions and 5 deletions

View File

@ -40,6 +40,7 @@ import org.thoughtcrime.securesms.preferences.AdvancedRingtonePreference;
import org.thoughtcrime.securesms.preferences.ColorPreference;
import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.util.DirectoryHelper;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
import org.thoughtcrime.securesms.util.DynamicTheme;
@ -388,9 +389,13 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
DatabaseFactory.getRecipientPreferenceDatabase(context)
.setColor(recipients, selectedColor);
if (DirectoryHelper.getUserCapabilities(context, recipients)
.getTextCapability() == DirectoryHelper.UserCapabilities.Capability.SUPPORTED)
{
ApplicationContext.getInstance(context)
.getJobManager()
.add(new MultiDeviceContactUpdateJob(context, recipients.getPrimaryRecipient().getRecipientId()));
}
return null;
}
}.execute();

View File

@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.jobqueue.JobParameters;
import org.whispersystems.jobqueue.requirements.NetworkRequirement;
import org.whispersystems.libsignal.util.guava.Optional;
@ -69,6 +70,11 @@ public class MultiDeviceContactUpdateJob extends MasterSecretJob implements Inje
public void onRun(MasterSecret masterSecret)
throws IOException, UntrustedIdentityException, NetworkException
{
if (!TextSecurePreferences.isMultiDevice(context)) {
Log.w(TAG, "Not multi device, aborting...");
return;
}
if (recipientId <= 0) generateFullContactUpdate();
else generateSingleContactUpdate(recipientId);
}