Add --notiy-self to sendReaction command

This commit is contained in:
AsamK 2025-11-02 18:25:24 +01:00
parent e832a57f35
commit d27aea2220
7 changed files with 17 additions and 7 deletions

View File

@ -218,6 +218,7 @@ public interface Manager extends Closeable {
RecipientIdentifier.Single targetAuthor,
long targetSentTimestamp,
Set<RecipientIdentifier> recipients,
final boolean notifySelf,
final boolean isStory
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;

View File

@ -961,6 +961,7 @@ public class ManagerImpl implements Manager {
RecipientIdentifier.Single targetAuthor,
long targetSentTimestamp,
Set<RecipientIdentifier> recipients,
final boolean notifySelf,
final boolean isStory
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException {
var targetAuthorRecipientId = context.getRecipientHelper().resolveRecipient(targetAuthor);
@ -973,7 +974,7 @@ public class ManagerImpl implements Manager {
messageBuilder.withStoryContext(new SignalServiceDataMessage.StoryContext(authorServiceId,
targetSentTimestamp));
}
return sendMessage(messageBuilder, recipients, false);
return sendMessage(messageBuilder, recipients, notifySelf);
}
@Override

View File

@ -295,7 +295,10 @@ RECIPIENT::
Specify the recipients.
*--note-to-self*::
Send the message to self without notification.
Send the message to self.
*--notify-self*::
If self is part of recipients/groups send a normal message, not a sync message.
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.

View File

@ -48,9 +48,7 @@ public class SendCommand implements JsonRpcLocalCommand {
subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
subparser.addArgument("-g", "--group-id", "--group").help("Specify the recipient group ID.").nargs("*");
subparser.addArgument("-u", "--username").help("Specify the recipient username or username link.").nargs("*");
subparser.addArgument("--note-to-self")
.help("Send the message to self without notification.")
.action(Arguments.storeTrue());
subparser.addArgument("--note-to-self").help("Send the message to self.").action(Arguments.storeTrue());
subparser.addArgument("--notify-self")
.help("If self is part of recipients/groups send a normal message, not a sync message.")
.action(Arguments.storeTrue());

View File

@ -33,9 +33,11 @@ public class SendReactionCommand implements JsonRpcLocalCommand {
subparser.addArgument("-g", "--group-id", "--group").help("Specify the recipient group ID.").nargs("*");
subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
subparser.addArgument("-u", "--username").help("Specify the recipient username or username link.").nargs("*");
subparser.addArgument("--note-to-self")
.help("Send the reaction to self without notification.")
subparser.addArgument("--note-to-self").help("Send the reaction to self.").action(Arguments.storeTrue());
subparser.addArgument("--notify-self")
.help("If self is part of recipients/groups send a normal message, not a sync message.")
.action(Arguments.storeTrue());
subparser.addArgument("-e", "--emoji")
.required(true)
.help("Specify the emoji, should be a single unicode grapheme cluster.");
@ -58,6 +60,7 @@ public class SendReactionCommand implements JsonRpcLocalCommand {
final Manager m,
final OutputWriter outputWriter
) throws CommandException {
final var notifySelf = Boolean.TRUE.equals(ns.getBoolean("notify-self"));
final var isNoteToSelf = Boolean.TRUE.equals(ns.getBoolean("note-to-self"));
final var recipientStrings = ns.<String>getList("recipient");
final var groupIdStrings = ns.<String>getList("group-id");
@ -89,6 +92,7 @@ public class SendReactionCommand implements JsonRpcLocalCommand {
targetAuthorIdentifier,
targetTimestamp,
recipientIdentifiers,
notifySelf,
isStory);
outputResult(outputWriter, results);
} catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {

View File

@ -464,6 +464,7 @@ public class DbusManagerImpl implements Manager {
final RecipientIdentifier.Single targetAuthor,
final long targetSentTimestamp,
final Set<RecipientIdentifier> recipients,
final boolean notifySelf,
final boolean isStory
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException {
return handleMessage(recipients,

View File

@ -309,6 +309,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
getSingleRecipientIdentifiers(recipients, m.getSelfNumber()).stream()
.map(RecipientIdentifier.class::cast)
.collect(Collectors.toSet()),
false,
false);
checkSendMessageResults(results);
return results.timestamp();
@ -511,6 +512,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()),
targetSentTimestamp,
Set.of(getGroupRecipientIdentifier(groupId)),
false,
false);
checkSendMessageResults(results);
return results.timestamp();