aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/persistance/DatabaseBackend.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/gultsch/chat/persistance/DatabaseBackend.java')
-rw-r--r--src/de/gultsch/chat/persistance/DatabaseBackend.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/persistance/DatabaseBackend.java b/src/de/gultsch/chat/persistance/DatabaseBackend.java
index 4607883c..caee4e8f 100644
--- a/src/de/gultsch/chat/persistance/DatabaseBackend.java
+++ b/src/de/gultsch/chat/persistance/DatabaseBackend.java
@@ -245,6 +245,16 @@ public class DatabaseBackend extends SQLiteOpenHelper {
}
return list;
}
+
+ public List<Contact> getContats(String where) {
+ List<Contact> list = new ArrayList<Contact>();
+ SQLiteDatabase db = this.getReadableDatabase();
+ Cursor cursor = db.query(Contact.TABLENAME, null, where, null, null, null, null);
+ while (cursor.moveToNext()) {
+ list.add(Contact.fromCursor(cursor));
+ }
+ return list;
+ }
public Contact findContact(Account account, String jid) {
SQLiteDatabase db = this.getReadableDatabase();
@@ -263,4 +273,12 @@ public class DatabaseBackend extends SQLiteOpenHelper {
String[] args = { message.getUuid() };
db.delete(Message.TABLENAME, Message.UUID + "=?", args);
}
+
+ public void deleteContact(Contact contact) {
+ SQLiteDatabase db = this.getWritableDatabase();
+ String[] args = { contact.getUuid() };
+ db.delete(Contact.TABLENAME, Contact.UUID + "=?", args);
+ }
+
+
}