]> 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 8338e4e67a05e6b9e2a8cfa312422a1473415bcf..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;
@@ -29,7 +30,7 @@ class SendReceiptAction implements HandleAction {
     public boolean equals(final Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
-        final SendReceiptAction that = (SendReceiptAction) o;
+        final var that = (SendReceiptAction) o;
         return timestamp == that.timestamp && address.equals(that.address);
     }
 
@@ -110,7 +111,7 @@ class SendGroupInfoRequestAction implements HandleAction {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
 
-        final SendGroupInfoRequestAction that = (SendGroupInfoRequestAction) o;
+        final var that = (SendGroupInfoRequestAction) o;
 
         if (!address.equals(that.address)) return false;
         return groupId.equals(that.groupId);
@@ -118,7 +119,7 @@ class SendGroupInfoRequestAction implements HandleAction {
 
     @Override
     public int hashCode() {
-        int result = address.hashCode();
+        var result = address.hashCode();
         result = 31 * result + groupId.hashCode();
         return result;
     }
@@ -144,7 +145,7 @@ class SendGroupInfoAction implements HandleAction {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
 
-        final SendGroupInfoAction that = (SendGroupInfoAction) o;
+        final var that = (SendGroupInfoAction) o;
 
         if (!address.equals(that.address)) return false;
         return groupId.equals(that.groupId);
@@ -152,8 +153,66 @@ class SendGroupInfoAction implements HandleAction {
 
     @Override
     public int hashCode() {
-        int result = address.hashCode();
+        var result = address.hashCode();
         result = 31 * result + groupId.hashCode();
         return result;
     }
 }
+
+class RetrieveProfileAction implements HandleAction {
+
+    private final RecipientId recipientId;
+
+    public RetrieveProfileAction(final RecipientId recipientId) {
+        this.recipientId = recipientId;
+    }
+
+    @Override
+    public void execute(Manager m) throws Throwable {
+        m.getRecipientProfile(recipientId, true);
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final RetrieveProfileAction that = (RetrieveProfileAction) o;
+
+        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 recipientId.hashCode();
+    }
+}