mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Reformat code
This commit is contained in:
parent
a96c4938b1
commit
4f8da7819e
4 changed files with 27 additions and 28 deletions
|
@ -139,7 +139,7 @@ public interface Signal extends DBusInterface {
|
|||
DBusPath getDevice(long deviceId);
|
||||
|
||||
public DBusPath getIdentity(String number);
|
||||
|
||||
|
||||
public List<StructIdentity> listIdentities();
|
||||
|
||||
List<StructDevice> listDevices() throws Error.Failure;
|
||||
|
|
|
@ -38,15 +38,15 @@ public class TrustCommand implements JsonRpcLocalCommand {
|
|||
var recipentString = ns.getString("recipient");
|
||||
var recipient = CommandUtil.getSingleRecipientIdentifier(recipentString, m.getSelfNumber());
|
||||
if (Boolean.TRUE.equals(ns.getBoolean("trust-all-known-keys"))) {
|
||||
boolean res;
|
||||
try {
|
||||
res = m.trustIdentityAllKeys(recipient);
|
||||
final var res = m.trustIdentityAllKeys(recipient);
|
||||
if (!res) {
|
||||
throw new UserErrorException(
|
||||
"Failed to set the trust for this number, make sure the number is correct.");
|
||||
}
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered.");
|
||||
}
|
||||
if (!res) {
|
||||
throw new UserErrorException("Failed to set the trust for this number, make sure the number is correct.");
|
||||
}
|
||||
} else {
|
||||
var safetyNumber = ns.getString("verified-safety-number");
|
||||
if (safetyNumber == null) {
|
||||
|
|
|
@ -669,8 +669,7 @@ public class DbusManagerImpl implements Manager {
|
|||
|
||||
@Override
|
||||
public boolean trustIdentityVerified(
|
||||
final RecipientIdentifier.Single recipient,
|
||||
final IdentityVerificationCode verificationCode
|
||||
final RecipientIdentifier.Single recipient, final IdentityVerificationCode verificationCode
|
||||
) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.asamk.signal.manager.api.GroupLinkState;
|
|||
import org.asamk.signal.manager.api.GroupNotFoundException;
|
||||
import org.asamk.signal.manager.api.GroupPermission;
|
||||
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
||||
import org.asamk.signal.manager.api.IdentityVerificationCode;
|
||||
import org.asamk.signal.manager.api.InactiveGroupLinkException;
|
||||
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||
import org.asamk.signal.manager.api.InvalidNumberException;
|
||||
|
@ -30,7 +31,6 @@ import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
|||
import org.asamk.signal.manager.api.UpdateGroup;
|
||||
import org.asamk.signal.manager.api.UpdateProfile;
|
||||
import org.asamk.signal.manager.api.UserStatus;
|
||||
import org.asamk.signal.manager.api.IdentityVerificationCode;
|
||||
import org.asamk.signal.util.SendMessageResultUtils;
|
||||
import org.freedesktop.dbus.DBusPath;
|
||||
import org.freedesktop.dbus.connections.impl.DBusConnection;
|
||||
|
@ -55,8 +55,8 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.asamk.signal.dbus.DbusUtils.makeValidObjectPathElement;
|
||||
|
||||
|
@ -1044,8 +1044,8 @@ public class DbusSignalImpl implements Signal {
|
|||
final var object = new DbusSignalIdentityImpl(i);
|
||||
exportObject(object);
|
||||
this.identities.add(new StructIdentity(new DBusPath(object.getObjectPath()),
|
||||
emptyIfNull(i.recipient().getIdentifier()),
|
||||
i.recipient().getLegacyIdentifier()));
|
||||
emptyIfNull(i.recipient().getIdentifier()),
|
||||
i.recipient().getLegacyIdentifier()));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1054,17 +1054,18 @@ public class DbusSignalImpl implements Signal {
|
|||
}
|
||||
|
||||
private void unExportIdentities() {
|
||||
this.identities.stream().map(StructIdentity::getObjectPath).map(DBusPath::getPath).forEach(connection::unExportObject);
|
||||
this.identities.stream()
|
||||
.map(StructIdentity::getObjectPath)
|
||||
.map(DBusPath::getPath)
|
||||
.forEach(connection::unExportObject);
|
||||
this.identities.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DBusPath getIdentity(String number) throws Error.Failure {
|
||||
|
||||
final var found = identities.stream()
|
||||
.filter(identity -> identity.getName().equals(number))
|
||||
.findFirst();
|
||||
|
||||
final var found = identities.stream().filter(identity -> identity.getName().equals(number)).findFirst();
|
||||
|
||||
if (found.isEmpty()) {
|
||||
throw new Error.Failure("Identity for " + number + " unkown");
|
||||
}
|
||||
|
@ -1082,16 +1083,16 @@ public class DbusSignalImpl implements Signal {
|
|||
private final org.asamk.signal.manager.api.Identity identity;
|
||||
|
||||
public DbusSignalIdentityImpl(final org.asamk.signal.manager.api.Identity identity) {
|
||||
this.identity=identity;
|
||||
this.identity = identity;
|
||||
super.addPropertiesHandler(new DbusInterfacePropertiesHandler("org.asamk.Signal.Identity",
|
||||
List.of(new DbusProperty<>("Number", () -> identity.recipient().number().orElse("")),
|
||||
new DbusProperty<>("Uuid", () -> identity.recipient().uuid().map(UUID::toString).orElse("")),
|
||||
new DbusProperty<>("Uuid",
|
||||
() -> identity.recipient().uuid().map(UUID::toString).orElse("")),
|
||||
new DbusProperty<>("Fingerprint", () -> identity.getFingerprint()),
|
||||
new DbusProperty<>("SafetyNumber", identity::safetyNumber),
|
||||
new DbusProperty<>("ScannableSafetyNumber", identity::scannableSafetyNumber),
|
||||
new DbusProperty<>("TrustLevel", identity::trustLevel),
|
||||
new DbusProperty<>("AddedDate", identity::dateAddedTimestamp)
|
||||
)));
|
||||
new DbusProperty<>("AddedDate", identity::dateAddedTimestamp))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1100,22 +1101,21 @@ public class DbusSignalImpl implements Signal {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void trust() throws Error.Failure {
|
||||
var recipient=RecipientIdentifier.Single.fromAddress(identity.recipient());
|
||||
public void trust() throws Error.Failure {
|
||||
var recipient = RecipientIdentifier.Single.fromAddress(identity.recipient());
|
||||
try {
|
||||
m.trustIdentityAllKeys(recipient);
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
throw new Error.Failure("The user " + e.getSender().getIdentifier() + " is not registered.");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trustVerified(String safetyNumber) throws Error.Failure {
|
||||
var recipient = RecipientIdentifier.Single.fromAddress(identity.recipient());
|
||||
|
||||
var recipient = RecipientIdentifier.Single.fromAddress(identity.recipient());
|
||||
|
||||
if (safetyNumber == null) {
|
||||
throw new Error.Failure(
|
||||
"You need to specify a fingerprint/safety number");
|
||||
throw new Error.Failure("You need to specify a fingerprint/safety number");
|
||||
}
|
||||
final IdentityVerificationCode verificationCode;
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue