mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Implement sendGroupTying dbus method
This commit is contained in:
parent
4999487476
commit
d9c8711eb0
4 changed files with 56 additions and 26 deletions
|
@ -237,9 +237,9 @@ Exceptions: Failure, InvalidNumber
|
||||||
|
|
||||||
sendTyping(recipient<s>, stop<b>) -> <>::
|
sendTyping(recipient<s>, stop<b>) -> <>::
|
||||||
* recipient : Phone number of a single recipient
|
* 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>) -> <>::
|
setContactBlocked(number<s>, block<b>) -> <>::
|
||||||
* number : Phone number affected by method
|
* number : Phone number affected by method
|
||||||
|
@ -353,6 +353,12 @@ sendGroupMessage(message<s>, attachments<as>, groupId<ay>) -> timestamp<x>::
|
||||||
|
|
||||||
Exceptions: GroupNotFound, Failure, AttachmentInvalid, InvalidGroupId
|
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>::
|
sendGroupMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, groupId<ay>) -> timestamp<x>::
|
||||||
* emoji : Unicode grapheme cluster of the emoji
|
* emoji : Unicode grapheme cluster of the emoji
|
||||||
* remove : Boolean, whether a previously sent reaction (emoji) should be removed
|
* remove : Boolean, whether a previously sent reaction (emoji) should be removed
|
||||||
|
|
|
@ -36,7 +36,7 @@ public interface Signal extends DBusInterface {
|
||||||
|
|
||||||
void sendTyping(
|
void sendTyping(
|
||||||
String recipient, boolean stop
|
String recipient, boolean stop
|
||||||
) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity;
|
) throws Error.Failure, Error.UntrustedIdentity;
|
||||||
|
|
||||||
void sendReadReceipt(
|
void sendReadReceipt(
|
||||||
String recipient, List<Long> messageIds
|
String recipient, List<Long> messageIds
|
||||||
|
@ -54,10 +54,6 @@ public interface Signal extends DBusInterface {
|
||||||
long targetSentTimestamp, List<String> recipients
|
long targetSentTimestamp, List<String> recipients
|
||||||
) throws Error.Failure, Error.InvalidNumber;
|
) throws Error.Failure, Error.InvalidNumber;
|
||||||
|
|
||||||
long sendGroupRemoteDeleteMessage(
|
|
||||||
long targetSentTimestamp, byte[] groupId
|
|
||||||
) throws Error.Failure, Error.GroupNotFound, Error.InvalidGroupId;
|
|
||||||
|
|
||||||
long sendMessageReaction(
|
long sendMessageReaction(
|
||||||
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, String recipient
|
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, String recipient
|
||||||
) throws Error.InvalidNumber, Error.Failure;
|
) throws Error.InvalidNumber, Error.Failure;
|
||||||
|
@ -84,6 +80,14 @@ public interface Signal extends DBusInterface {
|
||||||
String message, List<String> attachments, byte[] groupId
|
String message, List<String> attachments, byte[] groupId
|
||||||
) throws Error.GroupNotFound, Error.Failure, Error.AttachmentInvalid, Error.InvalidGroupId;
|
) 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(
|
long sendGroupMessageReaction(
|
||||||
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId
|
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId
|
||||||
) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber, Error.InvalidGroupId;
|
) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber, Error.InvalidGroupId;
|
||||||
|
|
|
@ -301,7 +301,8 @@ public class DbusManagerImpl implements Manager {
|
||||||
signal.sendTyping(signal.getSelfNumber(), action == TypingAction.STOP);
|
signal.sendTyping(signal.getSelfNumber(), action == TypingAction.STOP);
|
||||||
return 0L;
|
return 0L;
|
||||||
}, groupId -> {
|
}, groupId -> {
|
||||||
throw new UnsupportedOperationException();
|
signal.sendGroupTyping(groupId, action == TypingAction.STOP);
|
||||||
|
return 0L;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,22 +238,6 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
@Override
|
||||||
public long sendMessageReaction(
|
public long sendMessageReaction(
|
||||||
final String emoji,
|
final String emoji,
|
||||||
|
@ -401,7 +385,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
public long sendGroupMessage(final String message, final List<String> attachments, final byte[] groupId) {
|
public long sendGroupMessage(final String message, final List<String> attachments, final byte[] groupId) {
|
||||||
try {
|
try {
|
||||||
var results = m.sendMessage(new Message(message, attachments, List.of(), Optional.empty()),
|
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());
|
checkSendMessageResults(results.timestamp(), results.results());
|
||||||
return results.timestamp();
|
return results.timestamp();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -413,6 +397,37 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Override
|
||||||
public long sendGroupMessageReaction(
|
public long sendGroupMessageReaction(
|
||||||
final String emoji,
|
final String emoji,
|
||||||
|
@ -426,7 +441,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
remove,
|
remove,
|
||||||
getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()),
|
getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()),
|
||||||
targetSentTimestamp,
|
targetSentTimestamp,
|
||||||
Set.of(new RecipientIdentifier.Group(getGroupId(groupId))));
|
Set.of(getGroupRecipientIdentifier(groupId)));
|
||||||
checkSendMessageResults(results.timestamp(), results.results());
|
checkSendMessageResults(results.timestamp(), results.results());
|
||||||
return results.timestamp();
|
return results.timestamp();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -854,6 +869,10 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RecipientIdentifier.Group getGroupRecipientIdentifier(final byte[] groupId) {
|
||||||
|
return new RecipientIdentifier.Group(getGroupId(groupId));
|
||||||
|
}
|
||||||
|
|
||||||
private static GroupId getGroupId(byte[] groupId) throws DBusExecutionException {
|
private static GroupId getGroupId(byte[] groupId) throws DBusExecutionException {
|
||||||
try {
|
try {
|
||||||
return GroupId.unknownVersion(groupId);
|
return GroupId.unknownVersion(groupId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue