X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/9ad24614cb800c0e3f853dc985d8d4180bbdd04d..fea19c9e20ed07228420dae93399911a659e51b1:/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 18b53eea..c19daadf 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java @@ -10,6 +10,8 @@ import org.asamk.signal.manager.api.InvalidNumberException; import org.asamk.signal.manager.api.InvalidStickerException; import org.asamk.signal.manager.api.Message; import org.asamk.signal.manager.api.NotPrimaryDeviceException; +import org.asamk.signal.manager.api.PendingAdminApprovalException; +import org.asamk.signal.manager.api.RecipientAddress; import org.asamk.signal.manager.api.RecipientIdentifier; import org.asamk.signal.manager.api.SendMessageResult; import org.asamk.signal.manager.api.SendMessageResults; @@ -27,7 +29,6 @@ import org.asamk.signal.manager.groups.GroupPermission; import org.asamk.signal.manager.groups.GroupSendingNotAllowedException; import org.asamk.signal.manager.groups.LastGroupAdminException; import org.asamk.signal.manager.groups.NotAGroupMemberException; -import org.asamk.signal.manager.storage.recipients.RecipientAddress; import org.asamk.signal.util.SendMessageResultUtils; import org.freedesktop.dbus.DBusPath; import org.freedesktop.dbus.connections.impl.DBusConnection; @@ -216,7 +217,8 @@ public class DbusSignalImpl implements Signal { attachments, List.of(), Optional.empty(), - Optional.empty()), + Optional.empty(), + List.of()), getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream() .map(RecipientIdentifier.class::cast) .collect(Collectors.toSet())); @@ -285,7 +287,8 @@ public class DbusSignalImpl implements Signal { targetSentTimestamp, getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream() .map(RecipientIdentifier.class::cast) - .collect(Collectors.toSet())); + .collect(Collectors.toSet()), + false); checkSendMessageResults(results); return results.timestamp(); } catch (IOException e) { @@ -297,6 +300,21 @@ public class DbusSignalImpl implements Signal { } } + @Override + public long sendPaymentNotification( + final byte[] receipt, final String note, final String recipient + ) throws Error.Failure { + try { + final var results = m.sendPaymentNotificationMessage(receipt, + note, + getSingleRecipientIdentifier(recipient, m.getSelfNumber())); + checkSendMessageResults(results); + return results.timestamp(); + } catch (IOException e) { + throw new Error.Failure(e.getMessage()); + } + } + @Override public void sendTyping( final String recipient, final boolean stop @@ -367,7 +385,8 @@ public class DbusSignalImpl implements Signal { attachments, List.of(), Optional.empty(), - Optional.empty()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE)); + Optional.empty(), + List.of()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE)); checkSendMessageResults(results); return results.timestamp(); } catch (AttachmentInvalidException e) { @@ -408,7 +427,8 @@ public class DbusSignalImpl implements Signal { attachments, List.of(), Optional.empty(), - Optional.empty()), Set.of(getGroupRecipientIdentifier(groupId))); + Optional.empty(), + List.of()), Set.of(getGroupRecipientIdentifier(groupId))); checkSendMessageResults(results); return results.timestamp(); } catch (IOException | InvalidStickerException e) { @@ -466,7 +486,8 @@ public class DbusSignalImpl implements Signal { remove, getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()), targetSentTimestamp, - Set.of(getGroupRecipientIdentifier(groupId))); + Set.of(getGroupRecipientIdentifier(groupId)), + false); checkSendMessageResults(results); return results.timestamp(); } catch (IOException e) { @@ -489,7 +510,7 @@ public class DbusSignalImpl implements Signal { @Override public void setContactName(final String number, final String name) { try { - m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name); + m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name, ""); } catch (NotPrimaryDeviceException e) { throw new Error.Failure("This command doesn't work on linked devices."); } catch (IOException e) { @@ -760,6 +781,8 @@ public class DbusSignalImpl implements Signal { } final var result = m.joinGroup(linkUrl); return result.first().serialize(); + } catch (PendingAdminApprovalException e) { + throw new Error.Failure("Pending admin approval: " + e.getMessage()); } catch (GroupInviteLinkUrl.InvalidGroupLinkException | InactiveGroupLinkException e) { throw new Error.Failure("Group link is invalid: " + e.getMessage()); } catch (GroupInviteLinkUrl.UnknownGroupLinkVersionException e) {