Add output for new message infos

This commit is contained in:
AsamK 2020-11-22 12:56:32 +01:00
parent c3e1d4fc75
commit 943b2c7304

View file

@ -11,6 +11,8 @@ import org.whispersystems.signalservice.api.messages.SignalServiceContent;
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupContext;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupV2;
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
import org.whispersystems.signalservice.api.messages.calls.AnswerMessage;
@ -22,6 +24,8 @@ import org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMess
import org.whispersystems.signalservice.api.messages.multidevice.BlockedListMessage;
import org.whispersystems.signalservice.api.messages.multidevice.ConfigurationMessage;
import org.whispersystems.signalservice.api.messages.multidevice.ContactsMessage;
import org.whispersystems.signalservice.api.messages.multidevice.KeysMessage;
import org.whispersystems.signalservice.api.messages.multidevice.MessageRequestResponseMessage;
import org.whispersystems.signalservice.api.messages.multidevice.ReadMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
@ -170,6 +174,15 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
if (configurationMessage.getReadReceipts().isPresent()) {
System.out.println(" - Read receipts: " + (configurationMessage.getReadReceipts().get() ? "enabled" : "disabled"));
}
if (configurationMessage.getLinkPreviews().isPresent()) {
System.out.println(" - Link previews: " + (configurationMessage.getLinkPreviews().get() ? "enabled" : "disabled"));
}
if (configurationMessage.getTypingIndicators().isPresent()) {
System.out.println(" - Typing indicators: " + (configurationMessage.getTypingIndicators().get() ? "enabled" : "disabled"));
}
if (configurationMessage.getUnidentifiedDeliveryIndicators().isPresent()) {
System.out.println(" - Unidentified Delivery Indicators: " + (configurationMessage.getUnidentifiedDeliveryIndicators().get() ? "enabled" : "disabled"));
}
}
if (syncMessage.getFetchType().isPresent()) {
final SignalServiceSyncMessage.FetchType fetchType = syncMessage.getFetchType().get();
@ -194,6 +207,26 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
}
}
}
if (syncMessage.getMessageRequestResponse().isPresent()) {
final MessageRequestResponseMessage requestResponseMessage = syncMessage.getMessageRequestResponse().get();
System.out.println("Received message request response:");
System.out.println(" Type: " + requestResponseMessage.getType());
if (requestResponseMessage.getGroupId().isPresent()) {
System.out.println(" Group id: " + Base64.encodeBytes(requestResponseMessage.getGroupId().get()));
}
if (requestResponseMessage.getPerson().isPresent()) {
System.out.println(" Person: " + requestResponseMessage.getPerson().get().getLegacyIdentifier());
}
}
if (syncMessage.getKeys().isPresent()) {
final KeysMessage keysMessage = syncMessage.getKeys().get();
System.out.println("Received sync message with keys:");
if (keysMessage.getStorageService().isPresent()) {
System.out.println(" With storage key length: " + keysMessage.getStorageService().get().serialize().length);
} else {
System.out.println(" With empty storage key");
}
}
}
if (content.getCallMessage().isPresent()) {
System.out.println("Received a call message");
@ -266,9 +299,11 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
if (message.getBody().isPresent()) {
System.out.println("Body: " + message.getBody().get());
}
if (message.getGroupContext().isPresent() && message.getGroupContext().get().getGroupV1().isPresent()) {
SignalServiceGroup groupInfo = message.getGroupContext().get().getGroupV1().get();
if (message.getGroupContext().isPresent()) {
System.out.println("Group info:");
final SignalServiceGroupContext groupContext = message.getGroupContext().get();
if (groupContext.getGroupV1().isPresent()) {
SignalServiceGroup groupInfo = groupContext.getGroupV1().get();
System.out.println(" Id: " + Base64.encodeBytes(groupInfo.getGroupId()));
if (groupInfo.getType() == SignalServiceGroup.Type.UPDATE && groupInfo.getName().isPresent()) {
System.out.println(" Name: " + groupInfo.getName().get());
@ -290,10 +325,16 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
System.out.println(" Avatar:");
printAttachment(groupInfo.getAvatar().get());
}
} else if (groupContext.getGroupV2().isPresent()) {
final SignalServiceGroupV2 groupInfo = groupContext.getGroupV2().get();
System.out.println(" Revision: " + groupInfo.getRevision());
System.out.println(" Master key length: " + groupInfo.getMasterKey().serialize().length);
System.out.println(" Has signed group change: " + groupInfo.hasSignedGroupChange());
}
}
if (message.getPreviews().isPresent()) {
final List<SignalServiceDataMessage.Preview> previews = message.getPreviews().get();
System.out.println("Previes:");
System.out.println("Previews:");
for (SignalServiceDataMessage.Preview preview : previews) {
System.out.println(" - Title: " + preview.getTitle());
System.out.println(" - Url: " + preview.getUrl());