mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
23fcd8a230
commit
4377a2179b
3 changed files with 80 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
package org.asamk.signal;
|
||||
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage;
|
||||
|
||||
public enum TrustLevel {
|
||||
UNTRUSTED,
|
||||
TRUSTED_UNVERIFIED,
|
||||
|
@ -13,4 +15,28 @@ public enum TrustLevel {
|
|||
}
|
||||
return TrustLevel.cachedValues[i];
|
||||
}
|
||||
|
||||
public static TrustLevel fromVerifiedState(VerifiedMessage.VerifiedState verifiedState) {
|
||||
switch (verifiedState) {
|
||||
case DEFAULT:
|
||||
return TRUSTED_UNVERIFIED;
|
||||
case UNVERIFIED:
|
||||
return UNTRUSTED;
|
||||
case VERIFIED:
|
||||
return TRUSTED_VERIFIED;
|
||||
}
|
||||
throw new RuntimeException("Unknown verified state: " + verifiedState);
|
||||
}
|
||||
|
||||
public VerifiedMessage.VerifiedState toVerifiedState() {
|
||||
switch (this) {
|
||||
case TRUSTED_UNVERIFIED:
|
||||
return VerifiedMessage.VerifiedState.DEFAULT;
|
||||
case UNTRUSTED:
|
||||
return VerifiedMessage.VerifiedState.UNVERIFIED;
|
||||
case TRUSTED_VERIFIED:
|
||||
return VerifiedMessage.VerifiedState.VERIFIED;
|
||||
}
|
||||
throw new RuntimeException("Unknown verified state: " + this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue