1 package org
.asamk
.signal
.manager
;
3 import org
.whispersystems
.signalservice
.api
.push
.SignalServiceAddress
;
5 import java
.util
.Arrays
;
6 import java
.util
.Objects
;
8 interface HandleAction
{
10 void execute(Manager m
) throws Throwable
;
13 class SendReceiptAction
implements HandleAction
{
15 private final SignalServiceAddress address
;
16 private final long timestamp
;
18 public SendReceiptAction(final SignalServiceAddress address
, final long timestamp
) {
19 this.address
= address
;
20 this.timestamp
= timestamp
;
24 public void execute(Manager m
) throws Throwable
{
25 m
.sendReceipt(address
, timestamp
);
29 public boolean equals(final Object o
) {
30 if (this == o
) return true;
31 if (o
== null || getClass() != o
.getClass()) return false;
32 final SendReceiptAction that
= (SendReceiptAction
) o
;
33 return timestamp
== that
.timestamp
&& address
.equals(that
.address
);
37 public int hashCode() {
38 return Objects
.hash(address
, timestamp
);
42 class SendSyncContactsAction
implements HandleAction
{
44 private static final SendSyncContactsAction INSTANCE
= new SendSyncContactsAction();
46 private SendSyncContactsAction() {
49 public static SendSyncContactsAction
create() {
54 public void execute(Manager m
) throws Throwable
{
59 class SendSyncGroupsAction
implements HandleAction
{
61 private static final SendSyncGroupsAction INSTANCE
= new SendSyncGroupsAction();
63 private SendSyncGroupsAction() {
66 public static SendSyncGroupsAction
create() {
71 public void execute(Manager m
) throws Throwable
{
76 class SendSyncBlockedListAction
implements HandleAction
{
78 private static final SendSyncBlockedListAction INSTANCE
= new SendSyncBlockedListAction();
80 private SendSyncBlockedListAction() {
83 public static SendSyncBlockedListAction
create() {
88 public void execute(Manager m
) throws Throwable
{
93 class SendGroupInfoRequestAction
implements HandleAction
{
95 private final SignalServiceAddress address
;
96 private final byte[] groupId
;
98 public SendGroupInfoRequestAction(final SignalServiceAddress address
, final byte[] groupId
) {
99 this.address
= address
;
100 this.groupId
= groupId
;
104 public void execute(Manager m
) throws Throwable
{
105 m
.sendGroupInfoRequest(groupId
, address
);
109 public boolean equals(final Object o
) {
110 if (this == o
) return true;
111 if (o
== null || getClass() != o
.getClass()) return false;
112 final SendGroupInfoRequestAction that
= (SendGroupInfoRequestAction
) o
;
113 return address
.equals(that
.address
) && Arrays
.equals(groupId
, that
.groupId
);
117 public int hashCode() {
118 int result
= Objects
.hash(address
);
119 result
= 31 * result
+ Arrays
.hashCode(groupId
);
124 class SendGroupUpdateAction
implements HandleAction
{
126 private final SignalServiceAddress address
;
127 private final byte[] groupId
;
129 public SendGroupUpdateAction(final SignalServiceAddress address
, final byte[] groupId
) {
130 this.address
= address
;
131 this.groupId
= groupId
;
135 public void execute(Manager m
) throws Throwable
{
136 m
.sendUpdateGroupMessage(groupId
, address
);
140 public boolean equals(final Object o
) {
141 if (this == o
) return true;
142 if (o
== null || getClass() != o
.getClass()) return false;
143 final SendGroupUpdateAction that
= (SendGroupUpdateAction
) o
;
144 return address
.equals(that
.address
) && Arrays
.equals(groupId
, that
.groupId
);
148 public int hashCode() {
149 int result
= Objects
.hash(address
);
150 result
= 31 * result
+ Arrays
.hashCode(groupId
);