mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add output for new message infos
This commit is contained in:
parent
c3e1d4fc75
commit
943b2c7304
1 changed files with 61 additions and 20 deletions
|
@ -11,6 +11,8 @@ import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
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.SignalServiceReceiptMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
|
import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.calls.AnswerMessage;
|
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.BlockedListMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.multidevice.ConfigurationMessage;
|
import org.whispersystems.signalservice.api.messages.multidevice.ConfigurationMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.multidevice.ContactsMessage;
|
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.ReadMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
||||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||||
|
@ -170,6 +174,15 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
||||||
if (configurationMessage.getReadReceipts().isPresent()) {
|
if (configurationMessage.getReadReceipts().isPresent()) {
|
||||||
System.out.println(" - Read receipts: " + (configurationMessage.getReadReceipts().get() ? "enabled" : "disabled"));
|
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()) {
|
if (syncMessage.getFetchType().isPresent()) {
|
||||||
final SignalServiceSyncMessage.FetchType fetchType = syncMessage.getFetchType().get();
|
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()) {
|
if (content.getCallMessage().isPresent()) {
|
||||||
System.out.println("Received a call message");
|
System.out.println("Received a call message");
|
||||||
|
@ -266,34 +299,42 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
||||||
if (message.getBody().isPresent()) {
|
if (message.getBody().isPresent()) {
|
||||||
System.out.println("Body: " + message.getBody().get());
|
System.out.println("Body: " + message.getBody().get());
|
||||||
}
|
}
|
||||||
if (message.getGroupContext().isPresent() && message.getGroupContext().get().getGroupV1().isPresent()) {
|
if (message.getGroupContext().isPresent()) {
|
||||||
SignalServiceGroup groupInfo = message.getGroupContext().get().getGroupV1().get();
|
|
||||||
System.out.println("Group info:");
|
System.out.println("Group info:");
|
||||||
System.out.println(" Id: " + Base64.encodeBytes(groupInfo.getGroupId()));
|
final SignalServiceGroupContext groupContext = message.getGroupContext().get();
|
||||||
if (groupInfo.getType() == SignalServiceGroup.Type.UPDATE && groupInfo.getName().isPresent()) {
|
if (groupContext.getGroupV1().isPresent()) {
|
||||||
System.out.println(" Name: " + groupInfo.getName().get());
|
SignalServiceGroup groupInfo = groupContext.getGroupV1().get();
|
||||||
} else {
|
System.out.println(" Id: " + Base64.encodeBytes(groupInfo.getGroupId()));
|
||||||
GroupInfo group = m.getGroup(groupInfo.getGroupId());
|
if (groupInfo.getType() == SignalServiceGroup.Type.UPDATE && groupInfo.getName().isPresent()) {
|
||||||
if (group != null) {
|
System.out.println(" Name: " + groupInfo.getName().get());
|
||||||
System.out.println(" Name: " + group.name);
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println(" Name: <Unknown group>");
|
GroupInfo group = m.getGroup(groupInfo.getGroupId());
|
||||||
|
if (group != null) {
|
||||||
|
System.out.println(" Name: " + group.name);
|
||||||
|
} else {
|
||||||
|
System.out.println(" Name: <Unknown group>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
System.out.println(" Type: " + groupInfo.getType());
|
||||||
System.out.println(" Type: " + groupInfo.getType());
|
if (groupInfo.getMembers().isPresent()) {
|
||||||
if (groupInfo.getMembers().isPresent()) {
|
for (SignalServiceAddress member : groupInfo.getMembers().get()) {
|
||||||
for (SignalServiceAddress member : groupInfo.getMembers().get()) {
|
System.out.println(" Member: " + member.getLegacyIdentifier());
|
||||||
System.out.println(" Member: " + member.getLegacyIdentifier());
|
}
|
||||||
}
|
}
|
||||||
}
|
if (groupInfo.getAvatar().isPresent()) {
|
||||||
if (groupInfo.getAvatar().isPresent()) {
|
System.out.println(" Avatar:");
|
||||||
System.out.println(" Avatar:");
|
printAttachment(groupInfo.getAvatar().get());
|
||||||
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()) {
|
if (message.getPreviews().isPresent()) {
|
||||||
final List<SignalServiceDataMessage.Preview> previews = message.getPreviews().get();
|
final List<SignalServiceDataMessage.Preview> previews = message.getPreviews().get();
|
||||||
System.out.println("Previes:");
|
System.out.println("Previews:");
|
||||||
for (SignalServiceDataMessage.Preview preview : previews) {
|
for (SignalServiceDataMessage.Preview preview : previews) {
|
||||||
System.out.println(" - Title: " + preview.getTitle());
|
System.out.println(" - Title: " + preview.getTitle());
|
||||||
System.out.println(" - Url: " + preview.getUrl());
|
System.out.println(" - Url: " + preview.getUrl());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue