X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/3c3d3e92dd68c381d3e03b6447a73614e6a86ff4..debcabd01442c028eb645f94f0510a8d235a416b:/src/main/java/org/asamk/signal/Main.java diff --git a/src/main/java/org/asamk/signal/Main.java b/src/main/java/org/asamk/signal/Main.java index c8963659..8a85f3d3 100644 --- a/src/main/java/org/asamk/signal/Main.java +++ b/src/main/java/org/asamk/signal/Main.java @@ -460,11 +460,7 @@ public class Main { break; case "updateGroup": - if (dBusConn != null) { - System.err.println("updateGroup is not yet implemented via dbus"); - return 1; - } - if (!m.isRegistered()) { + if (dBusConn == null && !m.isRegistered()) { System.err.println("User is not registered."); return 1; } @@ -474,8 +470,23 @@ public class Main { if (ns.getString("group") != null) { groupId = decodeGroupId(ns.getString("group")); } - byte[] newGroupId = m.sendUpdateGroupMessage(groupId, ns.getString("name"), ns.getList("member"), ns.getString("avatar")); if (groupId == null) { + groupId = new byte[0]; + } + String groupName = ns.getString("name"); + if (groupName == null) { + groupName = ""; + } + List groupMembers = ns.getList("member"); + if (groupMembers == null) { + groupMembers = new ArrayList(); + } + String groupAvatar = ns.getString("avatar"); + if (groupAvatar == null) { + groupAvatar = ""; + } + byte[] newGroupId = ts.updateGroup(groupId, groupName, groupMembers, groupAvatar); + if (groupId.length != newGroupId.length) { System.out.println("Creating new group \"" + Base64.encodeBytes(newGroupId) + "\" …"); } } catch (IOException e) {