mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
parent
76942ea458
commit
e3752e733a
5 changed files with 95 additions and 4 deletions
|
@ -4,6 +4,7 @@ import org.asamk.signal.manager.groups.GroupIdV1;
|
|||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
interface HandleAction {
|
||||
|
@ -23,7 +24,7 @@ class SendReceiptAction implements HandleAction {
|
|||
|
||||
@Override
|
||||
public void execute(Manager m) throws Throwable {
|
||||
m.sendReceipt(address, timestamp);
|
||||
m.sendDeliveryReceipt(address, List.of(timestamp));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1191,11 +1191,31 @@ public class Manager implements Closeable {
|
|||
return sendHelper.sendGroupMessage(messageBuilder.build(), Set.of(resolveRecipient(recipient)));
|
||||
}
|
||||
|
||||
void sendReceipt(
|
||||
SignalServiceAddress remoteAddress, long messageId
|
||||
public void sendReadReceipt(
|
||||
String sender, List<Long> messageIds
|
||||
) throws IOException, UntrustedIdentityException, InvalidNumberException {
|
||||
var receiptMessage = new SignalServiceReceiptMessage(SignalServiceReceiptMessage.Type.READ,
|
||||
messageIds,
|
||||
System.currentTimeMillis());
|
||||
|
||||
sendHelper.sendReceiptMessage(receiptMessage, canonicalizeAndResolveRecipient(sender));
|
||||
}
|
||||
|
||||
public void sendViewedReceipt(
|
||||
String sender, List<Long> messageIds
|
||||
) throws IOException, UntrustedIdentityException, InvalidNumberException {
|
||||
var receiptMessage = new SignalServiceReceiptMessage(SignalServiceReceiptMessage.Type.VIEWED,
|
||||
messageIds,
|
||||
System.currentTimeMillis());
|
||||
|
||||
sendHelper.sendReceiptMessage(receiptMessage, canonicalizeAndResolveRecipient(sender));
|
||||
}
|
||||
|
||||
void sendDeliveryReceipt(
|
||||
SignalServiceAddress remoteAddress, List<Long> messageIds
|
||||
) throws IOException, UntrustedIdentityException {
|
||||
var receiptMessage = new SignalServiceReceiptMessage(SignalServiceReceiptMessage.Type.DELIVERY,
|
||||
List.of(messageId),
|
||||
messageIds,
|
||||
System.currentTimeMillis());
|
||||
|
||||
sendHelper.sendReceiptMessage(receiptMessage, resolveRecipient(remoteAddress));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue