]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
Implement remove group members
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusSignalImpl.java
index 9eda62504e89f2e12dfbd8493b4d0846e4000a85..6606e966a14ac78fc8476cdfde29f0d421cf07ba 100644 (file)
@@ -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<File> 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());
         }