X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/ce7aa580b6f0580cdcf7fd68fcc8efba737d21ed..2ab42ca5471e8fc1e1a31cde954e19564178f114:/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java diff --git a/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java b/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java index 9ae58122..4656975e 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java @@ -10,7 +10,10 @@ import org.asamk.signal.manager.UntrustedIdentityException; import org.asamk.signal.manager.api.Device; import org.asamk.signal.manager.api.Group; import org.asamk.signal.manager.api.Identity; +import org.asamk.signal.manager.api.InactiveGroupLinkException; +import org.asamk.signal.manager.api.InvalidDeviceLinkException; import org.asamk.signal.manager.api.Message; +import org.asamk.signal.manager.api.Pair; import org.asamk.signal.manager.api.RecipientIdentifier; import org.asamk.signal.manager.api.SendGroupMessageResults; import org.asamk.signal.manager.api.SendMessageResults; @@ -30,15 +33,6 @@ import org.freedesktop.dbus.DBusPath; import org.freedesktop.dbus.connections.impl.DBusConnection; import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.interfaces.DBusInterface; -import org.whispersystems.libsignal.InvalidKeyException; -import org.whispersystems.libsignal.util.Pair; -import org.whispersystems.libsignal.util.guava.Optional; -import org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException; -import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId; -import org.whispersystems.signalservice.api.push.SignalServiceAddress; -import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException; -import org.whispersystems.signalservice.api.util.UuidUtil; -import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException; import java.io.File; import java.io.IOException; @@ -48,6 +42,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -87,7 +82,7 @@ public class DbusManagerImpl implements Manager { final var result = new HashMap>(); for (var i = 0; i < numbersList.size(); i++) { result.put(numbersList.get(i), - new Pair<>(numbersList.get(i), registered.get(i) ? UuidUtil.UNKNOWN_UUID : null)); + new Pair<>(numbersList.get(i), registered.get(i) ? RecipientAddress.UNKNOWN_UUID : null)); } return result; } @@ -122,7 +117,7 @@ public class DbusManagerImpl implements Manager { emptyIfNull(familyName), emptyIfNull(about), emptyIfNull(aboutEmoji), - avatar == null ? "" : avatar.transform(File::getPath).or(""), + avatar == null ? "" : avatar.map(File::getPath).orElse(""), avatar != null && !avatar.isPresent()); } @@ -162,12 +157,12 @@ public class DbusManagerImpl implements Manager { } @Override - public void addDeviceLink(final URI linkUri) throws IOException, InvalidKeyException { + public void addDeviceLink(final URI linkUri) throws IOException, InvalidDeviceLinkException { signal.addDevice(linkUri.toString()); } @Override - public void setRegistrationLockPin(final Optional pin) throws IOException, UnauthenticatedResponseException { + public void setRegistrationLockPin(final Optional pin) throws IOException { if (pin.isPresent()) { signal.setPin(pin.get()); } else { @@ -176,7 +171,7 @@ public class DbusManagerImpl implements Manager { } @Override - public Profile getRecipientProfile(final RecipientIdentifier.Single recipient) throws UnregisteredUserException { + public Profile getRecipientProfile(final RecipientIdentifier.Single recipient) { throw new UnsupportedOperationException(); } @@ -283,7 +278,7 @@ public class DbusManagerImpl implements Manager { } @Override - public Pair joinGroup(final GroupInviteLinkUrl inviteLinkUrl) throws IOException, GroupLinkNotActiveException { + public Pair joinGroup(final GroupInviteLinkUrl inviteLinkUrl) throws IOException, InactiveGroupLinkException { final var newGroupId = signal.joinGroup(inviteLinkUrl.getUrl()); return new Pair<>(GroupId.unknownVersion(newGroupId), new SendGroupMessageResults(0, List.of())); } @@ -373,7 +368,7 @@ public class DbusManagerImpl implements Manager { @Override public void setContactName( final RecipientIdentifier.Single recipient, final String name - ) throws NotMasterDeviceException, UnregisteredUserException { + ) throws NotMasterDeviceException { signal.setContactName(recipient.getIdentifier(), name); } @@ -460,7 +455,7 @@ public class DbusManagerImpl implements Manager { } @Override - public File getAttachmentFile(final SignalServiceAttachmentRemoteId attachmentId) { + public File getAttachmentFile(final String attachmentId) { throw new UnsupportedOperationException(); } @@ -552,11 +547,6 @@ public class DbusManagerImpl implements Manager { throw new UnsupportedOperationException(); } - @Override - public SignalServiceAddress resolveSignalServiceAddress(final SignalServiceAddress address) { - return address; - } - @Override public void close() throws IOException { } @@ -583,7 +573,7 @@ public class DbusManagerImpl implements Manager { final var groupRecipients = recipients.stream() .filter(r -> r instanceof RecipientIdentifier.Group) .map(RecipientIdentifier.Group.class::cast) - .map(g -> g.groupId) + .map(RecipientIdentifier.Group::groupId) .collect(Collectors.toList()); for (final var groupId : groupRecipients) { timestamp = groupHandler.apply(groupId.serialize());