Skip to content

Commit

Permalink
Merge pull request #2407 from sepinf-inc/#2406_WAChatsDates
Browse files Browse the repository at this point in the history
Set created/modified dates based on first/ last messages dates (#2406)
  • Loading branch information
lfcnassif authored Jan 12, 2025
2 parents db1078d + fd62e0b commit 3d1fb53
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ private void createReport(List<Chat> chatList, IItemSearcher searcher, WAContact
}
}

// Set created and modified dates based on the first and last messages dates
if (!msgSubset.isEmpty()) {
Message first = msgSubset.get(0);
chatMetadata.set(TikaCoreProperties.CREATED, first.getTimeStamp());
Message last = msgSubset.get(msgSubset.size() - 1);
chatMetadata.set(TikaCoreProperties.MODIFIED, last.getTimeStamp());
}

ByteArrayInputStream chatStream = new ByteArrayInputStream(bytes);
extractor.parseEmbedded(chatStream, handler, chatMetadata, false);
bytes = nextBytes;
Expand Down

0 comments on commit 3d1fb53

Please sign in to comment.