conversations_full.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. module.exports.name = 'conversations_full'
  2. module.exports.description = 'List all SMS and iMessage conversations and their messages (dump only)'
  3. // Specify this reporter requires a backup.
  4. // The second parameter to func() is now a backup instead of the path to one.
  5. module.exports.requiresBackup = true
  6. // Specify this reporter supports the promises API for allowing chaining of reports.
  7. module.exports.usesPromises = true
  8. module.exports.func = async function (program, backup, resolve, reject) {
  9. // if (program.dump) {
  10. // return new Promise(async (resolve, reject) => {
  11. let conversations = await backup.getConversations()
  12. for (let el of conversations) {
  13. el.messages = await backup.getMessages(el.ROWID, true)
  14. }
  15. // Use the configured formatter to print the rows.
  16. const result = program.formatter.format(conversations, {
  17. // Color formatting?
  18. program: program,
  19. // Columns to be displayed in human-readable printouts.
  20. // Some formatters, like raw or CSV, ignore these.
  21. columns: {
  22. 'ID': el => el.ROWID,
  23. 'Date': el => el.XFORMATTEDDATESTRING || '??',
  24. 'Service': el => el.service_name + '',
  25. 'Chat Name': el => el.chat_identifier + '',
  26. 'Display Name': el => el.display_name + ''
  27. }
  28. })
  29. resolve(result)
  30. }