mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
parent
a257a2f7b5
commit
39c4cf24b8
1 changed files with 37 additions and 14 deletions
|
@ -121,6 +121,7 @@ import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage
|
||||||
import org.whispersystems.signalservice.api.profiles.ProfileAndCredential;
|
import org.whispersystems.signalservice.api.profiles.ProfileAndCredential;
|
||||||
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
|
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;
|
||||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||||
|
import org.whispersystems.signalservice.api.push.exceptions.ConflictException;
|
||||||
import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException;
|
import org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException;
|
||||||
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
|
||||||
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
|
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
|
||||||
|
@ -900,6 +901,7 @@ public class Manager implements Closeable {
|
||||||
var group = getGroupForUpdating(groupId);
|
var group = getGroupForUpdating(groupId);
|
||||||
|
|
||||||
if (group instanceof GroupInfoV2) {
|
if (group instanceof GroupInfoV2) {
|
||||||
|
try {
|
||||||
return updateGroupV2((GroupInfoV2) group,
|
return updateGroupV2((GroupInfoV2) group,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
|
@ -913,6 +915,23 @@ public class Manager implements Closeable {
|
||||||
editDetailsPermission,
|
editDetailsPermission,
|
||||||
avatarFile,
|
avatarFile,
|
||||||
expirationTimer);
|
expirationTimer);
|
||||||
|
} catch (ConflictException e) {
|
||||||
|
// Detected conflicting update, refreshing group and trying again
|
||||||
|
group = getGroup(groupId, true);
|
||||||
|
return updateGroupV2((GroupInfoV2) group,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
members,
|
||||||
|
removeMembers,
|
||||||
|
admins,
|
||||||
|
removeAdmins,
|
||||||
|
resetGroupLink,
|
||||||
|
groupLinkState,
|
||||||
|
addMemberPermission,
|
||||||
|
editDetailsPermission,
|
||||||
|
avatarFile,
|
||||||
|
expirationTimer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final var gv1 = (GroupInfoV1) group;
|
final var gv1 = (GroupInfoV1) group;
|
||||||
|
@ -2703,8 +2722,12 @@ public class Manager implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupInfo getGroup(GroupId groupId) {
|
public GroupInfo getGroup(GroupId groupId) {
|
||||||
|
return getGroup(groupId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupInfo getGroup(GroupId groupId, boolean forceUpdate) {
|
||||||
final var group = account.getGroupStore().getGroup(groupId);
|
final var group = account.getGroupStore().getGroup(groupId);
|
||||||
if (group instanceof GroupInfoV2 && ((GroupInfoV2) group).getGroup() == null) {
|
if (group instanceof GroupInfoV2 && (forceUpdate || ((GroupInfoV2) group).getGroup() == null)) {
|
||||||
final var groupSecretParams = GroupSecretParams.deriveFromMasterKey(((GroupInfoV2) group).getMasterKey());
|
final var groupSecretParams = GroupSecretParams.deriveFromMasterKey(((GroupInfoV2) group).getMasterKey());
|
||||||
((GroupInfoV2) group).setGroup(groupV2Helper.getDecryptedGroup(groupSecretParams), this::resolveRecipient);
|
((GroupInfoV2) group).setGroup(groupV2Helper.getDecryptedGroup(groupSecretParams), this::resolveRecipient);
|
||||||
account.getGroupStore().updateGroup(group);
|
account.getGroupStore().updateGroup(group);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue