X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/36475bb632316d0333f1c44f6639c4f63007bdce..a91e3f762e0e5d6a9cf9e208fe85207d7829e22d:/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 879e6028..6606e966 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java @@ -335,12 +335,20 @@ public class DbusSignalImpl implements Signal { if (avatar.isEmpty()) { avatar = null; } - final var results = m.updateGroup(groupId == null ? null : GroupId.unknownVersion(groupId), - name, - members, - avatar == null ? null : new File(avatar)); - checkSendMessageResults(0, results.second()); - return results.first().serialize(); + if (groupId == null) { + final var results = m.createGroup(name, members, avatar == null ? null : new File(avatar)); + checkSendMessageResults(0, results.second()); + return results.first().serialize(); + } else { + final var results = m.updateGroup(GroupId.unknownVersion(groupId), + name, + null, + members, + null, + avatar == null ? null : new File(avatar)); + checkSendMessageResults(results.first(), results.second()); + return groupId; + } } catch (IOException e) { throw new Error.Failure(e.getMessage()); } catch (GroupNotFoundException | NotAGroupMemberException e) { @@ -372,7 +380,7 @@ public class DbusSignalImpl implements Signal { Optional avatarFile = removeAvatar ? Optional.absent() : avatarPath == null ? null : Optional.of(new File(avatarPath)); - m.setProfile(name, about, aboutEmoji, avatarFile); + m.setProfile(name, null, about, aboutEmoji, avatarFile); } catch (IOException e) { throw new Error.Failure(e.getMessage()); } @@ -414,7 +422,7 @@ public class DbusSignalImpl implements Signal { final var address = m.resolveSignalServiceAddress(recipientId); var number = address.getNumber().orNull(); if (number != null) { - var profile = m.getRecipientProfile(address); + var profile = m.getRecipientProfile(recipientId); if (profile != null && profile.getDisplayName().equals(name)) { numbers.add(number); }