mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Update libsignal-service-java
This commit is contained in:
parent
30e8e36635
commit
be9efb9a25
5 changed files with 37 additions and 36 deletions
|
@ -716,7 +716,6 @@ public record MessageEnvelope(
|
|||
Optional<Busy> busy,
|
||||
List<IceUpdate> iceUpdate,
|
||||
Optional<Opaque> opaque,
|
||||
boolean isMultiRing,
|
||||
boolean isUrgent
|
||||
) {
|
||||
|
||||
|
@ -732,17 +731,13 @@ public record MessageEnvelope(
|
|||
.map(m -> m.stream().map(IceUpdate::from).toList())
|
||||
.orElse(List.of()),
|
||||
callMessage.getOpaqueMessage().map(Opaque::from),
|
||||
callMessage.isMultiRing(),
|
||||
callMessage.isUrgent());
|
||||
}
|
||||
|
||||
public record Offer(long id, String sdp, Type type, byte[] opaque) {
|
||||
public record Offer(long id, Type type, byte[] opaque) {
|
||||
|
||||
static Offer from(OfferMessage offerMessage) {
|
||||
return new Offer(offerMessage.getId(),
|
||||
offerMessage.getSdp(),
|
||||
Type.from(offerMessage.getType()),
|
||||
offerMessage.getOpaque());
|
||||
return new Offer(offerMessage.getId(), Type.from(offerMessage.getType()), offerMessage.getOpaque());
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
@ -758,10 +753,10 @@ public record MessageEnvelope(
|
|||
}
|
||||
}
|
||||
|
||||
public record Answer(long id, String sdp, byte[] opaque) {
|
||||
public record Answer(long id, byte[] opaque) {
|
||||
|
||||
static Answer from(AnswerMessage answerMessage) {
|
||||
return new Answer(answerMessage.getId(), answerMessage.getSdp(), answerMessage.getOpaque());
|
||||
return new Answer(answerMessage.getId(), answerMessage.getOpaque());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,10 +794,10 @@ public record MessageEnvelope(
|
|||
}
|
||||
}
|
||||
|
||||
public record IceUpdate(long id, String sdp, byte[] opaque) {
|
||||
public record IceUpdate(long id, byte[] opaque) {
|
||||
|
||||
static IceUpdate from(IceUpdateMessage iceUpdateMessage) {
|
||||
return new IceUpdate(iceUpdateMessage.getId(), iceUpdateMessage.getSdp(), iceUpdateMessage.getOpaque());
|
||||
return new IceUpdate(iceUpdateMessage.getId(), iceUpdateMessage.getOpaque());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -320,7 +320,11 @@ public class AccountHelper {
|
|||
if (currentUsername != null) {
|
||||
final var currentNickname = currentUsername.substring(0, currentUsername.indexOf('.'));
|
||||
if (currentNickname.equals(nickname)) {
|
||||
refreshCurrentUsername();
|
||||
try {
|
||||
refreshCurrentUsername();
|
||||
} catch (IOException | BaseUsernameException e) {
|
||||
logger.warn("[reserveUsername] Failed to refresh current username, trying to claim new username");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -341,11 +345,11 @@ public class AccountHelper {
|
|||
logger.debug("[reserveUsername] Successfully reserved username.");
|
||||
final var username = candidates.get(hashIndex);
|
||||
|
||||
dependencies.getAccountManager().confirmUsername(username.getUsername(), response);
|
||||
final var linkComponents = dependencies.getAccountManager().confirmUsernameAndCreateNewLink(username);
|
||||
account.setUsername(username.getUsername());
|
||||
account.setUsernameLink(linkComponents);
|
||||
account.getRecipientStore().resolveSelfRecipientTrusted(account.getSelfRecipientAddress());
|
||||
logger.debug("[confirmUsername] Successfully confirmed username.");
|
||||
tryToSetUsernameLink(username);
|
||||
}
|
||||
|
||||
public void refreshCurrentUsername() throws IOException, BaseUsernameException {
|
||||
|
@ -386,12 +390,20 @@ public class AccountHelper {
|
|||
}
|
||||
|
||||
private void tryReserveConfirmUsername(final Username username) throws IOException {
|
||||
final var response = dependencies.getAccountManager()
|
||||
.reserveUsername(List.of(Base64.encodeUrlSafeWithoutPadding(username.getHash())));
|
||||
logger.debug("[reserveUsername] Successfully reserved existing username.");
|
||||
dependencies.getAccountManager().confirmUsername(username.getUsername(), response);
|
||||
logger.debug("[confirmUsername] Successfully confirmed existing username.");
|
||||
tryToSetUsernameLink(username);
|
||||
final var usernameLink = account.getUsernameLink();
|
||||
|
||||
if (usernameLink == null) {
|
||||
dependencies.getAccountManager()
|
||||
.reserveUsername(List.of(Base64.encodeUrlSafeWithoutPadding(username.getHash())));
|
||||
logger.debug("[reserveUsername] Successfully reserved existing username.");
|
||||
final var linkComponents = dependencies.getAccountManager().confirmUsernameAndCreateNewLink(username);
|
||||
account.setUsernameLink(linkComponents);
|
||||
logger.debug("[confirmUsername] Successfully confirmed existing username.");
|
||||
} else {
|
||||
final var linkComponents = dependencies.getAccountManager().reclaimUsernameAndLink(username, usernameLink);
|
||||
account.setUsernameLink(linkComponents);
|
||||
logger.debug("[confirmUsername] Successfully reclaimed existing username and link.");
|
||||
}
|
||||
}
|
||||
|
||||
private void tryToSetUsernameLink(Username username) {
|
||||
|
|
|
@ -15,8 +15,7 @@ dependencyResolutionManagement {
|
|||
library("slf4j.jul", "org.slf4j", "jul-to-slf4j").versionRef("slf4j")
|
||||
library("logback", "ch.qos.logback", "logback-classic").version("1.4.14")
|
||||
|
||||
|
||||
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_91")
|
||||
library("signalservice", "com.github.turasa", "signal-service-java").version("2.15.3_unofficial_92")
|
||||
library("sqlite", "org.xerial", "sqlite-jdbc").version("3.44.1.0")
|
||||
library("hikari", "com.zaxxer", "HikariCP").version("5.1.0")
|
||||
library("junit.jupiter", "org.junit.jupiter", "junit-jupiter").version("5.10.1")
|
||||
|
|
|
@ -273,7 +273,7 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
}
|
||||
if (callMessage.answer().isPresent()) {
|
||||
var answerMessage = callMessage.answer().get();
|
||||
writer.println("Answer message: {}, sdp: {})", answerMessage.id(), answerMessage.sdp());
|
||||
writer.println("Answer message: {}, opaque length: {})", answerMessage.id(), answerMessage.opaque().length);
|
||||
}
|
||||
if (callMessage.busy().isPresent()) {
|
||||
var busyMessage = callMessage.busy().get();
|
||||
|
@ -287,12 +287,12 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
writer.println("Ice update messages:");
|
||||
var iceUpdateMessages = callMessage.iceUpdate();
|
||||
for (var iceUpdateMessage : iceUpdateMessages) {
|
||||
writer.println("- {}, sdp: {}", iceUpdateMessage.id(), iceUpdateMessage.sdp());
|
||||
writer.println("- {}, opaque length: {}", iceUpdateMessage.id(), iceUpdateMessage.opaque().length);
|
||||
}
|
||||
}
|
||||
if (callMessage.offer().isPresent()) {
|
||||
var offerMessage = callMessage.offer().get();
|
||||
writer.println("Offer message: {}, sdp: {}", offerMessage.id(), offerMessage.sdp());
|
||||
writer.println("Offer message: {}, opaque length: {}", offerMessage.id(), offerMessage.opaque().length);
|
||||
}
|
||||
if (callMessage.opaque().isPresent()) {
|
||||
final var opaqueMessage = callMessage.opaque().get();
|
||||
|
|
|
@ -23,20 +23,17 @@ record JsonCallMessage(
|
|||
callMessage.iceUpdate().stream().map(IceUpdate::from).toList());
|
||||
}
|
||||
|
||||
record Offer(long id, String sdp, String type, String opaque) {
|
||||
record Offer(long id, String type, String opaque) {
|
||||
|
||||
public static Offer from(final MessageEnvelope.Call.Offer offer) {
|
||||
return new Offer(offer.id(),
|
||||
offer.sdp(),
|
||||
offer.type().name(),
|
||||
Base64.getEncoder().encodeToString(offer.opaque()));
|
||||
return new Offer(offer.id(), offer.type().name(), Base64.getEncoder().encodeToString(offer.opaque()));
|
||||
}
|
||||
}
|
||||
|
||||
public record Answer(long id, String sdp, String opaque) {
|
||||
public record Answer(long id, String opaque) {
|
||||
|
||||
public static Answer from(final MessageEnvelope.Call.Answer answer) {
|
||||
return new Answer(answer.id(), answer.sdp(), Base64.getEncoder().encodeToString(answer.opaque()));
|
||||
return new Answer(answer.id(), Base64.getEncoder().encodeToString(answer.opaque()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,12 +51,10 @@ record JsonCallMessage(
|
|||
}
|
||||
}
|
||||
|
||||
public record IceUpdate(long id, String sdp, String opaque) {
|
||||
public record IceUpdate(long id, String opaque) {
|
||||
|
||||
public static IceUpdate from(final MessageEnvelope.Call.IceUpdate iceUpdate) {
|
||||
return new IceUpdate(iceUpdate.id(),
|
||||
iceUpdate.sdp(),
|
||||
Base64.getEncoder().encodeToString(iceUpdate.opaque()));
|
||||
return new IceUpdate(iceUpdate.id(), Base64.getEncoder().encodeToString(iceUpdate.opaque()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue