mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Use correct sender device for receiving sealed messages
This commit is contained in:
parent
50b6174dd6
commit
90b752b912
2 changed files with 5 additions and 2 deletions
|
@ -19,10 +19,11 @@ class JsonMessageEnvelope {
|
|||
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent content) {
|
||||
SignalServiceAddress source = envelope.getSourceAddress();
|
||||
this.source = source.getNumber();
|
||||
this.sourceDevice = envelope.getSourceDevice();
|
||||
if (this.source.equals("")) {
|
||||
this.source = content.getSender();
|
||||
this.sourceDevice = content.getSenderDevice();
|
||||
}
|
||||
this.sourceDevice = envelope.getSourceDevice();
|
||||
this.relay = source.getRelay().isPresent() ? source.getRelay().get() : null;
|
||||
this.timestamp = envelope.getTimestamp();
|
||||
this.isReceipt = envelope.isReceipt();
|
||||
|
|
|
@ -44,11 +44,13 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
|
||||
SignalServiceAddress source = envelope.getSourceAddress();
|
||||
String sender = source.getNumber();
|
||||
int senderDeviceId = envelope.getSourceDevice();
|
||||
if (sender.equals("")) {
|
||||
sender = content.getSender();
|
||||
senderDeviceId = content.getSenderDevice();
|
||||
}
|
||||
ContactInfo sourceContact = m.getContact(sender);
|
||||
System.out.println(String.format("Envelope from: %s (device: %d)", (sourceContact == null ? "" : "“" + sourceContact.name + "” ") + sender, envelope.getSourceDevice()));
|
||||
System.out.println(String.format("Envelope from: %s (device: %d)", (sourceContact == null ? "" : "“" + sourceContact.name + "” ") + sender, senderDeviceId));
|
||||
if (source.getRelay().isPresent()) {
|
||||
System.out.println("Relayed by: " + source.getRelay().get());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue