Skip to content

Commit

Permalink
'#2031: Extract thumbnails from zmetadata for media messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Feb 2, 2024
1 parent e0bb693 commit c37e019
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,21 @@ private Message createMessageFromDB(ResultSet rs, Chat chat) throws SQLException
m.setAddress(rs.getString("mediaHash"));
break;

case APP_MESSAGE:
case AUDIO_MESSAGE:
case CONTACT_MESSAGE:
case GIF_MESSAGE:
case IMAGE_MESSAGE:
case STICKER_MESSAGE:
case VIDEO_MESSAGE:
case VIEW_ONCE_IMAGE_MESSAGE:
case VIEW_ONCE_VIDEO_MESSAGE:
byte[] thumbData = decodeThumbData(metadata);
if (thumbData != null) {
m.setThumbData(thumbData);
}
break;

default:
break;
}
Expand Down Expand Up @@ -1064,16 +1079,6 @@ protected Message.MessageType decodeMessageType(int messageType, int gEventType)
+ "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$
/*
* Filtragem por status da mensagem (ZMESSAGESTATUS):
*
* 0 - Mensagens de sistema. TODO: decodificar estas mensagens. Possiveis campos
* para realizar decodificacao: Z_OPT, ZGROUPEVENTTYPE, ZMESSAGETYPE,
* ZSPOTLIGHTSTATUS atualmente mensagens de sistema ignoradas
*
* 1 - mensagens enviadas 3 - mensagens enviadas 5 - mensagens com mídia
* associada 6 - mensagens 8 - mensagens
*/

private static final String SELECT_GROUP_MEMBERS = "select CS.ZCONTACTJID as `group`, ZMEMBERJID as member from ZWAGROUPMEMBER GM "
+ "inner join ZWACHATSESSION CS on GM.ZCHATSESSION=CS.Z_PK where `group`=?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public ProtoBufDecoder(byte[] bytes) {
}

public List<Part> decode() {
if (bytes == null) {
return null;
}
try {
pos = 0;
skipHeader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1019,11 +1019,10 @@ private synchronized void printMessage(PrintWriter out, Message message, boolean
out.println("</a><br>"); //$NON-NLS-1$
}
}

if (message.getMediaCaption() != null)
out.println("<br>" + format(message.getMediaCaption()) + "<br>"); //$NON-NLS-1$ //$NON-NLS-2$
else
out.println("<br>");
if (notNullNorBlank(message.getMediaCaption())) {
out.print("<br>" + format(message.getMediaCaption()));
}
out.println("<br>");
break;

default:
Expand Down

0 comments on commit c37e019

Please sign in to comment.