mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Show GroupInfo of messages, if present
This commit is contained in:
parent
96bd68e034
commit
c5b884f62b
1 changed files with 43 additions and 14 deletions
|
@ -273,13 +273,54 @@ public class Main {
|
|||
} else {
|
||||
if (content.getDataMessage().isPresent()) {
|
||||
TextSecureDataMessage message = content.getDataMessage().get();
|
||||
System.out.println("Body: " + message.getBody().get());
|
||||
|
||||
System.out.println("Message timestamp: " + message.getTimestamp());
|
||||
|
||||
if (message.getBody().isPresent()) {
|
||||
System.out.println("Body: " + message.getBody().get());
|
||||
}
|
||||
if (message.getGroupInfo().isPresent()) {
|
||||
TextSecureGroup groupInfo = message.getGroupInfo().get();
|
||||
System.out.println("Group info:");
|
||||
System.out.println(" Id: " + Base64.encodeBytes(groupInfo.getGroupId()));
|
||||
if (groupInfo.getName().isPresent()) {
|
||||
System.out.println(" Name: " + groupInfo.getName().get());
|
||||
}
|
||||
System.out.println(" Type: " + groupInfo.getType());
|
||||
if (groupInfo.getMembers().isPresent()) {
|
||||
for (String member : groupInfo.getMembers().get()) {
|
||||
System.out.println(" Member: " + member);
|
||||
}
|
||||
}
|
||||
if (groupInfo.getAvatar().isPresent()) {
|
||||
System.out.println(" Avatar:");
|
||||
printAttachment(groupInfo.getAvatar().get());
|
||||
}
|
||||
}
|
||||
if (message.isEndSession()) {
|
||||
System.out.println("Is end session");
|
||||
m.handleEndSession(envelope.getSource());
|
||||
} else if (message.getAttachments().isPresent()) {
|
||||
}
|
||||
|
||||
if (message.getAttachments().isPresent()) {
|
||||
System.out.println("Attachments: ");
|
||||
for (TextSecureAttachment attachment : message.getAttachments().get()) {
|
||||
printAttachment(attachment);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (content.getSyncMessage().isPresent()) {
|
||||
TextSecureSyncMessage syncMessage = content.getSyncMessage().get();
|
||||
System.out.println("Received sync message");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Unknown message received.");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private void printAttachment(TextSecureAttachment attachment) {
|
||||
System.out.println("- " + attachment.getContentType() + " (" + (attachment.isPointer() ? "Pointer" : "") + (attachment.isStream() ? "Stream" : "") + ")");
|
||||
if (attachment.isPointer()) {
|
||||
final TextSecureAttachmentPointer pointer = attachment.asPointer();
|
||||
|
@ -294,16 +335,4 @@ public class Main {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (content.getSyncMessage().isPresent()) {
|
||||
TextSecureSyncMessage syncMessage = content.getSyncMessage().get();
|
||||
System.out.println("Received sync message");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Unknown message received.");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue