X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/5ed9db4f08e52ed0c42cb42740f85d2ad346e13c..91700ce995ae381dd97b246ea3ff11afb748e421:/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 1a9118be..f91f8001 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java @@ -219,7 +219,8 @@ public class DbusSignalImpl implements Signal { Optional.empty(), Optional.empty(), List.of(), - Optional.empty()), + Optional.empty(), + List.of()), getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream() .map(RecipientIdentifier.class::cast) .collect(Collectors.toSet())); @@ -388,7 +389,8 @@ public class DbusSignalImpl implements Signal { Optional.empty(), Optional.empty(), List.of(), - Optional.empty()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE)); + Optional.empty(), + List.of()), Set.of(RecipientIdentifier.NoteToSelf.INSTANCE)); checkSendMessageResults(results); return results.timestamp(); } catch (AttachmentInvalidException e) { @@ -431,7 +433,8 @@ public class DbusSignalImpl implements Signal { Optional.empty(), Optional.empty(), List.of(), - Optional.empty()), Set.of(getGroupRecipientIdentifier(groupId))); + Optional.empty(), + List.of()), Set.of(getGroupRecipientIdentifier(groupId))); checkSendMessageResults(results); return results.timestamp(); } catch (IOException | InvalidStickerException e) { @@ -618,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(); @@ -627,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()); @@ -687,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) @@ -1193,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) { @@ -1270,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) {