1 package org
.asamk
.signal
.manager
;
3 import org
.asamk
.signal
.manager
.groups
.GroupIdV1
;
4 import org
.whispersystems
.signalservice
.api
.push
.SignalServiceAddress
;
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 GroupIdV1 groupId
;
98 public SendGroupInfoRequestAction(final SignalServiceAddress address
, final GroupIdV1 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;
113 final SendGroupInfoRequestAction that
= (SendGroupInfoRequestAction
) o
;
115 if (!address
.equals(that
.address
)) return false;
116 return groupId
.equals(that
.groupId
);
120 public int hashCode() {
121 int result
= address
.hashCode();
122 result
= 31 * result
+ groupId
.hashCode();
127 class SendGroupInfoAction
implements HandleAction
{
129 private final SignalServiceAddress address
;
130 private final GroupIdV1 groupId
;
132 public SendGroupInfoAction(final SignalServiceAddress address
, final GroupIdV1 groupId
) {
133 this.address
= address
;
134 this.groupId
= groupId
;
138 public void execute(Manager m
) throws Throwable
{
139 m
.sendGroupInfoMessage(groupId
, address
);
143 public boolean equals(final Object o
) {
144 if (this == o
) return true;
145 if (o
== null || getClass() != o
.getClass()) return false;
147 final SendGroupInfoAction that
= (SendGroupInfoAction
) o
;
149 if (!address
.equals(that
.address
)) return false;
150 return groupId
.equals(that
.groupId
);
154 public int hashCode() {
155 int result
= address
.hashCode();
156 result
= 31 * result
+ groupId
.hashCode();