diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-02-15 23:15:04 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-02-15 23:15:04 +0100 |
commit | c0b3a3ff0c32c8025174ebb92fbcf4a7fc67f497 (patch) | |
tree | 7cd29b2a9c195277ab14114db17c848629f69b07 /src/main/java/eu/siacs/conversations/persistance | |
parent | 335058b78bb20f8234d98fb4f205a1954b25e7e8 (diff) |
basic support for XEP-0308: Last Message Correction. fixes #864
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index 2f28a30f..dcba4f74 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -51,7 +51,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { private static DatabaseBackend instance = null; private static final String DATABASE_NAME = "history"; - private static final int DATABASE_VERSION = 23; + private static final int DATABASE_VERSION = 24; private static String CREATE_CONTATCS_STATEMENT = "create table " + Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, " @@ -161,6 +161,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + Message.SERVER_MSG_ID + " TEXT, " + Message.FINGERPRINT + " TEXT, " + Message.CARBON + " INTEGER, " + + Message.EDITED + " TEXT, " + Message.READ + " NUMBER DEFAULT 1, " + Message.REMOTE_MSG_ID + " TEXT, FOREIGN KEY(" + Message.CONVERSATION + ") REFERENCES " @@ -370,6 +371,10 @@ public class DatabaseBackend extends SQLiteOpenHelper { if (oldVersion < 23 && newVersion >= 23) { db.execSQL(CREATE_DISCOVERY_RESULTS_STATEMENT); } + + if (oldVersion < 24 && newVersion >= 24) { + db.execSQL("ALTER TABLE " + Message.TABLENAME + " ADD COLUMN " + Message.EDITED + " TEXT"); + } } public static synchronized DatabaseBackend getInstance(Context context) { @@ -586,6 +591,13 @@ public class DatabaseBackend extends SQLiteOpenHelper { + "=?", args); } + public void updateMessage(Message message, String uuid) { + SQLiteDatabase db = this.getWritableDatabase(); + String[] args = {uuid}; + db.update(Message.TABLENAME, message.getContentValues(), Message.UUID + + "=?", args); + } + public void readRoster(Roster roster) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor; |