]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/manager/storage/contacts/ContactInfo.java
4dd132f74af7d67af2db70b307ca256df9837977
[signal-cli] / src / main / java / org / asamk / signal / manager / storage / contacts / ContactInfo.java
1 package org.asamk.signal.manager.storage.contacts;
2
3 import com.fasterxml.jackson.annotation.JsonIgnore;
4 import com.fasterxml.jackson.annotation.JsonProperty;
5
6 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
7
8 import java.util.UUID;
9
10 import static com.fasterxml.jackson.annotation.JsonProperty.Access.WRITE_ONLY;
11
12 public class ContactInfo {
13
14 @JsonProperty
15 public String name;
16
17 @JsonProperty
18 public String number;
19
20 @JsonProperty
21 public UUID uuid;
22
23 @JsonProperty
24 public String color;
25
26 @JsonProperty(defaultValue = "0")
27 public int messageExpirationTime;
28
29 @JsonProperty(access = WRITE_ONLY)
30 public String profileKey;
31
32 @JsonProperty(defaultValue = "false")
33 public boolean blocked;
34
35 @JsonProperty
36 public Integer inboxPosition;
37
38 @JsonProperty(defaultValue = "false")
39 public boolean archived;
40
41 public ContactInfo() {
42 }
43
44 public ContactInfo(SignalServiceAddress address) {
45 this.number = address.getNumber().orNull();
46 this.uuid = address.getUuid().orNull();
47 }
48
49 @JsonIgnore
50 public SignalServiceAddress getAddress() {
51 return new SignalServiceAddress(uuid, number);
52 }
53 }