mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Update libsignal-service-java
This commit is contained in:
parent
f445cfb5c1
commit
30690785fd
19 changed files with 71 additions and 42 deletions
|
@ -4,9 +4,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupUtils;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroupV2;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
@ -36,7 +36,7 @@ class JsonGroupInfo {
|
|||
this.members = groupInfo.getMembers()
|
||||
.get()
|
||||
.stream()
|
||||
.map(SignalServiceAddress::getLegacyIdentifier)
|
||||
.map(Util::getLegacyIdentifier)
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
this.members = null;
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.asamk.signal.manager.Manager;
|
|||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
public class JsonMention {
|
||||
|
||||
@JsonProperty
|
||||
|
@ -18,8 +20,8 @@ public class JsonMention {
|
|||
final int length;
|
||||
|
||||
JsonMention(SignalServiceDataMessage.Mention mention, Manager m) {
|
||||
this.name = m.resolveSignalServiceAddress(new SignalServiceAddress(mention.getUuid(), null))
|
||||
.getLegacyIdentifier();
|
||||
this.name = getLegacyIdentifier(m.resolveSignalServiceAddress(new SignalServiceAddress(mention.getUuid(),
|
||||
null)));
|
||||
this.start = mention.getStart();
|
||||
this.length = mention.getLength();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
public class JsonMessageEnvelope {
|
||||
|
||||
@JsonProperty
|
||||
|
@ -48,11 +50,11 @@ public class JsonMessageEnvelope {
|
|||
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent content, Manager m) {
|
||||
if (!envelope.isUnidentifiedSender() && envelope.hasSource()) {
|
||||
var source = envelope.getSourceAddress();
|
||||
this.source = source.getLegacyIdentifier();
|
||||
this.source = getLegacyIdentifier(source);
|
||||
this.sourceDevice = envelope.getSourceDevice();
|
||||
this.relay = source.getRelay().orNull();
|
||||
} else if (envelope.isUnidentifiedSender() && content != null) {
|
||||
this.source = content.getSender().getLegacyIdentifier();
|
||||
this.source = getLegacyIdentifier(content.getSender());
|
||||
this.sourceDevice = content.getSenderDevice();
|
||||
this.relay = null;
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
public class JsonQuote {
|
||||
|
||||
@JsonProperty
|
||||
|
@ -30,7 +32,7 @@ public class JsonQuote {
|
|||
|
||||
JsonQuote(SignalServiceDataMessage.Quote quote, Manager m) {
|
||||
this.id = quote.getId();
|
||||
this.author = m.resolveSignalServiceAddress(quote.getAuthor()).getLegacyIdentifier();
|
||||
this.author = getLegacyIdentifier(m.resolveSignalServiceAddress(quote.getAuthor()));
|
||||
this.text = quote.getText();
|
||||
|
||||
if (quote.getMentions() != null && quote.getMentions().size() > 0) {
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import org.asamk.signal.manager.Manager;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage.Reaction;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
public class JsonReaction {
|
||||
|
||||
@JsonProperty
|
||||
|
@ -21,7 +23,7 @@ public class JsonReaction {
|
|||
|
||||
JsonReaction(Reaction reaction, Manager m) {
|
||||
this.emoji = reaction.getEmoji();
|
||||
this.targetAuthor = m.resolveSignalServiceAddress(reaction.getTargetAuthor()).getLegacyIdentifier();
|
||||
this.targetAuthor = getLegacyIdentifier(m.resolveSignalServiceAddress(reaction.getTargetAuthor()));
|
||||
this.targetSentTimestamp = reaction.getTargetSentTimestamp();
|
||||
this.isRemove = reaction.isRemove();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
|
||||
import org.asamk.Signal;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
class JsonSyncDataMessage extends JsonDataMessage {
|
||||
|
||||
|
@ -15,9 +15,7 @@ class JsonSyncDataMessage extends JsonDataMessage {
|
|||
JsonSyncDataMessage(SentTranscriptMessage transcriptMessage, Manager m) {
|
||||
super(transcriptMessage.getMessage(), m);
|
||||
|
||||
this.destination = transcriptMessage.getDestination()
|
||||
.transform(SignalServiceAddress::getLegacyIdentifier)
|
||||
.orNull();
|
||||
this.destination = transcriptMessage.getDestination().transform(Util::getLegacyIdentifier).orNull();
|
||||
}
|
||||
|
||||
JsonSyncDataMessage(Signal.SyncMessageReceived messageReceived) {
|
||||
|
|
|
@ -5,13 +5,15 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
|
||||
import org.asamk.Signal;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
enum JsonSyncMessageType {
|
||||
CONTACTS_SYNC,
|
||||
GROUPS_SYNC,
|
||||
|
@ -50,7 +52,7 @@ class JsonSyncMessage {
|
|||
.get()
|
||||
.getAddresses()
|
||||
.stream()
|
||||
.map(SignalServiceAddress::getLegacyIdentifier)
|
||||
.map(Util::getLegacyIdentifier)
|
||||
.collect(Collectors.toList());
|
||||
this.blockedGroupIds = syncMessage.getBlockedList()
|
||||
.get()
|
||||
|
@ -66,7 +68,7 @@ class JsonSyncMessage {
|
|||
this.readMessages = syncMessage.getRead()
|
||||
.get()
|
||||
.stream()
|
||||
.map(message -> new JsonSyncReadMessage(message.getSender().getLegacyIdentifier(),
|
||||
.map(message -> new JsonSyncReadMessage(getLegacyIdentifier(message.getSender()),
|
||||
message.getTimestamp()))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue