X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/997b4f0c3fe371efe08e92ed4678835bc62538bf..1e87240db8a7d476d66e296701202413d94061c9:/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 6e655bdc..1028392c 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java @@ -30,10 +30,8 @@ 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.IdentityKey; 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; @@ -49,6 +47,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; @@ -123,7 +122,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()); } @@ -275,15 +274,9 @@ public class DbusManagerImpl implements Manager { } if (updateGroup.getGroupLinkState() != null) { switch (updateGroup.getGroupLinkState()) { - case DISABLED: - group.disableLink(); - break; - case ENABLED: - group.enableLink(false); - break; - case ENABLED_WITH_APPROVAL: - group.enableLink(true); - break; + case DISABLED -> group.disableLink(); + case ENABLED -> group.enableLink(false); + case ENABLED_WITH_APPROVAL -> group.enableLink(true); } } return new SendGroupMessageResults(0, List.of()); @@ -328,9 +321,9 @@ public class DbusManagerImpl implements Manager { final Message message, final Set recipients ) throws IOException, AttachmentInvalidException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException { return handleMessage(recipients, - numbers -> signal.sendMessage(message.getMessageText(), message.getAttachments(), numbers), - () -> signal.sendNoteToSelfMessage(message.getMessageText(), message.getAttachments()), - groupId -> signal.sendGroupMessage(message.getMessageText(), message.getAttachments(), groupId)); + numbers -> signal.sendMessage(message.messageText(), message.attachments(), numbers), + () -> signal.sendNoteToSelfMessage(message.messageText(), message.attachments()), + groupId -> signal.sendGroupMessage(message.messageText(), message.attachments(), groupId)); } @Override @@ -424,17 +417,38 @@ public class DbusManagerImpl implements Manager { signal.sendSyncRequest(); } + @Override + public void addReceiveHandler(final ReceiveMessageHandler handler) { + throw new UnsupportedOperationException(); + } + + @Override + public void removeReceiveHandler(final ReceiveMessageHandler handler) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isReceiving() { + throw new UnsupportedOperationException(); + } + + @Override + public void receiveMessages(final ReceiveMessageHandler handler) throws IOException { + throw new UnsupportedOperationException(); + } + @Override public void receiveMessages( - final long timeout, - final TimeUnit unit, - final boolean returnOnTimeout, - final boolean ignoreAttachments, - final ReceiveMessageHandler handler + final long timeout, final TimeUnit unit, final ReceiveMessageHandler handler ) throws IOException { throw new UnsupportedOperationException(); } + @Override + public void setIgnoreAttachments(final boolean ignoreAttachments) { + throw new UnsupportedOperationException(); + } + @Override public boolean hasCaughtUpWithOldMessages() { throw new UnsupportedOperationException(); @@ -538,13 +552,6 @@ public class DbusManagerImpl implements Manager { throw new UnsupportedOperationException(); } - @Override - public String computeSafetyNumber( - final SignalServiceAddress theirAddress, final IdentityKey theirIdentityKey - ) { - throw new UnsupportedOperationException(); - } - @Override public SignalServiceAddress resolveSignalServiceAddress(final SignalServiceAddress address) { return address;