Split createGroup out of updateGroup method

This commit is contained in:
AsamK 2021-05-14 21:21:09 +02:00
parent dd0effc10c
commit 4ebacd0e1f
3 changed files with 133 additions and 108 deletions

View file

@ -335,13 +335,19 @@ public class DbusSignalImpl implements Signal {
if (avatar.isEmpty()) {
avatar = null;
}
final var results = m.updateGroup(groupId == null ? null : GroupId.unknownVersion(groupId),
name,
null,
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,
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) {