]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/HandleAction.java
Implement sticker pack retrieval
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / HandleAction.java
index ba426fa1c994274a615f6a60800c354e150372f8..08f51590308666ea4bbb8af2600c0c81fda59937 100644 (file)
@@ -1,6 +1,7 @@
 package org.asamk.signal.manager;
 
 import org.asamk.signal.manager.groups.GroupIdV1;
+import org.asamk.signal.manager.storage.recipients.RecipientId;
 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
 
 import java.util.Objects;
@@ -160,15 +161,15 @@ class SendGroupInfoAction implements HandleAction {
 
 class RetrieveProfileAction implements HandleAction {
 
-    private final SignalServiceAddress address;
+    private final RecipientId recipientId;
 
-    public RetrieveProfileAction(final SignalServiceAddress address) {
-        this.address = address;
+    public RetrieveProfileAction(final RecipientId recipientId) {
+        this.recipientId = recipientId;
     }
 
     @Override
     public void execute(Manager m) throws Throwable {
-        m.getRecipientProfile(address, true);
+        m.getRecipientProfile(recipientId, true);
     }
 
     @Override
@@ -178,11 +179,40 @@ class RetrieveProfileAction implements HandleAction {
 
         final RetrieveProfileAction that = (RetrieveProfileAction) o;
 
-        return address.equals(that.address);
+        return recipientId.equals(that.recipientId);
+    }
+
+    @Override
+    public int hashCode() {
+        return recipientId.hashCode();
+    }
+}
+
+class RenewSessionAction implements HandleAction {
+
+    private final RecipientId recipientId;
+
+    public RenewSessionAction(final RecipientId recipientId) {
+        this.recipientId = recipientId;
+    }
+
+    @Override
+    public void execute(Manager m) throws Throwable {
+        m.renewSession(recipientId);
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final RenewSessionAction that = (RenewSessionAction) o;
+
+        return recipientId.equals(that.recipientId);
     }
 
     @Override
     public int hashCode() {
-        return address.hashCode();
+        return recipientId.hashCode();
     }
 }