Send remote delete (#593)

* Implementation of remoteDelete command, iteration 1

* Implementation of remoteDelete command, iteration 2

* Implementation of remoteDelete command, iteration 3

* Implementation of remoteDelete command, iteration 4

* Implementation of remoteDelete command, iteration 5

* Implementation of remoteDelete command, iteration 6

* Renaming dbus methods remoteGroupDelete -> sendGroupRemoteDeleteMessage, remoteDelete -> sendRemoteDeleteMessage
This commit is contained in:
Adaptive Garage 2021-04-05 19:49:45 +02:00 committed by GitHub
parent 2ad18342a8
commit 05abb3f9f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 184 additions and 3 deletions

View file

@ -103,6 +103,45 @@ public class DbusSignalImpl implements Signal {
}
}
@Override
public long sendRemoteDeleteMessage(
final long targetSentTimestamp, final String recipient
) {
var recipients = new ArrayList<String>(1);
recipients.add(recipient);
return sendRemoteDeleteMessage(targetSentTimestamp, recipients);
}
@Override
public long sendRemoteDeleteMessage(
final long targetSentTimestamp, final List<String> recipients
) {
try {
final var results = m.sendRemoteDeleteMessage(targetSentTimestamp, recipients);
checkSendMessageResults(results.first(), results.second());
return results.first();
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
} catch (InvalidNumberException e) {
throw new Error.InvalidNumber(e.getMessage());
}
}
@Override
public long sendGroupRemoteDeleteMessage(
final long targetSentTimestamp, final byte[] groupId
) {
try {
final var results = m.sendGroupRemoteDeleteMessage(targetSentTimestamp, GroupId.unknownVersion(groupId));
checkSendMessageResults(results.first(), results.second());
return results.first();
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
} catch (GroupNotFoundException | NotAGroupMemberException e) {
throw new Error.GroupNotFound(e.getMessage());
}
}
@Override
public long sendMessageReaction(
final String emoji, final boolean remove, final String targetAuthor, final long targetSentTimestamp, final String recipient