import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.groups.GroupUtils;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.groups.GroupUtils;
import org.asamk.signal.manager.storage.groups.GroupInfo;
import org.asamk.signal.util.DateUtils;
import org.asamk.signal.util.Util;
import org.asamk.signal.manager.storage.groups.GroupInfo;
import org.asamk.signal.util.DateUtils;
import org.asamk.signal.util.Util;
import org.whispersystems.signalservice.api.messages.multidevice.ViewOnceOpenMessage;
import org.whispersystems.signalservice.api.messages.shared.SharedContact;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.messages.multidevice.ViewOnceOpenMessage;
import org.whispersystems.signalservice.api.messages.shared.SharedContact;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
if (!envelope.isUnidentifiedSender() && envelope.hasSource()) {
SignalServiceAddress source = envelope.getSourceAddress();
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
if (!envelope.isUnidentifiedSender() && envelope.hasSource()) {
SignalServiceAddress source = envelope.getSourceAddress();
envelope.getSourceDevice()));
if (source.getRelay().isPresent()) {
System.out.println("Relayed by: " + source.getRelay().get());
envelope.getSourceDevice()));
if (source.getRelay().isPresent()) {
System.out.println("Relayed by: " + source.getRelay().get());
- (sourceContact == null ? "" : "“" + sourceContact.name + "” ") + content.getSender()
- .getLegacyIdentifier(),
+ (senderName == null ? "" : "“" + senderName + "” ") + content.getSender().getLegacyIdentifier(),
content.getSenderDevice()));
if (content.getDataMessage().isPresent()) {
SignalServiceDataMessage message = content.getDataMessage().get();
content.getSenderDevice()));
if (content.getDataMessage().isPresent()) {
SignalServiceDataMessage message = content.getDataMessage().get();
if (syncMessage.getRead().isPresent()) {
System.out.println("Received sync read messages list");
for (ReadMessage rm : syncMessage.getRead().get()) {
if (syncMessage.getRead().isPresent()) {
System.out.println("Received sync read messages list");
for (ReadMessage rm : syncMessage.getRead().get()) {
String to;
if (sentTranscriptMessage.getDestination().isPresent()) {
String dest = sentTranscriptMessage.getDestination().get().getLegacyIdentifier();
String to;
if (sentTranscriptMessage.getDestination().isPresent()) {
String dest = sentTranscriptMessage.getDestination().get().getLegacyIdentifier();
- ContactInfo destContact = m.getContact(dest);
- to = (destContact == null ? "" : "“" + destContact.name + "” ") + dest;
+ String name = m.getContactOrProfileName(dest);
+ to = (name == null ? "" : "“" + name + "” ") + dest;
} else if (sentTranscriptMessage.getRecipients().size() > 0) {
StringBuilder toBuilder = new StringBuilder();
for (SignalServiceAddress dest : sentTranscriptMessage.getRecipients()) {
} else if (sentTranscriptMessage.getRecipients().size() > 0) {
StringBuilder toBuilder = new StringBuilder();
for (SignalServiceAddress dest : sentTranscriptMessage.getRecipients()) {
- ContactInfo destContact = m.getContact(dest.getLegacyIdentifier());
- toBuilder.append(destContact == null ? "" : "“" + destContact.name + "” ")
+ String name = m.getContactOrProfileName(dest.getLegacyIdentifier());
+ toBuilder.append(name == null ? "" : "“" + name + "” ")
for (StickerPackOperationMessage m : stickerPackOperationMessages) {
System.out.println(" - " + m.getType().toString());
if (m.getPackId().isPresent()) {
for (StickerPackOperationMessage m : stickerPackOperationMessages) {
System.out.println(" - " + m.getType().toString());
if (m.getPackId().isPresent()) {
System.out.println("Received message request response:");
System.out.println(" Type: " + requestResponseMessage.getType());
if (requestResponseMessage.getGroupId().isPresent()) {
System.out.println("Received message request response:");
System.out.println(" Type: " + requestResponseMessage.getType());
if (requestResponseMessage.getGroupId().isPresent()) {
}
if (requestResponseMessage.getPerson().isPresent()) {
System.out.println(" Person: " + requestResponseMessage.getPerson()
}
if (requestResponseMessage.getPerson().isPresent()) {
System.out.println(" Person: " + requestResponseMessage.getPerson()
if (message.getSticker().isPresent()) {
final SignalServiceDataMessage.Sticker sticker = message.getSticker().get();
System.out.println("Sticker:");
if (message.getSticker().isPresent()) {
final SignalServiceDataMessage.Sticker sticker = message.getSticker().get();
System.out.println("Sticker:");
- System.out.println(" - Pack id: " + Base64.encodeBytes(sticker.getPackId()));
- System.out.println(" - Pack key: " + Base64.encodeBytes(sticker.getPackKey()));
+ System.out.println(" - Pack id: " + Base64.getEncoder().encodeToString(sticker.getPackId()));
+ System.out.println(" - Pack key: " + Base64.getEncoder().encodeToString(sticker.getPackKey()));
System.out.println(" - Sticker id: " + sticker.getStickerId());
// TODO also download sticker image ??
}
System.out.println(" - Sticker id: " + sticker.getStickerId());
// TODO also download sticker image ??
}