mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Fix inspections
This commit is contained in:
parent
f60a10eb6e
commit
7e897fa6d0
13 changed files with 20 additions and 34 deletions
|
@ -5,10 +5,6 @@ import org.whispersystems.signalservice.internal.util.Base64;
|
||||||
|
|
||||||
public class GroupNotFoundException extends DBusExecutionException {
|
public class GroupNotFoundException extends DBusExecutionException {
|
||||||
|
|
||||||
public GroupNotFoundException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GroupNotFoundException(byte[] groupId) {
|
public GroupNotFoundException(byte[] groupId) {
|
||||||
super("Group not found: " + Base64.encodeBytes(groupId));
|
super("Group not found: " + Base64.encodeBytes(groupId));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,6 @@ import org.whispersystems.signalservice.internal.util.Base64;
|
||||||
|
|
||||||
public class NotAGroupMemberException extends DBusExecutionException {
|
public class NotAGroupMemberException extends DBusExecutionException {
|
||||||
|
|
||||||
public NotAGroupMemberException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotAGroupMemberException(byte[] groupId, String groupName) {
|
public NotAGroupMemberException(byte[] groupId, String groupName) {
|
||||||
super("User is not a member in group: " + groupName + " (" + Base64.encodeBytes(groupId) + ")");
|
super("User is not a member in group: " + groupName + " (" + Base64.encodeBytes(groupId) + ")");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.asamk.signal;
|
||||||
|
|
||||||
public class UserAlreadyExists extends Exception {
|
public class UserAlreadyExists extends Exception {
|
||||||
|
|
||||||
private String username;
|
private final String username;
|
||||||
private String fileName;
|
private final String fileName;
|
||||||
|
|
||||||
public UserAlreadyExists(String username, String fileName) {
|
public UserAlreadyExists(String username, String fileName) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
|
|
|
@ -73,16 +73,14 @@ public class Manager implements Signal {
|
||||||
private final String dataPath;
|
private final String dataPath;
|
||||||
private final String attachmentsPath;
|
private final String attachmentsPath;
|
||||||
private final String avatarsPath;
|
private final String avatarsPath;
|
||||||
|
private final SleepTimer timer = new UptimeSleepTimer();
|
||||||
|
|
||||||
private SignalAccount account;
|
private SignalAccount account;
|
||||||
|
|
||||||
private String username;
|
private String username;
|
||||||
private SignalServiceAccountManager accountManager;
|
private SignalServiceAccountManager accountManager;
|
||||||
private SignalServiceMessagePipe messagePipe = null;
|
private SignalServiceMessagePipe messagePipe = null;
|
||||||
private SignalServiceMessagePipe unidentifiedMessagePipe = null;
|
private SignalServiceMessagePipe unidentifiedMessagePipe = null;
|
||||||
|
|
||||||
private SleepTimer timer = new UptimeSleepTimer();
|
|
||||||
|
|
||||||
public Manager(String username, String settingsPath) {
|
public Manager(String username, String settingsPath) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.settingsPath = settingsPath;
|
this.settingsPath = settingsPath;
|
||||||
|
|
|
@ -223,8 +223,8 @@ class Utils {
|
||||||
|
|
||||||
static class DeviceLinkInfo {
|
static class DeviceLinkInfo {
|
||||||
|
|
||||||
String deviceIdentifier;
|
final String deviceIdentifier;
|
||||||
ECPublicKey deviceKey;
|
final ECPublicKey deviceKey;
|
||||||
|
|
||||||
DeviceLinkInfo(final String deviceIdentifier, final ECPublicKey deviceKey) {
|
DeviceLinkInfo(final String deviceIdentifier, final ECPublicKey deviceKey) {
|
||||||
this.deviceIdentifier = deviceIdentifier;
|
this.deviceIdentifier = deviceIdentifier;
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class JsonContactsStore {
|
||||||
contacts.clear();
|
contacts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
|
private static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
|
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
|
||||||
|
@ -48,7 +48,7 @@ public class JsonContactsStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ContactsDeserializer extends JsonDeserializer<Map<String, ContactInfo>> {
|
private static class ContactsDeserializer extends JsonDeserializer<Map<String, ContactInfo>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ContactInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
public Map<String, ContactInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class JsonGroupStore {
|
||||||
return new ArrayList<>(groups.values());
|
return new ArrayList<>(groups.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
|
private static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
|
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
|
||||||
|
@ -45,7 +45,7 @@ public class JsonGroupStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GroupsDeserializer extends JsonDeserializer<Map<String, GroupInfo>> {
|
private static class GroupsDeserializer extends JsonDeserializer<Map<String, GroupInfo>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, GroupInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
public Map<String, GroupInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
import org.asamk.signal.TrustLevel;
|
import org.asamk.signal.TrustLevel;
|
||||||
import org.whispersystems.libsignal.IdentityKey;
|
import org.whispersystems.libsignal.IdentityKey;
|
||||||
|
@ -189,13 +188,13 @@ public class JsonIdentityKeyStore implements IdentityKeyStore {
|
||||||
this.added = new Date();
|
this.added = new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Identity(IdentityKey identityKey, TrustLevel trustLevel, Date added) {
|
Identity(IdentityKey identityKey, TrustLevel trustLevel, Date added) {
|
||||||
this.identityKey = identityKey;
|
this.identityKey = identityKey;
|
||||||
this.trustLevel = trustLevel;
|
this.trustLevel = trustLevel;
|
||||||
this.added = added;
|
this.added = added;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTrusted() {
|
boolean isTrusted() {
|
||||||
return trustLevel == TrustLevel.TRUSTED_UNVERIFIED ||
|
return trustLevel == TrustLevel.TRUSTED_UNVERIFIED ||
|
||||||
trustLevel == TrustLevel.TRUSTED_VERIFIED;
|
trustLevel == TrustLevel.TRUSTED_VERIFIED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||||
import org.whispersystems.libsignal.state.PreKeyRecord;
|
import org.whispersystems.libsignal.state.PreKeyRecord;
|
||||||
|
@ -21,7 +20,7 @@ class JsonPreKeyStore implements PreKeyStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPreKeys(Map<Integer, byte[]> preKeys) {
|
private void addPreKeys(Map<Integer, byte[]> preKeys) {
|
||||||
store.putAll(preKeys);
|
store.putAll(preKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
import org.whispersystems.libsignal.SignalProtocolAddress;
|
import org.whispersystems.libsignal.SignalProtocolAddress;
|
||||||
import org.whispersystems.libsignal.state.SessionRecord;
|
import org.whispersystems.libsignal.state.SessionRecord;
|
||||||
|
@ -20,7 +19,7 @@ class JsonSessionStore implements SessionStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSessions(Map<SignalProtocolAddress, byte[]> sessions) {
|
private void addSessions(Map<SignalProtocolAddress, byte[]> sessions) {
|
||||||
this.sessions.putAll(sessions);
|
this.sessions.putAll(sessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,22 +21,22 @@ public class JsonSignalProtocolStore implements SignalProtocolStore {
|
||||||
@JsonProperty("preKeys")
|
@JsonProperty("preKeys")
|
||||||
@JsonDeserialize(using = JsonPreKeyStore.JsonPreKeyStoreDeserializer.class)
|
@JsonDeserialize(using = JsonPreKeyStore.JsonPreKeyStoreDeserializer.class)
|
||||||
@JsonSerialize(using = JsonPreKeyStore.JsonPreKeyStoreSerializer.class)
|
@JsonSerialize(using = JsonPreKeyStore.JsonPreKeyStoreSerializer.class)
|
||||||
protected JsonPreKeyStore preKeyStore;
|
private JsonPreKeyStore preKeyStore;
|
||||||
|
|
||||||
@JsonProperty("sessionStore")
|
@JsonProperty("sessionStore")
|
||||||
@JsonDeserialize(using = JsonSessionStore.JsonSessionStoreDeserializer.class)
|
@JsonDeserialize(using = JsonSessionStore.JsonSessionStoreDeserializer.class)
|
||||||
@JsonSerialize(using = JsonSessionStore.JsonPreKeyStoreSerializer.class)
|
@JsonSerialize(using = JsonSessionStore.JsonPreKeyStoreSerializer.class)
|
||||||
protected JsonSessionStore sessionStore;
|
private JsonSessionStore sessionStore;
|
||||||
|
|
||||||
@JsonProperty("signedPreKeyStore")
|
@JsonProperty("signedPreKeyStore")
|
||||||
@JsonDeserialize(using = JsonSignedPreKeyStore.JsonSignedPreKeyStoreDeserializer.class)
|
@JsonDeserialize(using = JsonSignedPreKeyStore.JsonSignedPreKeyStoreDeserializer.class)
|
||||||
@JsonSerialize(using = JsonSignedPreKeyStore.JsonSignedPreKeyStoreSerializer.class)
|
@JsonSerialize(using = JsonSignedPreKeyStore.JsonSignedPreKeyStoreSerializer.class)
|
||||||
protected JsonSignedPreKeyStore signedPreKeyStore;
|
private JsonSignedPreKeyStore signedPreKeyStore;
|
||||||
|
|
||||||
@JsonProperty("identityKeyStore")
|
@JsonProperty("identityKeyStore")
|
||||||
@JsonDeserialize(using = JsonIdentityKeyStore.JsonIdentityKeyStoreDeserializer.class)
|
@JsonDeserialize(using = JsonIdentityKeyStore.JsonIdentityKeyStoreDeserializer.class)
|
||||||
@JsonSerialize(using = JsonIdentityKeyStore.JsonIdentityKeyStoreSerializer.class)
|
@JsonSerialize(using = JsonIdentityKeyStore.JsonIdentityKeyStoreSerializer.class)
|
||||||
protected JsonIdentityKeyStore identityKeyStore;
|
private JsonIdentityKeyStore identityKeyStore;
|
||||||
|
|
||||||
public JsonSignalProtocolStore() {
|
public JsonSignalProtocolStore() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
import org.whispersystems.libsignal.InvalidKeyIdException;
|
import org.whispersystems.libsignal.InvalidKeyIdException;
|
||||||
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
|
||||||
|
@ -23,7 +22,7 @@ class JsonSignedPreKeyStore implements SignedPreKeyStore {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSignedPreKeys(Map<Integer, byte[]> preKeys) {
|
private void addSignedPreKeys(Map<Integer, byte[]> preKeys) {
|
||||||
store.putAll(preKeys);
|
store.putAll(preKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class JsonThreadStore {
|
||||||
return new ArrayList<>(threads.values());
|
return new ArrayList<>(threads.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
|
private static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
|
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
|
||||||
|
@ -42,7 +42,7 @@ public class JsonThreadStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ThreadsDeserializer extends JsonDeserializer<Map<String, ThreadInfo>> {
|
private static class ThreadsDeserializer extends JsonDeserializer<Map<String, ThreadInfo>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ThreadInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
public Map<String, ThreadInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue