mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-11-29 08:55:48 +00:00
Add support for sending adminDelete messages
This commit is contained in:
1 parent
3b6c199b1d
commit
aa1ed9e233
6 files changed
+154
No files matched your search
@@ -224,6 +224,14 @@ public interface Manager extends Closeable {
|
||||
final boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendAdminDelete(
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier.Group> recipients,
|
||||
boolean notifySelf,
|
||||
boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendPinMessage(
|
||||
int pinDuration,
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
|
||||
@@ -993,6 +993,29 @@ public class ManagerImpl implements Manager {
|
||||
return sendMessage(messageBuilder, recipients, notifySelf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendMessageResults sendAdminDelete(
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier.Group> recipients,
|
||||
final boolean notifySelf,
|
||||
final boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException {
|
||||
final var targetAuthorRecipientId = context.getRecipientHelper().resolveRecipient(targetAuthor);
|
||||
final var authorServiceId = context.getRecipientHelper()
|
||||
.resolveSignalServiceAddress(targetAuthorRecipientId)
|
||||
.getServiceId();
|
||||
final var adminDelete = new SignalServiceDataMessage.AdminDelete(authorServiceId, targetSentTimestamp);
|
||||
final var messageBuilder = SignalServiceDataMessage.newBuilder().withAdminDelete(adminDelete);
|
||||
if (isStory) {
|
||||
messageBuilder.withStoryContext(new SignalServiceDataMessage.StoryContext(authorServiceId,
|
||||
targetSentTimestamp));
|
||||
}
|
||||
return sendMessage(messageBuilder,
|
||||
recipients.stream().map(r -> (RecipientIdentifier) r).collect(Collectors.toSet()),
|
||||
notifySelf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendMessageResults sendPinMessage(
|
||||
int pinDuration,
|
||||
|
||||
Reference in new issue
Block a user