mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add support for contact color sync and receiving blocklists and expiring messages
This commit is contained in:
parent
6597d48ecc
commit
e4618456a1
3 changed files with 28 additions and 5 deletions
|
@ -8,4 +8,7 @@ public class ContactInfo {
|
|||
|
||||
@JsonProperty
|
||||
public String number;
|
||||
|
||||
@JsonProperty
|
||||
public String color;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,7 @@ import org.freedesktop.dbus.exceptions.DBusExecutionException;
|
|||
import org.whispersystems.libsignal.InvalidKeyException;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.signalservice.api.messages.*;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.ReadMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.*;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NetworkFailureException;
|
||||
|
@ -837,9 +834,20 @@ public class Main {
|
|||
to = "Unknown";
|
||||
}
|
||||
System.out.println("To: " + to + " , Message timestamp: " + sentTranscriptMessage.getTimestamp());
|
||||
if (sentTranscriptMessage.getExpirationStartTimestamp() > 0) {
|
||||
System.out.println("Expiration started at: " + sentTranscriptMessage.getExpirationStartTimestamp());
|
||||
}
|
||||
SignalServiceDataMessage message = sentTranscriptMessage.getMessage();
|
||||
handleSignalServiceDataMessage(message);
|
||||
}
|
||||
if (syncMessage.getBlockedList().isPresent()) {
|
||||
System.out.println("Received sync message with block list");
|
||||
System.out.println("Blocked numbers:");
|
||||
final BlockedListMessage blockedList = syncMessage.getBlockedList().get();
|
||||
for (String number : blockedList.getNumbers()) {
|
||||
System.out.println(" - " + number);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -882,6 +890,12 @@ public class Main {
|
|||
if (message.isEndSession()) {
|
||||
System.out.println("Is end session");
|
||||
}
|
||||
if (message.isExpirationUpdate()) {
|
||||
System.out.println("Is Expiration update: " + message.isExpirationUpdate());
|
||||
}
|
||||
if (message.getExpiresInSeconds() > 0) {
|
||||
System.out.println("Expires in: " + message.getExpiresInSeconds() + " seconds");
|
||||
}
|
||||
|
||||
if (message.getAttachments().isPresent()) {
|
||||
System.out.println("Attachments: ");
|
||||
|
|
|
@ -1017,6 +1017,9 @@ class Manager implements Signal {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (syncMessage.getBlockedList().isPresent()) {
|
||||
// TODO store list of blocked numbers
|
||||
}
|
||||
}
|
||||
if (syncMessage.getContacts().isPresent()) {
|
||||
try {
|
||||
|
@ -1028,6 +1031,9 @@ class Manager implements Signal {
|
|||
if (c.getName().isPresent()) {
|
||||
contact.name = c.getName().get();
|
||||
}
|
||||
if (c.getColor().isPresent()) {
|
||||
contact.color = c.getColor().get();
|
||||
}
|
||||
contactStore.updateContact(contact);
|
||||
|
||||
if (c.getAvatar().isPresent()) {
|
||||
|
@ -1264,7 +1270,7 @@ class Manager implements Signal {
|
|||
try {
|
||||
for (ContactInfo record : contactStore.getContacts()) {
|
||||
out.write(new DeviceContact(record.number, Optional.fromNullable(record.name),
|
||||
createContactAvatarAttachment(record.number)));
|
||||
createContactAvatarAttachment(record.number), Optional.fromNullable(record.color)));
|
||||
}
|
||||
} finally {
|
||||
out.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue