]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Add capabilities and read receipt handling to provisioning
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index c19daadffd670198006e303ce304cbebb2a7ba7b..dafcababe772fbfef6883294bac1d9c3f663c455 100644 (file)
@@ -218,7 +218,8 @@ public class DbusSignalImpl implements Signal {
                             List.of(),
                             Optional.empty(),
                             Optional.empty(),
-                            List.of()),
+                            List.of(),
+                            Optional.empty()),
                     getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream()
                             .map(RecipientIdentifier.class::cast)
                             .collect(Collectors.toSet()));
@@ -386,7 +387,8 @@ public class DbusSignalImpl implements Signal {
                     List.of(),
                     Optional.empty(),
                     Optional.empty(),
-                    List.of()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE));
+                    List.of(),
+                    Optional.empty()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE));
             checkSendMessageResults(results);
             return results.timestamp();
         } catch (AttachmentInvalidException e) {
@@ -428,7 +430,8 @@ public class DbusSignalImpl implements Signal {
                     List.of(),
                     Optional.empty(),
                     Optional.empty(),
-                    List.of()), Set.of(getGroupRecipientIdentifier(groupId)));
+                    List.of(),
+                    Optional.empty()), Set.of(getGroupRecipientIdentifier(groupId)));
             checkSendMessageResults(results);
             return results.timestamp();
         } catch (IOException | InvalidStickerException e) {
@@ -615,7 +618,7 @@ public class DbusSignalImpl implements Signal {
             avatar = nullIfEmpty(avatar);
             final var memberIdentifiers = getSingleRecipientIdentifiers(members, m.getSelfNumber());
             if (groupId == null) {
-                final var results = m.createGroup(name, memberIdentifiers, avatar == null ? null : new File(avatar));
+                final var results = m.createGroup(name, memberIdentifiers, avatar);
                 updateGroups();
                 checkGroupSendMessageResults(results.second().timestamp(), results.second().results());
                 return results.first().serialize();
@@ -624,7 +627,7 @@ public class DbusSignalImpl implements Signal {
                         UpdateGroup.newBuilder()
                                 .withName(name)
                                 .withMembers(memberIdentifiers)
-                                .withAvatarFile(avatar == null ? null : new File(avatar))
+                                .withAvatarFile(avatar)
                                 .build());
                 if (results != null) {
                     checkGroupSendMessageResults(results.timestamp(), results.results());
@@ -684,7 +687,7 @@ public class DbusSignalImpl implements Signal {
             about = nullIfEmpty(about);
             aboutEmoji = nullIfEmpty(aboutEmoji);
             avatarPath = nullIfEmpty(avatarPath);
-            File avatarFile = removeAvatar || avatarPath == null ? null : new File(avatarPath);
+            final var avatarFile = removeAvatar || avatarPath == null ? null : avatarPath;
             m.updateProfile(UpdateProfile.newBuilder()
                     .withGivenName(givenName)
                     .withFamilyName(familyName)
@@ -1190,8 +1193,10 @@ public class DbusSignalImpl implements Signal {
         public void quitGroup() throws Error.Failure {
             try {
                 m.quitGroup(groupId, Set.of());
-            } catch (GroupNotFoundException | NotAGroupMemberException e) {
+            } catch (GroupNotFoundException e) {
                 throw new Error.GroupNotFound(e.getMessage());
+            } catch (NotAGroupMemberException e) {
+                throw new Error.NotAGroupMember(e.getMessage());
             } catch (IOException e) {
                 throw new Error.Failure(e.getMessage());
             } catch (LastGroupAdminException e) {
@@ -1267,7 +1272,7 @@ public class DbusSignalImpl implements Signal {
         }
 
         private void setGroupAvatar(final String avatar) {
-            updateGroup(UpdateGroup.newBuilder().withAvatarFile(new File(avatar)).build());
+            updateGroup(UpdateGroup.newBuilder().withAvatarFile(avatar).build());
         }
 
         private void setMessageExpirationTime(final int expirationTime) {