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
&&
34 address
.equals(that
.address
);
38 public int hashCode() {
39 return Objects
.hash(address
, timestamp
);
43 class SendSyncContactsAction
implements HandleAction
{
45 private static final SendSyncContactsAction INSTANCE
= new SendSyncContactsAction();
47 private SendSyncContactsAction() {
50 public static SendSyncContactsAction
create() {
55 public void execute(Manager m
) throws Throwable
{
60 class SendSyncGroupsAction
implements HandleAction
{
62 private static final SendSyncGroupsAction INSTANCE
= new SendSyncGroupsAction();
64 private SendSyncGroupsAction() {
67 public static SendSyncGroupsAction
create() {
72 public void execute(Manager m
) throws Throwable
{
77 class SendSyncBlockedListAction
implements HandleAction
{
79 private static final SendSyncBlockedListAction INSTANCE
= new SendSyncBlockedListAction();
81 private SendSyncBlockedListAction() {
84 public static SendSyncBlockedListAction
create() {
89 public void execute(Manager m
) throws Throwable
{
94 class SendGroupInfoRequestAction
implements HandleAction
{
96 private final SignalServiceAddress address
;
97 private final byte[] groupId
;
99 public SendGroupInfoRequestAction(final SignalServiceAddress address
, final byte[] groupId
) {
100 this.address
= address
;
101 this.groupId
= groupId
;
105 public void execute(Manager m
) throws Throwable
{
106 m
.sendGroupInfoRequest(groupId
, address
);
110 public boolean equals(final Object o
) {
111 if (this == o
) return true;
112 if (o
== null || getClass() != o
.getClass()) return false;
113 final SendGroupInfoRequestAction that
= (SendGroupInfoRequestAction
) o
;
114 return address
.equals(that
.address
) &&
115 Arrays
.equals(groupId
, that
.groupId
);
119 public int hashCode() {
120 int result
= Objects
.hash(address
);
121 result
= 31 * result
+ Arrays
.hashCode(groupId
);
126 class SendGroupUpdateAction
implements HandleAction
{
128 private final SignalServiceAddress address
;
129 private final byte[] groupId
;
131 public SendGroupUpdateAction(final SignalServiceAddress address
, final byte[] groupId
) {
132 this.address
= address
;
133 this.groupId
= groupId
;
137 public void execute(Manager m
) throws Throwable
{
138 m
.sendUpdateGroupMessage(groupId
, address
);
142 public boolean equals(final Object o
) {
143 if (this == o
) return true;
144 if (o
== null || getClass() != o
.getClass()) return false;
145 final SendGroupUpdateAction that
= (SendGroupUpdateAction
) o
;
146 return address
.equals(that
.address
) &&
147 Arrays
.equals(groupId
, that
.groupId
);
151 public int hashCode() {
152 int result
= Objects
.hash(address
);
153 result
= 31 * result
+ Arrays
.hashCode(groupId
);