aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/persistance/DatabaseBackend.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-09 00:47:11 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-09 00:47:11 +0100
commitc31101dd6458225a007466a3d58a2f4b591c684f (patch)
tree5606bbb1679301e6bbc51b92d5d6372d10789793 /src/de/gultsch/chat/persistance/DatabaseBackend.java
parent95068ee776d9ec8e6c390133ca2bed083a46546f (diff)
presences are now somewhat stored and displayed to the user via the contact details action.
Diffstat (limited to 'src/de/gultsch/chat/persistance/DatabaseBackend.java')
-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++) {