]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Implement textStyles for sending and receiving
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index 92e9215704b2f303674ce8ecc21f2a7a61d38207..f91f8001746b1493a36305579894ffaa8126c1ff 100644 (file)
@@ -218,6 +218,8 @@ public class DbusSignalImpl implements Signal {
                             List.of(),
                             Optional.empty(),
                             Optional.empty(),
+                            List.of(),
+                            Optional.empty(),
                             List.of()),
                     getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream()
                             .map(RecipientIdentifier.class::cast)
@@ -287,7 +289,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) {
@@ -385,6 +388,8 @@ public class DbusSignalImpl implements Signal {
                     List.of(),
                     Optional.empty(),
                     Optional.empty(),
+                    List.of(),
+                    Optional.empty(),
                     List.of()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE));
             checkSendMessageResults(results);
             return results.timestamp();
@@ -427,6 +432,8 @@ public class DbusSignalImpl implements Signal {
                     List.of(),
                     Optional.empty(),
                     Optional.empty(),
+                    List.of(),
+                    Optional.empty(),
                     List.of()), Set.of(getGroupRecipientIdentifier(groupId)));
             checkSendMessageResults(results);
             return results.timestamp();
@@ -485,7 +492,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) {
@@ -613,7 +621,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();
@@ -622,7 +630,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());
@@ -682,7 +690,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)
@@ -1188,8 +1196,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) {
@@ -1265,7 +1275,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) {