mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Send delivery receipt for data messages that need it
With the unidentified sender messages, the Signal server cannot do this automatically anymore.
This commit is contained in:
parent
b62694dbc7
commit
1b56485fc8
1 changed files with 18 additions and 0 deletions
|
@ -80,6 +80,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
|||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceStickerManifestUpload;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceStickerManifestUpload.StickerInfo;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.BlockedListMessage;
|
||||
|
@ -668,6 +669,14 @@ public class Manager implements Signal {
|
|||
sendMessageLegacy(messageBuilder, Collections.singleton(recipient));
|
||||
}
|
||||
|
||||
private void sendReceipt(SignalServiceAddress remoteAddress, long messageId) throws IOException, UntrustedIdentityException {
|
||||
SignalServiceReceiptMessage receiptMessage = new SignalServiceReceiptMessage(SignalServiceReceiptMessage.Type.DELIVERY,
|
||||
Collections.singletonList(messageId),
|
||||
System.currentTimeMillis());
|
||||
|
||||
getMessageSender().sendReceipt(remoteAddress, getAccessFor(remoteAddress), receiptMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message, List<String> attachments, String recipient)
|
||||
throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException {
|
||||
|
@ -1500,6 +1509,15 @@ public class Manager implements Signal {
|
|||
}
|
||||
if (content.getDataMessage().isPresent()) {
|
||||
SignalServiceDataMessage message = content.getDataMessage().get();
|
||||
|
||||
if (content.isNeedsReceipt()) {
|
||||
try {
|
||||
sendReceipt(sender, message.getTimestamp());
|
||||
} catch (IOException | UntrustedIdentityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
handleSignalServiceDataMessage(message, false, sender, account.getSelfAddress(), ignoreAttachments);
|
||||
}
|
||||
if (content.getSyncMessage().isPresent()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue