mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Show pending and requesting members of v2 groups
This commit is contained in:
parent
6bfcba4940
commit
d267974223
4 changed files with 46 additions and 5 deletions
|
@ -22,8 +22,21 @@ public class ListGroupsCommand implements LocalCommand {
|
|||
.map(m::resolveSignalServiceAddress)
|
||||
.map(SignalServiceAddress::getLegacyIdentifier)
|
||||
.collect(Collectors.toSet());
|
||||
System.out.println(String.format("Id: %s Name: %s Active: %s Blocked: %b Members: %s",
|
||||
Base64.encodeBytes(group.groupId), group.getTitle(), group.isMember(m.getSelfAddress()), group.isBlocked(), members));
|
||||
|
||||
Set<String> pendingMembers = group.getPendingMembers()
|
||||
.stream()
|
||||
.map(m::resolveSignalServiceAddress)
|
||||
.map(SignalServiceAddress::getLegacyIdentifier)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<String> requestingMembers = group.getRequestingMembers()
|
||||
.stream()
|
||||
.map(m::resolveSignalServiceAddress)
|
||||
.map(SignalServiceAddress::getLegacyIdentifier)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
System.out.println(String.format("Id: %s Name: %s Active: %s Blocked: %b Members: %s Pending members: %s Requesting members: %s",
|
||||
Base64.encodeBytes(group.groupId), group.getTitle(), group.isMember(m.getSelfAddress()), group.isBlocked(), members, pendingMembers, requestingMembers));
|
||||
} else {
|
||||
System.out.println(String.format("Id: %s Name: %s Active: %s Blocked: %b",
|
||||
Base64.encodeBytes(group.groupId), group.getTitle(), group.isMember(m.getSelfAddress()), group.isBlocked()));
|
||||
|
|
|
@ -250,9 +250,6 @@ public class Manager implements Closeable {
|
|||
Manager m = new Manager(account, pathConfig, serviceConfiguration, userAgent);
|
||||
|
||||
m.migrateLegacyConfigs();
|
||||
if (m.isRegistered()) {
|
||||
m.updateAccountAttributes();
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -290,6 +287,7 @@ public class Manager implements Closeable {
|
|||
account.setUuid(accountManager.getOwnUuid());
|
||||
account.save();
|
||||
}
|
||||
updateAccountAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,16 @@ public abstract class GroupInfo {
|
|||
@JsonIgnore
|
||||
public abstract Set<SignalServiceAddress> getMembers();
|
||||
|
||||
@JsonIgnore
|
||||
public Set<SignalServiceAddress> getPendingMembers() {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Set<SignalServiceAddress> getRequestingMembers() {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public abstract boolean isBlocked();
|
||||
|
||||
|
|
|
@ -51,6 +51,26 @@ public class GroupInfoV2 extends GroupInfo {
|
|||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<SignalServiceAddress> getPendingMembers() {
|
||||
if (this.group == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return group.getPendingMembersList().stream()
|
||||
.map(m -> new SignalServiceAddress(UuidUtil.parseOrThrow(m.getUuid().toByteArray()), null))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<SignalServiceAddress> getRequestingMembers() {
|
||||
if (this.group == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return group.getRequestingMembersList().stream()
|
||||
.map(m -> new SignalServiceAddress(UuidUtil.parseOrThrow(m.getUuid().toByteArray()), null))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlocked() {
|
||||
return blocked;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue