mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-17 13:11:00 +00:00
Update libsignal-service
This commit is contained in:
parent
b4275414e1
commit
4a3d9d90a6
@ -3,7 +3,7 @@ slf4j = "2.0.17"
|
||||
junit = "6.0.3"
|
||||
micronaut-json-schema = "2.0.0-M8"
|
||||
micronaut-core = "4.9.3"
|
||||
signal-service = "2.15.3_unofficial_145"
|
||||
signal-service = "2.15.3_unofficial_146"
|
||||
|
||||
[libraries]
|
||||
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.84"
|
||||
|
||||
@ -259,7 +259,7 @@ public interface Manager extends Closeable {
|
||||
RecipientIdentifier.Single recipient
|
||||
) throws IOException;
|
||||
|
||||
SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException;
|
||||
void sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException;
|
||||
|
||||
SendMessageResults sendMessageRequestResponse(
|
||||
MessageEnvelope.Sync.MessageRequestResponse.Type type,
|
||||
|
||||
@ -157,7 +157,7 @@ public record MessageEnvelope(
|
||||
dataMessage.getExpiresInSeconds(),
|
||||
dataMessage.isExpirationUpdate(),
|
||||
dataMessage.isViewOnce(),
|
||||
dataMessage.isEndSession(),
|
||||
false,
|
||||
dataMessage.isProfileKeyUpdate(),
|
||||
dataMessage.getProfileKey().isPresent(),
|
||||
dataMessage.getReaction().map(r -> Reaction.from(r, recipientResolver, addressResolver)),
|
||||
@ -1028,7 +1028,7 @@ public record MessageEnvelope(
|
||||
final AttachmentFileProvider fileProvider,
|
||||
Exception exception
|
||||
) {
|
||||
final var serviceId = envelope.getSourceServiceId().map(ServiceId::parseOrNull).orElse(null);
|
||||
final var serviceId = envelope.getSourceServiceId();
|
||||
final var source = !envelope.isUnidentifiedSender() && serviceId != null
|
||||
? recipientResolver.resolveRecipient(serviceId)
|
||||
: envelope.isUnidentifiedSender() && content != null
|
||||
|
||||
@ -142,10 +142,11 @@ public final class IncomingMessageHandler {
|
||||
final var actions = new ArrayList<HandleAction>();
|
||||
SignalServiceContent content = null;
|
||||
Exception exception = null;
|
||||
envelope.getSourceServiceId().map(ServiceId::parseOrNull)
|
||||
// Store uuid if we don't have it already
|
||||
// uuid in envelope is sent by server
|
||||
.ifPresent(serviceId -> account.getRecipientResolver().resolveRecipient(serviceId));
|
||||
if (envelope.getSourceServiceId() != null) {
|
||||
// Store uuid if we don't have it already
|
||||
// uuid in envelope is sent by server
|
||||
account.getRecipientResolver().resolveRecipient(envelope.getSourceServiceId());
|
||||
}
|
||||
if (!envelope.isReceipt()) {
|
||||
final var destination = getDestination(envelope).serviceId();
|
||||
try {
|
||||
@ -874,11 +875,6 @@ public final class IncomingMessageHandler {
|
||||
|
||||
final var selfAddress = isSync ? source : destination;
|
||||
final var conversationPartnerAddress = isSync ? destination : source;
|
||||
if (conversationPartnerAddress != null && message.isEndSession()) {
|
||||
account.getAccountData(selfAddress.serviceId())
|
||||
.getSessionStore()
|
||||
.deleteAllSessions(conversationPartnerAddress.serviceId());
|
||||
}
|
||||
if (message.isExpirationUpdate() || message.getBody().isPresent()) {
|
||||
if (message.getGroupContext().isPresent()) {
|
||||
final var groupContext = message.getGroupContext().get();
|
||||
@ -1047,7 +1043,7 @@ public final class IncomingMessageHandler {
|
||||
}
|
||||
|
||||
private SignalServiceAddress getSenderAddress(SignalServiceEnvelope envelope, SignalServiceContent content) {
|
||||
final var serviceId = envelope.getSourceServiceId().map(ServiceId::parseOrNull).orElse(null);
|
||||
final var serviceId = envelope.getSourceServiceId();
|
||||
if (!envelope.isUnidentifiedSender() && serviceId != null) {
|
||||
return new SignalServiceAddress(serviceId);
|
||||
} else if (content != null) {
|
||||
@ -1058,7 +1054,7 @@ public final class IncomingMessageHandler {
|
||||
}
|
||||
|
||||
private DeviceAddress getSender(SignalServiceEnvelope envelope, SignalServiceContent content) {
|
||||
final var serviceId = envelope.getSourceServiceId().map(ServiceId::parseOrNull).orElse(null);
|
||||
final var serviceId = envelope.getSourceServiceId();
|
||||
if (!envelope.isUnidentifiedSender() && serviceId != null) {
|
||||
return new DeviceAddress(account.getRecipientResolver().resolveRecipient(serviceId),
|
||||
serviceId,
|
||||
|
||||
@ -9,7 +9,6 @@ import org.asamk.signal.manager.jobs.CleanOldPreKeysJob;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
import org.asamk.signal.manager.storage.messageCache.CachedMessage;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
import org.signal.core.models.ServiceId;
|
||||
import org.signal.core.models.ServiceId.ACI;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -150,10 +149,10 @@ public class ReceiveHelper {
|
||||
for (final var it : batch) {
|
||||
SignalServiceEnvelope envelope1 = new SignalServiceEnvelope(it.getEnvelope(),
|
||||
it.getServerDeliveredTimestamp());
|
||||
final var recipientId = envelope1.getSourceServiceId()
|
||||
.map(ServiceId::parseOrNull)
|
||||
.map(s -> account.getRecipientResolver().resolveRecipient(s))
|
||||
.orElse(null);
|
||||
final var sourceServiceId = envelope1.getSourceServiceId();
|
||||
final var recipientId = sourceServiceId == null
|
||||
? null
|
||||
: account.getRecipientResolver().resolveRecipient(sourceServiceId);
|
||||
logger.trace("Storing new message from {}", recipientId);
|
||||
// store message on disk, before acknowledging receipt to the server
|
||||
cachedMessage[0] = account.getMessageCache().cacheMessage(envelope1, recipientId);
|
||||
@ -238,7 +237,7 @@ public class ReceiveHelper {
|
||||
if (exception instanceof UntrustedIdentityException) {
|
||||
logger.debug("Keeping message with untrusted identity in message cache");
|
||||
final var address = ((UntrustedIdentityException) exception).getSender();
|
||||
if (envelope.getSourceServiceId().isEmpty() && address.aci().isPresent()) {
|
||||
if (envelope.getSourceServiceId() == null && address.aci().isPresent()) {
|
||||
final var recipientId = account.getRecipientResolver()
|
||||
.resolveRecipient(ACI.parseOrThrow(address.aci().get()));
|
||||
try {
|
||||
@ -292,7 +291,7 @@ public class ReceiveHelper {
|
||||
cachedMessage.delete();
|
||||
return null;
|
||||
}
|
||||
if (envelope.getSourceServiceId().isEmpty()) {
|
||||
if (envelope.getSourceServiceId() == null) {
|
||||
final var identifier = ((UntrustedIdentityException) exception).getSender();
|
||||
final var recipientId = account.getRecipientResolver()
|
||||
.resolveRecipient(new RecipientAddress(identifier));
|
||||
|
||||
@ -1091,30 +1091,26 @@ public class ManagerImpl implements Manager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException {
|
||||
var messageBuilder = SignalServiceDataMessage.newBuilder().asEndSessionMessage();
|
||||
|
||||
try {
|
||||
return sendMessage(messageBuilder,
|
||||
recipients.stream().map(RecipientIdentifier.class::cast).collect(Collectors.toSet()),
|
||||
false);
|
||||
} catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
|
||||
throw new AssertionError(e);
|
||||
} finally {
|
||||
for (var recipient : recipients) {
|
||||
final RecipientId recipientId;
|
||||
try {
|
||||
recipientId = context.getRecipientHelper().resolveRecipient(recipient);
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
continue;
|
||||
}
|
||||
final var serviceId = context.getAccount()
|
||||
.getRecipientAddressResolver()
|
||||
.resolveRecipientAddress(recipientId)
|
||||
.serviceId();
|
||||
if (serviceId.isPresent()) {
|
||||
account.getAccountData(ServiceIdType.ACI).getSessionStore().deleteAllSessions(serviceId.get());
|
||||
}
|
||||
public void sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException {
|
||||
for (var recipient : recipients) {
|
||||
final RecipientId recipientId;
|
||||
try {
|
||||
recipientId = context.getRecipientHelper().resolveRecipient(recipient);
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
continue;
|
||||
}
|
||||
final var recipientAddress = context.getAccount()
|
||||
.getRecipientAddressResolver()
|
||||
.resolveRecipientAddress(recipientId);
|
||||
final var aciSessionStore = account.getAccountData(ServiceIdType.ACI).getSessionStore();
|
||||
final var pniSessionStore = account.getAccountData(ServiceIdType.PNI).getSessionStore();
|
||||
if (recipientAddress.aci().isPresent()) {
|
||||
aciSessionStore.archiveSessions(recipientAddress.aci().get());
|
||||
pniSessionStore.archiveSessions(recipientAddress.aci().get());
|
||||
}
|
||||
if (recipientAddress.pni().isPresent()) {
|
||||
aciSessionStore.archiveSessions(recipientAddress.pni().get());
|
||||
pniSessionStore.archiveSessions(recipientAddress.pni().get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,8 +144,7 @@ public class SendCommand implements JsonRpcLocalCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
final var results = m.sendEndSessionMessage(singleRecipients);
|
||||
outputResult(outputWriter, results);
|
||||
m.sendEndSessionMessage(singleRecipients);
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
|
||||
|
||||
@ -543,9 +543,8 @@ public class DbusManagerImpl implements Manager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendMessageResults sendEndSessionMessage(final Set<RecipientIdentifier.Single> recipients) throws IOException {
|
||||
public void sendEndSessionMessage(final Set<RecipientIdentifier.Single> recipients) throws IOException {
|
||||
signal.sendEndSessionMessage(recipients.stream().map(RecipientIdentifier.Single::getIdentifier).toList());
|
||||
return new SendMessageResults(0, Map.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -430,8 +430,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
||||
@Override
|
||||
public void sendEndSessionMessage(final List<String> recipients) {
|
||||
try {
|
||||
final var results = m.sendEndSessionMessage(getSingleRecipientIdentifiers(recipients, m.getSelfNumber()));
|
||||
checkSendMessageResults(results);
|
||||
m.sendEndSessionMessage(getSingleRecipientIdentifiers(recipients, m.getSelfNumber()));
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure(e.getMessage());
|
||||
}
|
||||
|
||||
@ -326,8 +326,7 @@ class SseInitialFlushTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) {
|
||||
return null;
|
||||
public void sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -328,8 +328,7 @@ class SubscribeCallEventsTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> r) {
|
||||
return null;
|
||||
public void sendEndSessionMessage(Set<RecipientIdentifier.Single> r) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user