]> nmode's Git Repositories - signal-cli/commitdiff
Update signal-service-java to 2.8.0
authorAsamK <asamk@gmx.de>
Sun, 12 Aug 2018 19:34:55 +0000 (21:34 +0200)
committerAsamK <asamk@gmx.de>
Sun, 12 Aug 2018 19:35:17 +0000 (21:35 +0200)
build.gradle
src/main/java/org/asamk/signal/Manager.java
src/main/java/org/asamk/signal/storage/groups/GroupInfo.java

index 3354d30ee6c6756001140be79900bac1d767e13b..d2fddabe0d82ba05343dfc0bf7da8af08a2d4274 100644 (file)
@@ -20,7 +20,7 @@ repositories {
 }
 
 dependencies {
-    compile 'com.github.turasa:signal-service-java:2.7.5_unofficial_1'
+    compile 'com.github.turasa:signal-service-java:2.8.0_unofficial_1'
     compile 'org.bouncycastle:bcprov-jdk15on:1.59'
     compile 'net.sourceforge.argparse4j:argparse4j:0.8.1'
     compile 'org.freedesktop.dbus:dbus-java:2.7.0'
index 505ee12deaae74c6aa4cbe4a1dae263aadf6654f..8a606eddfe6f9782328b7c744ad4e9b47a3340a9 100644 (file)
@@ -61,6 +61,8 @@ import org.whispersystems.signalservice.api.push.TrustStore;
 import org.whispersystems.signalservice.api.push.exceptions.*;
 import org.whispersystems.signalservice.api.util.InvalidNumberException;
 import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
+import org.whispersystems.signalservice.api.util.SleepTimer;
+import org.whispersystems.signalservice.api.util.UptimeSleepTimer;
 import org.whispersystems.signalservice.internal.configuration.SignalCdnUrl;
 import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
 import org.whispersystems.signalservice.internal.configuration.SignalServiceUrl;
@@ -130,6 +132,8 @@ class Manager implements Signal {
     private JsonThreadStore threadStore;
     private SignalServiceMessagePipe messagePipe = null;
 
+    private SleepTimer timer = new UptimeSleepTimer();
+
     public Manager(String username, String settingsPath) {
         this.username = username;
         this.settingsPath = settingsPath;
@@ -238,7 +242,7 @@ class Manager implements Signal {
 
         migrateLegacyConfigs();
 
-        accountManager = new SignalServiceAccountManager(serviceConfiguration, username, password, deviceId, USER_AGENT);
+        accountManager = new SignalServiceAccountManager(serviceConfiguration, username, password, deviceId, USER_AGENT, timer);
         try {
             if (registered && accountManager.getPreKeysCount() < PREKEY_MINIMUM_COUNT) {
                 refreshPreKeys();
@@ -366,7 +370,7 @@ class Manager implements Signal {
     public void register(boolean voiceVerification) throws IOException {
         password = Util.getSecret(18);
 
-        accountManager = new SignalServiceAccountManager(serviceConfiguration, username, password, USER_AGENT);
+        accountManager = new SignalServiceAccountManager(serviceConfiguration, username, password, USER_AGENT, timer);
 
         if (voiceVerification)
             accountManager.requestVoiceVerificationCode();
@@ -391,7 +395,7 @@ class Manager implements Signal {
     public URI getDeviceLinkUri() throws TimeoutException, IOException {
         password = Util.getSecret(18);
 
-        accountManager = new SignalServiceAccountManager(serviceConfiguration, username, password, USER_AGENT);
+        accountManager = new SignalServiceAccountManager(serviceConfiguration, username, password, USER_AGENT, timer);
         String uuid = accountManager.getNewDeviceUuid();
 
         registered = false;
@@ -1135,7 +1139,7 @@ class Manager implements Signal {
 
     public void receiveMessages(long timeout, TimeUnit unit, boolean returnOnTimeout, boolean ignoreAttachments, ReceiveMessageHandler handler) throws IOException {
         retryFailedReceivedMessages(handler, ignoreAttachments);
-        final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration, username, password, deviceId, signalingKey, USER_AGENT, null);
+        final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration, username, password, deviceId, signalingKey, USER_AGENT, null, timer);
 
         try {
             if (messagePipe == null) {
@@ -1244,6 +1248,9 @@ class Manager implements Signal {
                                 }
                                 syncGroup.members.addAll(g.getMembers());
                                 syncGroup.active = g.isActive();
+                                if (g.getColor().isPresent()) {
+                                    syncGroup.color = g.getColor().get();
+                                }
 
                                 if (g.getAvatar().isPresent()) {
                                     retrieveGroupAvatarAttachment(g.getAvatar().get(), syncGroup.groupId);
@@ -1437,7 +1444,7 @@ class Manager implements Signal {
             }
         }
 
-        final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration, username, password, deviceId, signalingKey, USER_AGENT, null);
+        final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration, username, password, deviceId, signalingKey, USER_AGENT, null, timer);
 
         File tmpFile = Util.createTempFile();
         try (InputStream input = messageReceiver.retrieveAttachment(pointer, tmpFile, MAX_ATTACHMENT_SIZE)) {
@@ -1463,7 +1470,7 @@ class Manager implements Signal {
     }
 
     private InputStream retrieveAttachmentAsStream(SignalServiceAttachmentPointer pointer, File tmpFile) throws IOException, InvalidMessageException {
-        final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration, username, password, deviceId, signalingKey, USER_AGENT, null);
+        final SignalServiceMessageReceiver messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration, username, password, deviceId, signalingKey, USER_AGENT, null, timer);
         return messageReceiver.retrieveAttachment(pointer, tmpFile, MAX_ATTACHMENT_SIZE);
     }
 
@@ -1492,7 +1499,8 @@ class Manager implements Signal {
                     ThreadInfo info = threadStore.getThread(Base64.encodeBytes(record.groupId));
                     out.write(new DeviceGroup(record.groupId, Optional.fromNullable(record.name),
                             new ArrayList<>(record.members), createGroupAvatarAttachment(record.groupId),
-                            record.active, Optional.fromNullable(info != null ? info.messageExpirationTime : null)));
+                            record.active, Optional.fromNullable(info != null ? info.messageExpirationTime : null),
+                            Optional.fromNullable(record.color)));
                 }
             }
 
index e28a5921fe6ca80b7ee2bfe12934a2e41d57f41e..96147fe3e76b529ca08bd0006c0c6ae40f81066c 100644 (file)
@@ -27,14 +27,18 @@ public class GroupInfo {
     @JsonProperty
     public boolean active;
 
+    @JsonProperty
+    public String color;
+
     public GroupInfo(byte[] groupId) {
         this.groupId = groupId;
     }
 
-    public GroupInfo(@JsonProperty("groupId") byte[] groupId, @JsonProperty("name") String name, @JsonProperty("members") Collection<String> members, @JsonProperty("avatarId") long avatarId) {
+    public GroupInfo(@JsonProperty("groupId") byte[] groupId, @JsonProperty("name") String name, @JsonProperty("members") Collection<String> members, @JsonProperty("avatarId") long avatarId, @JsonProperty("color") String color) {
         this.groupId = groupId;
         this.name = name;
         this.members.addAll(members);
         this.avatarId = avatarId;
+        this.color = color;
     }
 }