Canonicalize addresses during import from system SMS database

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2017-08-10 12:30:13 -07:00
parent 422b4c345b
commit a80fe178ea

View File

@ -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);