Skip to content

Commit

Permalink
Merge pull request #1862 from sepinf-inc/#1843_fix
Browse files Browse the repository at this point in the history
#1843 Better identification of deleted chats and messages
  • Loading branch information
lfcnassif authored Sep 6, 2023
2 parents e3fb3ec + 54251e3 commit f6eae92
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ private void printMessage(PrintWriter out, UfedMessage message, boolean group, b
name = Messages.getString("ReportGenerator.Unknown"); //$NON-NLS-1$
}

if (chatDeleted || message.isDeleted())
out.println("🚫 "); //$NON-NLS-1$

if (name != null)
out.println(
Expand Down Expand Up @@ -192,18 +190,24 @@ private void printMessage(PrintWriter out, UfedMessage message, boolean group, b
out.print("<p><i>" + Messages.getString("WhatsAppReport.FoundInPedoHashDB") + " "
+ format(message.getChildPornSets().toString()) + "</i></p>");
}

if (message.getTimeStamp() != null) {
out.println("<span class=\"time\">"); //$NON-NLS-1$
out.println(timeFormat.format(message.getTimeStamp())); // $NON-NLS-1$
out.println("</span>"); //$NON-NLS-1$
}

if (chatDeleted || message.isDeleted()) {
out.println("<br/><span class=\"recovered\">"); //$NON-NLS-1$
out.println("<i>" + Messages.getString("WhatsAppReport.MessageDeletedRecovered") + "</i>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
out.println("<div class=\"deletedIcon\"></div>"); //$NON-NLS-1$
out.println("</span>"); //$NON-NLS-1$
}
if (isTo)
out.println("</div><div class=\"aw\"><div class=\"awr\"></div></div>");
if (isFrom)
out.println("</div>");



out.println("</div></div>"); //$NON-NLS-1$
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ private UfedMessage createMessage(IItemReader msg) {
private UfedMessage createMessage(IItemReader msg, IItemReader attach) {
UfedMessage m = new UfedMessage();
m.setId(msg.getId());
m.setDeleted(msg.isDeleted());
for (String body : msg.getMetadata().getValues(ExtraProperties.MESSAGE_BODY)) {
if (!body.startsWith(ATTACHED_MEDIA_MSG))
m.setData(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ protected List<Chat> extractChatList() throws WAExtractorException {
c.setId(rs.getLong("id")); //$NON-NLS-1$
c.setSubject(Util.getUTF8String(rs, "subject")); //$NON-NLS-1$
c.setGroupChat(contactId.endsWith("g.us")); //$NON-NLS-1$
c.setDeleted(rs.getInt("ZREMOVED") != 0);
remote.setAvatarPath(rs.getString("avatarPath")); //$NON-NLS-1$
if (recoverDeletedRecords) {
activeChats.add(c.getId());
Expand Down Expand Up @@ -545,7 +546,7 @@ private List<Chat> undeleteChats(SQLiteUndeleteTable undeleteChatsSessions, WACo
WAContact contact = contacts.getContact(contactId);
Chat c = new Chat(contact);
c.setId(row.getIntValue("Z_PK")); //$NON-NLS-1$
c.setDeleted(row.isDeletedRow());
c.setDeleted(row.getIntValue("ZREMOVED") != 0 || row.isDeletedRow());
c.setSubject(row.getTextValue("ZPARTNERNAME")); //$NON-NLS-1$
c.setGroupChat(contactId.endsWith("g.us")); //$NON-NLS-1$
result.add(c);
Expand Down Expand Up @@ -652,13 +653,13 @@ protected Message.MessageType decodeMessageType(int messageType, int gEventType)
* ** static strings ***
*/
private static final String SELECT_CHAT_LIST = "SELECT ZWACHATSESSION.Z_PK as id, ZCONTACTJID AS contact, " //$NON-NLS-1$
+ "ZPARTNERNAME as subject, ZLASTMESSAGEDATE, ZPATH as avatarPath " //$NON-NLS-1$
+ "ZPARTNERNAME as subject, ZLASTMESSAGEDATE, ZPATH as avatarPath,ZREMOVED as ZREMOVED" //$NON-NLS-1$
+ "FROM ZWACHATSESSION " //$NON-NLS-1$
+ "LEFT JOIN ZWAPROFILEPICTUREITEM ON ZWAPROFILEPICTUREITEM.ZJID = ZWACHATSESSION.ZCONTACTJID " //$NON-NLS-1$
+ "ORDER BY ZLASTMESSAGEDATE DESC"; //$NON-NLS-1$

private static final String SELECT_CHAT_LIST_NO_PPIC = "SELECT ZWACHATSESSION.Z_PK as id, ZCONTACTJID AS contact, " //$NON-NLS-1$
+ "ZPARTNERNAME as subject, ZLASTMESSAGEDATE, NULL as avatarPath " //$NON-NLS-1$
+ "ZPARTNERNAME as subject, ZLASTMESSAGEDATE, NULL as avatarPath , 0 as ZREMOVED" //$NON-NLS-1$
+ "FROM ZWACHATSESSION " //$NON-NLS-1$
+ "ORDER BY ZLASTMESSAGEDATE DESC"; //$NON-NLS-1$
/*
Expand Down Expand Up @@ -839,4 +840,4 @@ public boolean validateRecord(SqliteRow row) {
return false;
}
}
}
}

0 comments on commit f6eae92

Please sign in to comment.