diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-03-05 15:41:14 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-03-05 15:41:14 +0100 |
commit | 78312d71dd1f281f494a2a1c04e4a80f34898d2c (patch) | |
tree | 595d3f78836691fc8eb204a3102b8781c4e3bd14 /src/eu/siacs/conversations/persistance/DatabaseBackend.java | |
parent | 79ec8b2e8128a1dc1d7d0962ce99e91fdaff8b98 (diff) |
reworked contact details
Diffstat (limited to 'src/eu/siacs/conversations/persistance/DatabaseBackend.java')
-rw-r--r-- | src/eu/siacs/conversations/persistance/DatabaseBackend.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java index 1a6f934a..e2067141 100644 --- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -228,7 +228,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { } } - public List<Contact> getContacts(Account account) { + public List<Contact> getContactsByAccount(Account account) { List<Contact> list = new ArrayList<Contact>(); SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor; @@ -246,7 +246,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { return list; } - public List<Contact> getContats(String where) { + public List<Contact> getContacts(String where) { List<Contact> list = new ArrayList<Contact>(); SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(Contact.TABLENAME, null, where, null, null, null, null); @@ -280,5 +280,15 @@ public class DatabaseBackend extends SQLiteOpenHelper { db.delete(Contact.TABLENAME, Contact.UUID + "=?", args); } + public Contact getContact(String uuid) { + SQLiteDatabase db = this.getWritableDatabase(); + String[] args = { uuid }; + Cursor cursor = db.query(Contact.TABLENAME, null, Contact.UUID + "=?", args, null, null, null); + if (cursor.getCount() == 0) + return null; + cursor.moveToFirst(); + return Contact.fromCursor(cursor); + } + } |