aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/persistance/DatabaseBackend.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/persistance/DatabaseBackend.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/de/gultsch/chat/persistance/DatabaseBackend.java b/src/de/gultsch/chat/persistance/DatabaseBackend.java
index ecf7152b..135296a6 100644
--- a/src/de/gultsch/chat/persistance/DatabaseBackend.java
+++ b/src/de/gultsch/chat/persistance/DatabaseBackend.java
@@ -8,10 +8,12 @@ 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 android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
+import android.os.Bundle;
import android.util.Log;
public class DatabaseBackend extends SQLiteOpenHelper {
@@ -53,7 +55,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
db.execSQL("create table " + Contact.TABLENAME + "(" + Contact.UUID
+ " TEXT PRIMARY KEY, " + Contact.ACCOUNT + " TEXT, "
+ Contact.DISPLAYNAME + " TEXT," + Contact.JID + " TEXT,"
- + Contact.LASTPRESENCE + " NUMBER, " + Contact.OPENPGPKEY
+ + Contact.PRESENCES + " TEXT, " + Contact.OPENPGPKEY
+ " TEXT," + Contact.PHOTOURI + " TEXT," + Contact.SUBSCRIPTION
+ " TEXT," + Contact.SYSTEMACCOUNT + " NUMBER, "
+ "FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES "
@@ -199,6 +201,15 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ "=?", args);
}
+ public void clearPresences(Account account) {
+ SQLiteDatabase db = this.getWritableDatabase();
+ String[] args = { account.getUuid() };
+ ContentValues values = new ContentValues();
+ values.put(Contact.PRESENCES,"[]");
+ db.update(Contact.TABLENAME, values, Contact.ACCOUNT
+ + "=?", args);
+ }
+
public void mergeContacts(List<Contact> contacts) {
SQLiteDatabase db = this.getWritableDatabase();
for (int i = 0; i < contacts.size(); i++) {