aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgenofire <geno+dev@fireorbit.de>2019-06-22 17:35:49 +0200
committerChristian Schneppe <kriztan@users.noreply.github.com>2019-06-22 17:35:49 +0200
commit514b63f48684ab82031b0291da8d303abe1d680c (patch)
tree27a7cb9f2472bb1d2d1f3a04648107b52f0bdeac
parent4726fcfd465b4f5fda52899423275efbd5d70498 (diff)
BackupExport format like Conversations (#342)
This makes it possible to import/export backup files from/to Conversations
-rw-r--r--src/main/java/de/pixart/messenger/services/ExportBackupService.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ExportBackupService.java b/src/main/java/de/pixart/messenger/services/ExportBackupService.java
index 8a383762f..62868e3e1 100644
--- a/src/main/java/de/pixart/messenger/services/ExportBackupService.java
+++ b/src/main/java/de/pixart/messenger/services/ExportBackupService.java
@@ -261,7 +261,15 @@ public class ExportBackupService extends Service {
}
private void messageExport(SQLiteDatabase db, String uuid, PrintWriter writer, Progress progress) {
- Cursor cursor = db.rawQuery("select messages.* from messages join conversations on conversations.uuid=messages.conversationUuid where conversations.accountUuid=?", new String[]{uuid});
+ // not select and create column Message.FILE_DELETED to be compareable with conversations
+ Cursor cursor = db.rawQuery("select messages." + String.join(", messages.", new String[] {
+ Message.UUID, Message.CONVERSATION, Message.TIME_SENT, Message.COUNTERPART, Message.TRUE_COUNTERPART,
+ Message.BODY, Message.ENCRYPTION, Message.STATUS, Message.TYPE, Message.RELATIVE_FILE_PATH,
+ Message.SERVER_MSG_ID, Message.FINGERPRINT, Message.CARBON, Message.EDITED, Message.READ,
+ Message.DELETED, Message.OOB, Message.ERROR_MESSAGE, Message.READ_BY_MARKERS, Message.MARKABLE,
+ Message.REMOTE_MSG_ID, Message.CONVERSATION
+ }) + " from messages join conversations on conversations.uuid=messages.conversationUuid where conversations.accountUuid=?", new String[]{uuid});
+
int size = cursor != null ? cursor.getCount() : 0;
Log.d(Config.LOGTAG, "exporting " + size + " messages");
int i = 0;
@@ -473,4 +481,4 @@ public class ExportBackupService extends Service {
return builder.build();
}
}
-} \ No newline at end of file
+}