Show contact name for message Sender

Fixes #265
This commit is contained in:
AsamK 2020-02-12 20:23:04 +01:00
parent f3ecddba6f
commit 2cd6b2b99b

View file

@ -76,7 +76,8 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
if (content == null) { if (content == null) {
System.out.println("Failed to decrypt message."); System.out.println("Failed to decrypt message.");
} else { } else {
System.out.println(String.format("Sender: %s (device: %d)", content.getSender().getNumber().get(), content.getSenderDevice())); ContactInfo sourceContact = m.getContact(content.getSender().getNumber().get());
System.out.println(String.format("Sender: %s (device: %d)", (sourceContact == null ? "" : "" + sourceContact.name + "") + content.getSender().getNumber().get(), content.getSenderDevice()));
if (content.getDataMessage().isPresent()) { if (content.getDataMessage().isPresent()) {
SignalServiceDataMessage message = content.getDataMessage().get(); SignalServiceDataMessage message = content.getDataMessage().get();
handleSignalServiceDataMessage(message); handleSignalServiceDataMessage(message);