From a80fe178ea88d4e5b787fab47d454a5a1ae985e8 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 10 Aug 2017 12:30:13 -0700 Subject: [PATCH] Canonicalize addresses during import from system SMS database // FREEBIE --- src/org/thoughtcrime/securesms/database/SmsMigrator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/database/SmsMigrator.java b/src/org/thoughtcrime/securesms/database/SmsMigrator.java index 2fc899142f..1a253d3a7b 100644 --- a/src/org/thoughtcrime/securesms/database/SmsMigrator.java +++ b/src/org/thoughtcrime/securesms/database/SmsMigrator.java @@ -22,6 +22,7 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteStatement; import android.net.Uri; +import android.text.TextUtils; import android.util.Log; import org.thoughtcrime.securesms.crypto.MasterCipher; @@ -100,7 +101,9 @@ public class SmsMigrator { Cursor cursor, long threadId, SQLiteStatement statement) { - addStringToStatement(statement, cursor, 1, SmsDatabase.ADDRESS); + String theirAddress = cursor.getString(cursor.getColumnIndexOrThrow(SmsDatabase.ADDRESS)); + statement.bindString(1, Address.fromExternal(context, theirAddress).serialize()); + addIntToStatement(statement, cursor, 2, SmsDatabase.PERSON); addIntToStatement(statement, cursor, 3, SmsDatabase.DATE_RECEIVED); addIntToStatement(statement, cursor, 4, SmsDatabase.DATE_RECEIVED);