From c6440aab12460490ef8e9167eac0b515e04f1cdf Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 9 Feb 2014 14:10:52 +0100 Subject: carbons --- src/de/gultsch/chat/persistance/DatabaseBackend.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/de/gultsch/chat/persistance') diff --git a/src/de/gultsch/chat/persistance/DatabaseBackend.java b/src/de/gultsch/chat/persistance/DatabaseBackend.java index 135296a6..fe203137 100644 --- a/src/de/gultsch/chat/persistance/DatabaseBackend.java +++ b/src/de/gultsch/chat/persistance/DatabaseBackend.java @@ -8,6 +8,7 @@ import de.gultsch.chat.entities.Account; import de.gultsch.chat.entities.Contact; import de.gultsch.chat.entities.Conversation; import de.gultsch.chat.entities.Message; +import de.gultsch.chat.entities.Presences; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -214,12 +215,13 @@ public class DatabaseBackend extends SQLiteOpenHelper { SQLiteDatabase db = this.getWritableDatabase(); for (int i = 0; i < contacts.size(); i++) { Contact contact = contacts.get(i); - String[] columns = {Contact.UUID}; + String[] columns = {Contact.UUID, Contact.PRESENCES}; String[] args = {contact.getAccount().getUuid(), contact.getJid()}; Cursor cursor = db.query(Contact.TABLENAME, columns,Contact.ACCOUNT+"=? AND "+Contact.JID+"=?", args, null, null, null); if (cursor.getCount()>=1) { cursor.moveToFirst(); contact.setUuid(cursor.getString(0)); + contact.setPresences(Presences.fromJsonString(cursor.getString(1))); updateContact(contact); } else { contact.setUuid(UUID.randomUUID().toString()); -- cgit v1.2.3