Escape addresess in thread and recipient pref migrations

For clients that have not yet migrated

// FREEBIE
fork-5.53.8
Moxie Marlinspike 2017-08-02 11:08:38 -07:00
rodzic aacf50316d
commit 1e934f6146
1 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -44,6 +44,7 @@ import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
import org.thoughtcrime.securesms.notifications.MessageNotifier;
import org.thoughtcrime.securesms.util.Base64;
import org.thoughtcrime.securesms.util.DelimiterUtil;
import org.thoughtcrime.securesms.util.JsonUtils;
import org.thoughtcrime.securesms.util.MediaUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -55,6 +56,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@ -919,7 +921,7 @@ public class DatabaseFactory {
if (resolved != null && resolved.moveToFirst()) {
String address = resolved.getString(0);
addresses[i] = numberMigrator.migrate(address);
addresses[i] = DelimiterUtil.escape(numberMigrator.migrate(address), ' ');
} else if (recipientIds[i].equals("-1")) {
addresses[i] = "Unknown";
} else {
@ -929,6 +931,8 @@ public class DatabaseFactory {
if (resolved != null) resolved.close();
}
Arrays.sort(addresses);
ContentValues values = new ContentValues(1);
values.put("recipient_ids", Util.join(addresses, " "));
db.update("thread", values, "_id = ?", new String[] {String.valueOf(threadId)});
@ -990,7 +994,7 @@ public class DatabaseFactory {
if (resolved != null && resolved.moveToFirst()) {
String address = resolved.getString(0);
addresses[i] = numberMigrator.migrate(address);
addresses[i] = DelimiterUtil.escape(numberMigrator.migrate(address), ' ');
} else if (recipientIds[i].equals("-1")) {
addresses[i] = "Unknown";
} else {
@ -1000,6 +1004,8 @@ public class DatabaseFactory {
if (resolved != null) resolved.close();
}
Arrays.sort(addresses);
ContentValues values = new ContentValues(1);
values.put("recipient_ids", Util.join(addresses, " "));