- final Pair<GroupId, List<SendMessageResult>> results = m.joinGroup(linkUrl);
- GroupId newGroupId = results.first();
- if (!m.getGroup(newGroupId).isMember(m.getSelfAddress())) {
- System.out.println("Requested to join group \"" + newGroupId.toBase64() + "\"");
+ final var results = m.joinGroup(linkUrl);
+ var newGroupId = results.first();
+ if (outputWriter instanceof JsonWriter writer) {
+ if (!m.getGroup(newGroupId).isMember()) {
+ writer.write(Map.of("groupId", newGroupId.toBase64(), "onlyRequested", true));
+ } else {
+ writer.write(Map.of("groupId", newGroupId.toBase64()));
+ }