anotherim-desktop/libdino/src/entity/encryption.vala

37 lines
957 B
Vala
Raw Normal View History

namespace Dino.Entities {
2022-02-14 13:55:59 +00:00
public enum Encryption {
NONE,
PGP,
2021-04-08 10:07:04 +00:00
OMEMO,
DTLS_SRTP,
SRTP,
2022-02-14 13:55:59 +00:00
UNKNOWN;
public bool is_some() {
return this != NONE;
}
2023-04-01 00:43:41 +00:00
public static Encryption parse(string str) {
switch (str) {
case "DINO_ENTITIES_ENCRYPTION_NONE":
return NONE;
case "DINO_ENTITIES_ENCRYPTION_PGP":
return PGP;
case "DINO_ENTITIES_ENCRYPTION_OMEMO":
return OMEMO;
case "DINO_ENTITIES_ENCRYPTION_DTLS_SRTP":
return DTLS_SRTP;
case "DINO_ENTITIES_ENCRYPTION_SRTP":
return SRTP;
case "DINO_ENTITIES_ENCRYPTION_UNKNOWN":
// Fall through.
default:
break;
}
return UNKNOWN;
}
2022-02-14 13:55:59 +00:00
}
}