mirror of
https://github.com/aljazceru/signal-cli.git
synced 2026-01-20 14:14:23 +01:00
dbus implementation of sendReaction command (#581)
This commit is contained in:
@@ -103,6 +103,30 @@ public class DbusSignalImpl implements Signal {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendMessageReaction(
|
||||
final String emoji, final boolean remove, final String targetAuthor, final long targetSentTimestamp, final String recipient
|
||||
) {
|
||||
var recipients = new ArrayList<String>(1);
|
||||
recipients.add(recipient);
|
||||
return sendMessageReaction(emoji, remove, targetAuthor, targetSentTimestamp, recipients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendMessageReaction(
|
||||
final String emoji, final boolean remove, final String targetAuthor, final long targetSentTimestamp, final List<String> recipients
|
||||
) {
|
||||
try {
|
||||
final var results = m.sendMessageReaction(emoji, remove, targetAuthor, targetSentTimestamp, recipients);
|
||||
checkSendMessageResults(results.first(), results.second());
|
||||
return results.first();
|
||||
} catch (InvalidNumberException e) {
|
||||
throw new Error.InvalidNumber(e.getMessage());
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendNoteToSelfMessage(
|
||||
final String message, final List<String> attachments
|
||||
@@ -145,6 +169,23 @@ public class DbusSignalImpl implements Signal {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendGroupMessageReaction(
|
||||
final String emoji, final boolean remove, final String targetAuthor, final long targetSentTimestamp, final byte[] groupId
|
||||
) {
|
||||
try {
|
||||
final var results = m.sendGroupMessageReaction(emoji, remove, targetAuthor, targetSentTimestamp, GroupId.unknownVersion(groupId));
|
||||
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());
|
||||
} catch (GroupNotFoundException | NotAGroupMemberException e) {
|
||||
throw new Error.GroupNotFound(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Since contact names might be empty if not defined, also potentially return
|
||||
// the profile name
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user