diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-05-03 23:25:34 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-05-03 23:25:34 +0200 |
commit | 3abd3091ac6aa01b76bca5c6b17023d45fb084b8 (patch) | |
tree | 8a105cffc34caf7a90482e989c5d6aa95b4ebc6e /src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | |
parent | ace3930d3ca1d56e679e8f38beb6a269d110b1a1 (diff) |
introduced type private_file_message to handle attachments in PMs
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index e2c83321d..37f577079 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -841,14 +841,14 @@ public class DatabaseBackend extends SQLiteOpenHelper { if (internal) { final String name = file.getName(); if (name.endsWith(".pgp")) { - selection = "(" + Message.RELATIVE_FILE_PATH + " IN(?,?) OR (" + Message.RELATIVE_FILE_PATH + "=? and encryption in(1,4))) and type in (1,2)"; + selection = "(" + Message.RELATIVE_FILE_PATH + " IN(?,?) OR (" + Message.RELATIVE_FILE_PATH + "=? and encryption in(1,4))) and type in (1,2,5)"; selectionArgs = new String[]{file.getAbsolutePath(), name, name.substring(0, name.length() - 4)}; } else { - selection = Message.RELATIVE_FILE_PATH + " IN(?,?) and type in (1,2)"; + selection = Message.RELATIVE_FILE_PATH + " IN(?,?) and type in (1,2,5)"; selectionArgs = new String[]{file.getAbsolutePath(), name}; } } else { - selection = Message.RELATIVE_FILE_PATH + "=? and type in (1,2)"; + selection = Message.RELATIVE_FILE_PATH + "=? and type in (1,2,5)"; selectionArgs = new String[]{file.getAbsolutePath()}; } final List<String> uuids = new ArrayList<>(); @@ -891,7 +891,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { public List<FilePathInfo> getFilePathInfo() { final SQLiteDatabase db = this.getReadableDatabase(); - final Cursor cursor = db.query(Message.TABLENAME, new String[]{Message.UUID, Message.RELATIVE_FILE_PATH, Message.FILE_DELETED}, "type in (1,2) and " + Message.RELATIVE_FILE_PATH + " is not null", null, null, null, null); + final Cursor cursor = db.query(Message.TABLENAME, new String[]{Message.UUID, Message.RELATIVE_FILE_PATH, Message.DELETED}, "type in (1,2,5) and "+Message.RELATIVE_FILE_PATH+" is not null", null, null, null, null); final List<FilePathInfo> list = new ArrayList<>(); while (cursor != null && cursor.moveToNext()) { list.add(new FilePathInfo(cursor.getString(0), cursor.getString(1), cursor.getInt(2) > 0)); @@ -904,7 +904,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { public List<FilePath> getRelativeFilePaths(String account, Jid jid, int limit) { SQLiteDatabase db = this.getReadableDatabase(); - final String SQL = "select uuid,relativeFilePath from messages where type in (1,2) and file_deleted=0 and " + Message.RELATIVE_FILE_PATH + " is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc"; + final String SQL = "select uuid,relativeFilePath from messages where type in (1,2,5) and deleted=0 and " + Message.RELATIVE_FILE_PATH + " is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc"; final String[] args = {account, jid.toEscapedString(), jid.toEscapedString() + "/%"}; Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + String.valueOf(limit) : ""), args); List<FilePath> filesPaths = new ArrayList<>(); |