diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-30 00:31:44 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-30 00:31:44 +0100 |
commit | e4567e7a62b4ae4773844b47a6a945aa7565f5b9 (patch) | |
tree | 4cd31472bd546b4274708a0fa785f1ab9c36d530 /src/eu/siacs/conversations/persistance/DatabaseBackend.java | |
parent | 1b62d94093256493ec4dd7c4a6aa9ba137d5e338 (diff) |
cleanup for clear conversation history. small otr fixes
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/persistance/DatabaseBackend.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java index b49cf4e6..12e5e251 100644 --- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -332,4 +332,22 @@ public class DatabaseBackend extends SQLiteOpenHelper { cursor.moveToFirst(); return Account.fromCursor(cursor); } + + public List<Message> getImageMessages(Conversation conversation) { + ArrayList<Message> list = new ArrayList<Message>(); + SQLiteDatabase db = this.getReadableDatabase(); + Cursor cursor; + String[] selectionArgs = { conversation.getUuid(), String.valueOf(Message.TYPE_IMAGE) }; + cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION + + "=? AND "+Message.TYPE+"=?", selectionArgs, null, null,null); + if (cursor.getCount() > 0) { + cursor.moveToLast(); + do { + Message message = Message.fromCursor(cursor); + message.setConversation(conversation); + list.add(message); + } while (cursor.moveToPrevious()); + } + return list; + } } |