]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Add sendPaymentNotification dbus method
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index 18b53eeabf81703088c6d0810d67d96accc747df..a65c183b030b792a04546c020755c2ade46185c1 100644 (file)
@@ -216,7 +216,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()));
@@ -297,6 +298,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 +383,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 +425,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) {
@@ -489,7 +507,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) {