mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
842f13b2fc
commit
da4cc7dc6b
5 changed files with 31 additions and 21 deletions
|
@ -41,7 +41,7 @@ import java.nio.channels.OverlappingFileLockException;
|
|||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.capabilities;
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.getCapabilities;
|
||||
|
||||
class ProvisioningManagerImpl implements ProvisioningManager {
|
||||
|
||||
|
@ -132,7 +132,7 @@ class ProvisioningManagerImpl implements ProvisioningManager {
|
|||
registrationId,
|
||||
pniRegistrationId,
|
||||
encryptedDeviceName,
|
||||
capabilities));
|
||||
getCapabilities(false)));
|
||||
|
||||
// Create new account with the synced identity
|
||||
var profileKey = ret.getProfileKey() == null ? KeyUtils.createProfileKey() : ret.getProfileKey();
|
||||
|
|
|
@ -28,21 +28,7 @@ public class ServiceConfig {
|
|||
|
||||
private final static KeyStore iasKeyStore;
|
||||
|
||||
public static final AccountAttributes.Capabilities capabilities;
|
||||
|
||||
static {
|
||||
capabilities = new AccountAttributes.Capabilities(false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
|
||||
try {
|
||||
TrustStore contactTrustStore = new IasTrustStore();
|
||||
|
||||
|
@ -56,6 +42,21 @@ public class ServiceConfig {
|
|||
}
|
||||
}
|
||||
|
||||
public static AccountAttributes.Capabilities getCapabilities(boolean isPrimaryDevice) {
|
||||
final var giftBadges = !isPrimaryDevice;
|
||||
return new AccountAttributes.Capabilities(false,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
giftBadges,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
public static boolean isSignalClientAvailable() {
|
||||
try {
|
||||
try {
|
||||
|
|
|
@ -18,8 +18,6 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.capabilities;
|
||||
|
||||
public class IdentityHelper {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(IdentityHelper.class);
|
||||
|
@ -75,7 +73,7 @@ public class IdentityHelper {
|
|||
final var recipientId = account.getRecipientResolver().resolveRecipient(serviceId);
|
||||
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
|
||||
|
||||
if (capabilities.getUuid()) {
|
||||
if (account.getAccountCapabilities().getUuid()) {
|
||||
if (serviceId.isUnknown()) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -817,6 +817,9 @@ public final class IncomingMessageHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (message.getGiftBadge().isPresent()) {
|
||||
handleIncomingGiftBadge(message.getGiftBadge().get());
|
||||
}
|
||||
if (message.getProfileKey().isPresent()) {
|
||||
handleIncomingProfileKey(message.getProfileKey().get(), source.recipientId());
|
||||
}
|
||||
|
@ -833,6 +836,10 @@ public final class IncomingMessageHandler {
|
|||
return actions;
|
||||
}
|
||||
|
||||
private void handleIncomingGiftBadge(final SignalServiceDataMessage.GiftBadge giftBadge) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private List<HandleAction> handleSignalServiceStoryMessage(
|
||||
SignalServiceStoryMessage message, RecipientId source, boolean ignoreAttachments
|
||||
) {
|
||||
|
|
|
@ -98,7 +98,7 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.capabilities;
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.getCapabilities;
|
||||
|
||||
public class SignalAccount implements Closeable {
|
||||
|
||||
|
@ -1328,13 +1328,17 @@ public class SignalAccount implements Closeable {
|
|||
registrationLock != null ? registrationLock : getRegistrationLock(),
|
||||
getSelfUnidentifiedAccessKey(),
|
||||
isUnrestrictedUnidentifiedAccess(),
|
||||
capabilities,
|
||||
getAccountCapabilities(),
|
||||
isDiscoverableByPhoneNumber(),
|
||||
encryptedDeviceName,
|
||||
getLocalPniRegistrationId(),
|
||||
null); // TODO recoveryPassword?
|
||||
}
|
||||
|
||||
public AccountAttributes.Capabilities getAccountCapabilities() {
|
||||
return getCapabilities(isPrimaryDevice());
|
||||
}
|
||||
|
||||
public ServiceId getAccountId(ServiceIdType serviceIdType) {
|
||||
return serviceIdType.equals(ServiceIdType.ACI) ? aci : pni;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue