diff options
Diffstat (limited to 'src/eu/siacs/conversations/persistance')
-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); + } + } |