Added sendStoryMessage

This commit is contained in:
Scott Lewis 2025-01-27 16:45:20 -08:00
parent fab1b96c21
commit 811dc0dcf3
5 changed files with 601 additions and 607 deletions

File diff suppressed because it is too large Load diff

View file

@ -420,6 +420,16 @@ public class DbusManagerImpl implements Manager {
groupId -> signal.sendGroupMessage(message.messageText(), message.attachments(), groupId));
}
@Override
public SendMessageResults sendStoryMessage(
final Message message, final Set<RecipientIdentifier> recipients, final boolean notifySelf
) throws IOException, AttachmentInvalidException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException {
return handleMessage(recipients,
numbers -> signal.sendMessage(message.messageText(), message.attachments(), numbers),
() -> signal.sendNoteToSelfMessage(message.messageText(), message.attachments()),
groupId -> signal.sendStoryMessage(message.messageText(), message.attachments(), groupId));
}
@Override
public SendMessageResults sendEditMessage(
final Message message, final Set<RecipientIdentifier> recipients, final long editTargetTimestamp

View file

@ -459,6 +459,31 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
}
}
@Override
public long sendStoryMessage(final String messageText, final List<String> attachments, final byte[] groupId) {
try {
final var message = new Message(messageText,
attachments,
List.of(),
Optional.empty(),
Optional.empty(),
List.of(),
Optional.empty(),
List.of());
var results = m.sendStoryMessage(message, Set.of(getGroupRecipientIdentifier(groupId)), false);
checkSendMessageResults(results);
return results.timestamp();
} catch (IOException | InvalidStickerException e) {
throw new Error.Failure(e.getMessage());
} catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
throw new Error.GroupNotFound(e.getMessage());
} catch (AttachmentInvalidException e) {
throw new Error.AttachmentInvalid(e.getMessage());
} catch (UnregisteredRecipientException e) {
throw new Error.UntrustedIdentity(e.getSender().getIdentifier() + " is not registered.");
}
}
@Override
public void sendGroupTyping(
final byte[] groupId, final boolean stop