X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/f5ba7894ae06909baeebfe9c23ccb9ab6b00a147..d783df510a58b1dbed973cbc193a57b7ad700f68:/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 93d36888..95b62678 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java @@ -11,6 +11,7 @@ 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.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; @@ -31,8 +32,6 @@ 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; @@ -48,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; @@ -122,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()); } @@ -274,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()); @@ -327,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 @@ -423,9 +417,29 @@ 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 ReceiveMessageHandler handler + final long timeout, final TimeUnit unit, final ReceiveMessageHandler handler ) throws IOException { throw new UnsupportedOperationException(); }