1 package org
.asamk
.signal
.manager
.actions
;
3 import org
.asamk
.signal
.manager
.helper
.Context
;
4 import org
.asamk
.signal
.manager
.storage
.recipients
.RecipientId
;
6 import java
.util
.ArrayList
;
8 import java
.util
.Objects
;
10 public class SendReceiptAction
implements HandleAction
{
12 private final RecipientId recipientId
;
13 private final List
<Long
> timestamps
= new ArrayList
<>();
15 public SendReceiptAction(final RecipientId recipientId
, final long timestamp
) {
16 this.recipientId
= recipientId
;
17 this.timestamps
.add(timestamp
);
21 public void execute(Context context
) throws Throwable
{
22 context
.getSendHelper().sendDeliveryReceipt(recipientId
, timestamps
);
26 public void mergeOther(final HandleAction action
) {
27 if (action
instanceof SendReceiptAction sendReceiptAction
) {
28 this.timestamps
.addAll(sendReceiptAction
.timestamps
);
33 public boolean equals(final Object o
) {
34 if (this == o
) return true;
35 if (o
== null || getClass() != o
.getClass()) return false;
36 final SendReceiptAction that
= (SendReceiptAction
) o
;
37 // Using only recipientId here on purpose
38 return recipientId
.equals(that
.recipientId
);
42 public int hashCode() {
43 // Using only recipientId here on purpose
44 return Objects
.hash(recipientId
);