aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/persistance/DatabaseBackend.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-21 19:51:03 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-21 19:51:03 +0200
commit77da0c6b5d3d6925c8018c1eb57fb26d102a937d (patch)
treeef392c79f3ad3df6de361ded98ab9d377965a371 /src/eu/siacs/conversations/persistance/DatabaseBackend.java
parentfc6a16c31b56a1249fb28b4f90018bca4207dab7 (diff)
allow images to be opened with gallary app
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/persistance/DatabaseBackend.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
index c8c974de..5a34dac6 100644
--- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -305,11 +305,43 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getWritableDatabase();
String[] args = { uuid };
Cursor cursor = db.query(Contact.TABLENAME, null, Contact.UUID + "=?", args, null, null, null);
- if (cursor.getCount() == 0)
+ if (cursor.getCount() == 0) {
return null;
+ }
cursor.moveToFirst();
return Contact.fromCursor(cursor);
}
+ public Conversation findConversationByUuid(String conversationUuid) {
+ SQLiteDatabase db = this.getReadableDatabase();
+ String[] selectionArgs = { conversationUuid };
+ Cursor cursor = db.query(Conversation.TABLENAME, null, Conversation.UUID + "=?", selectionArgs, null, null, null);
+ if (cursor.getCount() == 0) {
+ return null;
+ }
+ cursor.moveToFirst();
+ return Conversation.fromCursor(cursor);
+ }
+
+ public Message findMessageByUuid(String messageUuid) {
+ SQLiteDatabase db = this.getReadableDatabase();
+ String[] selectionArgs = { messageUuid };
+ Cursor cursor = db.query(Message.TABLENAME, null, Message.UUID + "=?", selectionArgs, null, null, null);
+ if (cursor.getCount() == 0) {
+ return null;
+ }
+ cursor.moveToFirst();
+ return Message.fromCursor(cursor);
+ }
+ public Account findAccountByUuid(String accountUuid) {
+ SQLiteDatabase db = this.getReadableDatabase();
+ String[] selectionArgs = { accountUuid };
+ Cursor cursor = db.query(Account.TABLENAME, null, Account.UUID + "=?", selectionArgs, null, null, null);
+ if (cursor.getCount() == 0) {
+ return null;
+ }
+ cursor.moveToFirst();
+ return Account.fromCursor(cursor);
+ }
}