mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-04 05:00:39 +00:00
Add sendTyping and sendReceipt to dbus interface
This commit is contained in:
parent
12e85ec671
commit
b48bd57a5d
3 changed files with 59 additions and 0 deletions
|
@ -125,6 +125,19 @@ Depending on the type of the recipient field this sends a message to one or mult
|
||||||
|
|
||||||
Exceptions: AttachmentInvalid, Failure, InvalidNumber, UntrustedIdentity
|
Exceptions: AttachmentInvalid, Failure, InvalidNumber, UntrustedIdentity
|
||||||
|
|
||||||
|
sendTyping(recipient<s>, stop<b>) -> <>::
|
||||||
|
* recipient : Phone number of a single recipient
|
||||||
|
* targetSentTimestamp : True, if typing state should be stopped
|
||||||
|
|
||||||
|
Exceptions: Failure, GroupNotFound, UntrustedIdentity
|
||||||
|
|
||||||
|
|
||||||
|
sendReceipt(recipient<s>, targetSentTimestamp<x>) -> <>::
|
||||||
|
* recipient : Phone number of a single recipient
|
||||||
|
* targetSentTimestamp : Long, can be used to identify the corresponding signal message
|
||||||
|
|
||||||
|
Exceptions: Failure, 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
|
||||||
|
|
|
@ -21,6 +21,14 @@ public interface Signal extends DBusInterface {
|
||||||
String message, List<String> attachments, List<String> recipients
|
String message, List<String> attachments, List<String> recipients
|
||||||
) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity;
|
) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity;
|
||||||
|
|
||||||
|
void sendTyping(
|
||||||
|
String recipient, Boolean stop
|
||||||
|
) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity;
|
||||||
|
|
||||||
|
void sendReceipt(
|
||||||
|
String recipient, long targetSentTimestamp
|
||||||
|
) throws Error.Failure, Error.UntrustedIdentity;
|
||||||
|
|
||||||
long sendRemoteDeleteMessage(
|
long sendRemoteDeleteMessage(
|
||||||
long targetSentTimestamp, String recipient
|
long targetSentTimestamp, String recipient
|
||||||
) throws Error.Failure, Error.InvalidNumber;
|
) throws Error.Failure, Error.InvalidNumber;
|
||||||
|
|
|
@ -5,8 +5,10 @@ import org.asamk.signal.BaseConfig;
|
||||||
import org.asamk.signal.manager.AttachmentInvalidException;
|
import org.asamk.signal.manager.AttachmentInvalidException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.NotMasterDeviceException;
|
import org.asamk.signal.manager.NotMasterDeviceException;
|
||||||
|
import org.asamk.signal.manager.UntrustedIdentityException;
|
||||||
import org.asamk.signal.manager.api.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||||
|
import org.asamk.signal.manager.api.TypingAction;
|
||||||
import org.asamk.signal.manager.groups.GroupId;
|
import org.asamk.signal.manager.groups.GroupId;
|
||||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||||
|
@ -165,6 +167,42 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendTyping(
|
||||||
|
final String recipient, final Boolean stop
|
||||||
|
) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity {
|
||||||
|
try {
|
||||||
|
var recipients = new ArrayList<String>(1);
|
||||||
|
recipients.add(recipient);
|
||||||
|
m.sendTypingMessage(stop ? TypingAction.STOP : TypingAction.START,
|
||||||
|
getSingleRecipientIdentifiers(recipients, m.getUsername()).stream()
|
||||||
|
.map(RecipientIdentifier.class::cast)
|
||||||
|
.collect(Collectors.toSet()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error.Failure(e.getMessage());
|
||||||
|
} catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
|
||||||
|
throw new Error.GroupNotFound(e.getMessage());
|
||||||
|
} catch (UntrustedIdentityException e) {
|
||||||
|
throw new Error.UntrustedIdentity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendReceipt(
|
||||||
|
final String recipient, final long targetSentTimestamp
|
||||||
|
) throws Error.Failure, Error.UntrustedIdentity {
|
||||||
|
try {
|
||||||
|
var timestamps = new ArrayList<Long>(1);
|
||||||
|
timestamps.add(targetSentTimestamp);
|
||||||
|
|
||||||
|
m.sendReadReceipt(getSingleRecipientIdentifier(recipient, m.getUsername()), timestamps);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error.Failure(e.getMessage());
|
||||||
|
} catch (UntrustedIdentityException e) {
|
||||||
|
throw new Error.UntrustedIdentity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long sendNoteToSelfMessage(
|
public long sendNoteToSelfMessage(
|
||||||
final String message, final List<String> attachments
|
final String message, final List<String> attachments
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue