sendTyping(recipient<s>, stop<b>) -> <>::
* recipient : Phone number of a single recipient
-* targetSentTimestamp : True, if typing state should be stopped
+* stop : True, if typing state should be stopped
-Exceptions: Failure, GroupNotFound, UntrustedIdentity
+Exceptions: Failure, UntrustedIdentity
setContactBlocked(number<s>, block<b>) -> <>::
* number : Phone number affected by method
Exceptions: GroupNotFound, Failure, AttachmentInvalid, InvalidGroupId
+sendGroupTyping(groupId<ay>, stop<b>) -> <>::
+* groupId : Byte array representing the internal group identifier
+* stop : True, if typing state should be stopped
+
+Exceptions: Failure, GroupNotFound, UntrustedIdentity
+
sendGroupMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, groupId<ay>) -> timestamp<x>::
* emoji : Unicode grapheme cluster of the emoji
* remove : Boolean, whether a previously sent reaction (emoji) should be removed
void sendTyping(
String recipient, boolean stop
- ) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity;
+ ) throws Error.Failure, Error.UntrustedIdentity;
void sendReadReceipt(
String recipient, List<Long> messageIds
long targetSentTimestamp, List<String> recipients
) throws Error.Failure, Error.InvalidNumber;
- long sendGroupRemoteDeleteMessage(
- long targetSentTimestamp, byte[] groupId
- ) throws Error.Failure, Error.GroupNotFound, Error.InvalidGroupId;
-
long sendMessageReaction(
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, String recipient
) throws Error.InvalidNumber, Error.Failure;
String message, List<String> attachments, byte[] groupId
) throws Error.GroupNotFound, Error.Failure, Error.AttachmentInvalid, Error.InvalidGroupId;
+ void sendGroupTyping(
+ final byte[] groupId, final boolean stop
+ ) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity;
+
+ long sendGroupRemoteDeleteMessage(
+ long targetSentTimestamp, byte[] groupId
+ ) throws Error.Failure, Error.GroupNotFound, Error.InvalidGroupId;
+
long sendGroupMessageReaction(
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId
) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber, Error.InvalidGroupId;
signal.sendTyping(signal.getSelfNumber(), action == TypingAction.STOP);
return 0L;
}, groupId -> {
- throw new UnsupportedOperationException();
+ signal.sendGroupTyping(groupId, action == TypingAction.STOP);
+ return 0L;
});
}
}
}
- @Override
- public long sendGroupRemoteDeleteMessage(
- final long targetSentTimestamp, final byte[] groupId
- ) {
- try {
- final var results = m.sendRemoteDeleteMessage(targetSentTimestamp,
- Set.of(new RecipientIdentifier.Group(getGroupId(groupId))));
- checkSendMessageResults(results.timestamp(), results.results());
- return results.timestamp();
- } catch (IOException e) {
- throw new Error.Failure(e.getMessage());
- } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
- throw new Error.GroupNotFound(e.getMessage());
- }
- }
-
@Override
public long sendMessageReaction(
final String emoji,
public long sendGroupMessage(final String message, final List<String> attachments, final byte[] groupId) {
try {
var results = m.sendMessage(new Message(message, attachments, List.of(), Optional.empty()),
- Set.of(new RecipientIdentifier.Group(getGroupId(groupId))));
+ Set.of(getGroupRecipientIdentifier(groupId)));
checkSendMessageResults(results.timestamp(), results.results());
return results.timestamp();
} catch (IOException e) {
}
}
+ @Override
+ public void sendGroupTyping(
+ final byte[] groupId, final boolean stop
+ ) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity {
+ try {
+ final var results = m.sendTypingMessage(stop ? TypingAction.STOP : TypingAction.START,
+ Set.of(getGroupRecipientIdentifier(groupId)));
+ checkSendMessageResults(results.timestamp(), results.results());
+ } catch (IOException e) {
+ throw new Error.Failure(e.getMessage());
+ } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
+ throw new Error.GroupNotFound(e.getMessage());
+ }
+ }
+
+ @Override
+ public long sendGroupRemoteDeleteMessage(
+ final long targetSentTimestamp, final byte[] groupId
+ ) {
+ try {
+ final var results = m.sendRemoteDeleteMessage(targetSentTimestamp,
+ Set.of(getGroupRecipientIdentifier(groupId)));
+ checkSendMessageResults(results.timestamp(), results.results());
+ return results.timestamp();
+ } catch (IOException e) {
+ throw new Error.Failure(e.getMessage());
+ } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
+ throw new Error.GroupNotFound(e.getMessage());
+ }
+ }
+
@Override
public long sendGroupMessageReaction(
final String emoji,
remove,
getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()),
targetSentTimestamp,
- Set.of(new RecipientIdentifier.Group(getGroupId(groupId))));
+ Set.of(getGroupRecipientIdentifier(groupId)));
checkSendMessageResults(results.timestamp(), results.results());
return results.timestamp();
} catch (IOException e) {
}
}
+ private RecipientIdentifier.Group getGroupRecipientIdentifier(final byte[] groupId) {
+ return new RecipientIdentifier.Group(getGroupId(groupId));
+ }
+
private static GroupId getGroupId(byte[] groupId) throws DBusExecutionException {
try {
return GroupId.unknownVersion(groupId);