mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add basic sealed sender support
This commit is contained in:
parent
9d836414f0
commit
209c613e43
2 changed files with 9 additions and 2 deletions
|
@ -19,6 +19,9 @@ class JsonMessageEnvelope {
|
||||||
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent content) {
|
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent content) {
|
||||||
SignalServiceAddress source = envelope.getSourceAddress();
|
SignalServiceAddress source = envelope.getSourceAddress();
|
||||||
this.source = source.getNumber();
|
this.source = source.getNumber();
|
||||||
|
if (this.source.equals("")) {
|
||||||
|
this.source = content.getSender();
|
||||||
|
}
|
||||||
this.sourceDevice = envelope.getSourceDevice();
|
this.sourceDevice = envelope.getSourceDevice();
|
||||||
this.relay = source.getRelay().isPresent() ? source.getRelay().get() : null;
|
this.relay = source.getRelay().isPresent() ? source.getRelay().get() : null;
|
||||||
this.timestamp = envelope.getTimestamp();
|
this.timestamp = envelope.getTimestamp();
|
||||||
|
|
|
@ -43,8 +43,12 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
|
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
|
||||||
SignalServiceAddress source = envelope.getSourceAddress();
|
SignalServiceAddress source = envelope.getSourceAddress();
|
||||||
ContactInfo sourceContact = m.getContact(source.getNumber());
|
String sender = source.getNumber();
|
||||||
System.out.println(String.format("Envelope from: %s (device: %d)", (sourceContact == null ? "" : "“" + sourceContact.name + "” ") + source.getNumber(), envelope.getSourceDevice()));
|
if (sender.equals("")) {
|
||||||
|
sender = content.getSender();
|
||||||
|
}
|
||||||
|
ContactInfo sourceContact = m.getContact(sender);
|
||||||
|
System.out.println(String.format("Envelope from: %s (device: %d)", (sourceContact == null ? "" : "“" + sourceContact.name + "” ") + sender, envelope.getSourceDevice()));
|
||||||
if (source.getRelay().isPresent()) {
|
if (source.getRelay().isPresent()) {
|
||||||
System.out.println("Relayed by: " + source.getRelay().get());
|
System.out.println("Relayed by: " + source.getRelay().get());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue