1 package org
.asamk
.signal
.manager
;
3 import org
.whispersystems
.signalservice
.api
.push
.SignalServiceAddress
;
5 import java
.util
.Objects
;
7 interface HandleAction
{
9 void execute(Manager m
) throws Throwable
;
12 class SendReceiptAction
implements HandleAction
{
14 private final SignalServiceAddress address
;
15 private final long timestamp
;
17 public SendReceiptAction(final SignalServiceAddress address
, final long timestamp
) {
18 this.address
= address
;
19 this.timestamp
= timestamp
;
23 public void execute(Manager m
) throws Throwable
{
24 m
.sendReceipt(address
, timestamp
);
28 public boolean equals(final Object o
) {
29 if (this == o
) return true;
30 if (o
== null || getClass() != o
.getClass()) return false;
31 final SendReceiptAction that
= (SendReceiptAction
) o
;
32 return timestamp
== that
.timestamp
&& address
.equals(that
.address
);
36 public int hashCode() {
37 return Objects
.hash(address
, timestamp
);
41 class SendSyncContactsAction
implements HandleAction
{
43 private static final SendSyncContactsAction INSTANCE
= new SendSyncContactsAction();
45 private SendSyncContactsAction() {
48 public static SendSyncContactsAction
create() {
53 public void execute(Manager m
) throws Throwable
{
58 class SendSyncGroupsAction
implements HandleAction
{
60 private static final SendSyncGroupsAction INSTANCE
= new SendSyncGroupsAction();
62 private SendSyncGroupsAction() {
65 public static SendSyncGroupsAction
create() {
70 public void execute(Manager m
) throws Throwable
{
75 class SendSyncBlockedListAction
implements HandleAction
{
77 private static final SendSyncBlockedListAction INSTANCE
= new SendSyncBlockedListAction();
79 private SendSyncBlockedListAction() {
82 public static SendSyncBlockedListAction
create() {
87 public void execute(Manager m
) throws Throwable
{
92 class SendGroupInfoRequestAction
implements HandleAction
{
94 private final SignalServiceAddress address
;
95 private final GroupIdV1 groupId
;
97 public SendGroupInfoRequestAction(final SignalServiceAddress address
, final GroupIdV1 groupId
) {
98 this.address
= address
;
99 this.groupId
= groupId
;
103 public void execute(Manager m
) throws Throwable
{
104 m
.sendGroupInfoRequest(groupId
, address
);
108 public boolean equals(final Object o
) {
109 if (this == o
) return true;
110 if (o
== null || getClass() != o
.getClass()) return false;
112 final SendGroupInfoRequestAction that
= (SendGroupInfoRequestAction
) o
;
114 if (!address
.equals(that
.address
)) return false;
115 return groupId
.equals(that
.groupId
);
119 public int hashCode() {
120 int result
= address
.hashCode();
121 result
= 31 * result
+ groupId
.hashCode();
126 class SendGroupUpdateAction
implements HandleAction
{
128 private final SignalServiceAddress address
;
129 private final GroupIdV1 groupId
;
131 public SendGroupUpdateAction(final SignalServiceAddress address
, final GroupIdV1 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;
146 final SendGroupUpdateAction that
= (SendGroupUpdateAction
) o
;
148 if (!address
.equals(that
.address
)) return false;
149 return groupId
.equals(that
.groupId
);
153 public int hashCode() {
154 int result
= address
.hashCode();
155 result
= 31 * result
+ groupId
.hashCode();