12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- const stripAnsi = require('strip-ansi')
- const chalk = require('chalk')
- const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
- const normalizeCols = require('../util/normalize.js')
- module.exports.name = 'messages'
- module.exports.description = 'List all SMS and iMessage messages in a conversation'
- // Specify this reporter requires a backup.
- // The second parameter to func() is now a backup instead of the path to one.
- module.exports.requiresBackup = true
- // Specify this reporter supports the promises API for allowing chaining of reports.
- module.exports.usesPromises = true
- // Should this report be skipped in automated reports?
- // This is used when the 'all' report type is specified, and all possible reports are generated.
- // with this set to true, the report WILL NOT run when report type = 'all'
- module.exports.requiresInteractivity = true
- module.exports.func = function (program, backup, resolve, reject) {
- if (!program.id) {
- console.log('use -i or --id <id> to specify conversation ID.')
- process.exit(1)
- }
- backup.getMessages(program.id)
- .then((items) => {
-
- var result = program.formatter.format(items, {
- program: program,
- columns: {
- 'ID' : el => el.ROWID,
- 'Date': el => el.XFORMATTEDDATESTRING,
- 'Sender': el => el.x_sender,
- 'Text': el => (el.text || '').trim()
- }
- })
- resolve(result)
- })
- .catch(reject)
- }
|