]> nmode's Git Repositories - signal-cli/commitdiff
Add getGroupIds() to DBUS
authornico <nico@geyso.net>
Thu, 21 Sep 2017 23:17:40 +0000 (01:17 +0200)
committerAsamK <asamk@gmx.de>
Fri, 4 May 2018 20:33:29 +0000 (22:33 +0200)
getGroupIds() returns a list of group ids (byte arrays)

src/main/java/org/asamk/Signal.java
src/main/java/org/asamk/signal/Manager.java

index ab926d3fcbe02d7d33dba7c1da65f74a502b0575..88b15926b485956933a598ddb23478fda9b19769 100644 (file)
@@ -23,6 +23,8 @@ public interface Signal extends DBusInterface {
 
     void setContactName(String number, String name);
 
+    List<byte[]> getGroupIds();
+
     String getGroupName(byte[] groupId);
 
     List<String> getGroupMembers(byte[] groupId);
index 46c2e64ca7b572057d5be3f0c208202ef3e36af7..51acaf1d56cffd7c29a5eaa84490a92bd9782bc7 100644 (file)
@@ -818,6 +818,16 @@ class Manager implements Signal {
         save();
     }
 
+    @Override
+    public List<byte[]> getGroupIds() {
+        List<GroupInfo> groups = getGroups();
+        List<byte[]> ids = new ArrayList<byte[]>(groups.size());
+        for (GroupInfo group : groups) {
+          ids.add(group.groupId);
+        }
+        return ids;
+    }
+
     @Override
     public String getGroupName(byte[] groupId) {
         GroupInfo group = getGroup(groupId);