X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/382d8d22d0ccad109106b140616638799cc646f6..861f47d734a2c416ca3231ad72f9f129da5a706f:/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java diff --git a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java index 7f0c3b31..5d7eb491 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java @@ -2,7 +2,6 @@ package org.asamk.signal.dbus; import org.asamk.Signal; import org.asamk.signal.BaseConfig; -import org.asamk.signal.DbusReceiveMessageHandler; import org.asamk.signal.manager.AttachmentInvalidException; import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.NotMasterDeviceException; @@ -112,7 +111,7 @@ public class DbusSignalImpl implements Signal { @Override public void subscribeReceive() { if (dbusMessageHandler == null) { - dbusMessageHandler = new DbusReceiveMessageHandler(m, connection, objectPath); + dbusMessageHandler = new DbusReceiveMessageHandler(connection, objectPath); m.addReceiveHandler(dbusMessageHandler); } subscriberCount++; @@ -200,7 +199,7 @@ public class DbusSignalImpl implements Signal { @Override public long sendMessage(final String message, final List attachments, final List recipients) { try { - final var results = m.sendMessage(new Message(message, attachments, List.of()), + final var results = m.sendMessage(new Message(message, attachments, List.of(), Optional.empty()), getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream() .map(RecipientIdentifier.class::cast) .collect(Collectors.toSet())); @@ -365,7 +364,7 @@ public class DbusSignalImpl implements Signal { final String message, final List attachments ) throws Error.AttachmentInvalid, Error.Failure, Error.UntrustedIdentity { try { - final var results = m.sendMessage(new Message(message, attachments, List.of()), + final var results = m.sendMessage(new Message(message, attachments, List.of(), Optional.empty()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE)); checkSendMessageResults(results.timestamp(), results.results()); return results.timestamp(); @@ -388,10 +387,28 @@ public class DbusSignalImpl implements Signal { } } + @Override + public void deleteRecipient(final String recipient) throws Error.Failure { + try { + m.deleteRecipient(getSingleRecipientIdentifier(recipient, m.getSelfNumber())); + } catch (IOException e) { + throw new Error.Failure("Recipient not found"); + } + } + + @Override + public void deleteContact(final String recipient) throws Error.Failure { + try { + m.deleteContact(getSingleRecipientIdentifier(recipient, m.getSelfNumber())); + } catch (IOException e) { + throw new Error.Failure("Contact not found"); + } + } + @Override public long sendGroupMessage(final String message, final List attachments, final byte[] groupId) { try { - var results = m.sendMessage(new Message(message, attachments, List.of()), + var results = m.sendMessage(new Message(message, attachments, List.of(), Optional.empty()), Set.of(new RecipientIdentifier.Group(getGroupId(groupId)))); checkSendMessageResults(results.timestamp(), results.results()); return results.timestamp();