|
@@ -12,23 +12,40 @@ module.exports.func = async function (program, backup, resolve, reject) {
|
|
|
// if (program.dump) {
|
|
|
// return new Promise(async (resolve, reject) => {
|
|
|
let conversations = await backup.getConversations()
|
|
|
+ let conversations_full = []
|
|
|
for (let el of conversations) {
|
|
|
- el.messages = await backup.getMessages(el.ROWID, true)
|
|
|
+ let messages = await backup.getMessages(el.ROWID, true)
|
|
|
+ for (let message of messages) {
|
|
|
+ message.conversation = el
|
|
|
+ message.attachments = await backup.getMessageAttachments(message.ROWID)
|
|
|
+ }
|
|
|
+ conversations_full.push(...messages)
|
|
|
}
|
|
|
|
|
|
// Use the configured formatter to print the rows.
|
|
|
- const result = program.formatter.format(conversations, {
|
|
|
+ const result = program.formatter.format(conversations_full, {
|
|
|
// Color formatting?
|
|
|
program: program,
|
|
|
|
|
|
// Columns to be displayed in human-readable printouts.
|
|
|
// Some formatters, like raw or CSV, ignore these.
|
|
|
columns: {
|
|
|
- 'ID': el => el.ROWID,
|
|
|
- 'Date': el => el.XFORMATTEDDATESTRING || '??',
|
|
|
- 'Service': el => el.service_name + '',
|
|
|
- 'Chat Name': el => el.chat_identifier + '',
|
|
|
- 'Display Name': el => el.display_name + ''
|
|
|
+ 'conversation_id': el => el.conversation.ROWID,
|
|
|
+ 'date': el => el.conversation.XFORMATTEDDATESTRING || '??',
|
|
|
+ 'service': el => el.conversation.service_name + '',
|
|
|
+ 'chat_name': el => el.conversation.chat_identifier + '',
|
|
|
+ 'display_name': el => el.conversation.display_name + '',
|
|
|
+ 'message_id': el => el.ROWID + '',
|
|
|
+ 'content': el => el.text + '',
|
|
|
+ 'date': el => el.date + '',
|
|
|
+ 'date_read': el => el.date_read + '',
|
|
|
+ 'date_delivered': el => el.date_delivered + '',
|
|
|
+ 'is_delivered': el => el.is_delivered + '',
|
|
|
+ 'is_finished': el => el.is_finished + '',
|
|
|
+ 'is_from_me': el => el.is_from_me + '',
|
|
|
+ 'is_read': el => el.is_read + '',
|
|
|
+ 'is_sent': el => el.is_sent + '',
|
|
|
+ 'attachments': el => el.attachments.map((at) => at.filename)
|
|
|
}
|
|
|
})
|
|
|
|