mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-04 05:00:39 +00:00
Merge branch 'master' into dbus_updateaccount
This commit is contained in:
commit
c6bd84dec6
3 changed files with 73 additions and 0 deletions
|
@ -119,6 +119,13 @@ updateProfile(newName<s>, about <s>, aboutEmoji <s>, avatar<s>, remove<b>) -> <>
|
||||||
|
|
||||||
Exceptions: Failure
|
Exceptions: Failure
|
||||||
|
|
||||||
|
|
||||||
|
setExpirationTimer(number<s>, expiration<i>) -> <>::
|
||||||
|
* number : Phone number of recipient
|
||||||
|
* expiration : int32 for the number of seconds before messages to this recipient disappear. Set to 0 to disable expiration.
|
||||||
|
|
||||||
|
Exceptions: Failure
|
||||||
|
|
||||||
setContactBlocked(number<s>, block<b>) -> <>::
|
setContactBlocked(number<s>, block<b>) -> <>::
|
||||||
* number : Phone number affected by method
|
* number : Phone number affected by method
|
||||||
* block : 0=remove block , 1=blocked
|
* block : 0=remove block , 1=blocked
|
||||||
|
@ -165,6 +172,18 @@ sendGroupMessage(message<s>, attachments<as>, groupId<ay>) -> timestamp<x>::
|
||||||
|
|
||||||
Exceptions: GroupNotFound, Failure, AttachmentInvalid
|
Exceptions: GroupNotFound, Failure, AttachmentInvalid
|
||||||
|
|
||||||
|
sendContacts() -> <>::
|
||||||
|
|
||||||
|
Sends a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.
|
||||||
|
|
||||||
|
Exceptions: Failure
|
||||||
|
|
||||||
|
sendSyncRequest() -> <>::
|
||||||
|
|
||||||
|
Sends a synchronization request to the primary device (for group, contacts, ...). Only works if sent from a secondary device.
|
||||||
|
|
||||||
|
Exception: Failure
|
||||||
|
|
||||||
sendNoteToSelfMessage(message<s>, attachments<as>) -> timestamp<x>::
|
sendNoteToSelfMessage(message<s>, attachments<as>) -> timestamp<x>::
|
||||||
* message : Text to send (can be UTF8)
|
* message : Text to send (can be UTF8)
|
||||||
* attachments : String array of filenames to send as attachments (passed as filename, so need to be readable by the user signal-cli is running under)
|
* attachments : String array of filenames to send as attachments (passed as filename, so need to be readable by the user signal-cli is running under)
|
||||||
|
@ -328,6 +347,12 @@ Set a new name for this device (main or linked).
|
||||||
|
|
||||||
Exception: Failure
|
Exception: Failure
|
||||||
|
|
||||||
|
uploadStickerPack(stickerPackPath<s>) -> url<s>::
|
||||||
|
* stickerPackPath : Path to the manifest.json file or a zip file in the same directory
|
||||||
|
* url : URL of sticker pack after successful upload
|
||||||
|
|
||||||
|
Exception: Failure
|
||||||
|
|
||||||
== Signals
|
== Signals
|
||||||
|
|
||||||
SyncMessageReceived (timestamp<x>, sender<s>, destination<s>, groupId<ay>,message<s>, attachments<as>)::
|
SyncMessageReceived (timestamp<x>, sender<s>, destination<s>, groupId<ay>,message<s>, attachments<as>)::
|
||||||
|
|
|
@ -49,6 +49,10 @@ public interface Signal extends DBusInterface {
|
||||||
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, List<String> recipients
|
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, List<String> recipients
|
||||||
) throws Error.InvalidNumber, Error.Failure;
|
) throws Error.InvalidNumber, Error.Failure;
|
||||||
|
|
||||||
|
void sendContacts() throws Error.Failure;
|
||||||
|
|
||||||
|
void sendSyncRequest() throws Error.Failure;
|
||||||
|
|
||||||
long sendNoteToSelfMessage(
|
long sendNoteToSelfMessage(
|
||||||
String message, List<String> attachments
|
String message, List<String> attachments
|
||||||
) throws Error.AttachmentInvalid, Error.Failure;
|
) throws Error.AttachmentInvalid, Error.Failure;
|
||||||
|
@ -67,6 +71,8 @@ public interface Signal extends DBusInterface {
|
||||||
|
|
||||||
void setContactName(String number, String name) throws Error.InvalidNumber;
|
void setContactName(String number, String name) throws Error.InvalidNumber;
|
||||||
|
|
||||||
|
void setExpirationTimer(final String number, final int expiration) throws Error.Failure;
|
||||||
|
|
||||||
void setContactBlocked(String number, boolean blocked) throws Error.InvalidNumber;
|
void setContactBlocked(String number, boolean blocked) throws Error.InvalidNumber;
|
||||||
|
|
||||||
void setGroupBlocked(byte[] groupId, boolean blocked) throws Error.GroupNotFound, Error.InvalidGroupId;
|
void setGroupBlocked(byte[] groupId, boolean blocked) throws Error.GroupNotFound, Error.InvalidGroupId;
|
||||||
|
@ -115,6 +121,8 @@ public interface Signal extends DBusInterface {
|
||||||
|
|
||||||
byte[] joinGroup(final String groupLink) throws Error.Failure;
|
byte[] joinGroup(final String groupLink) throws Error.Failure;
|
||||||
|
|
||||||
|
String uploadStickerPack(String stickerPackPath) throws Error.Failure;
|
||||||
|
|
||||||
class MessageReceived extends DBusSignal {
|
class MessageReceived extends DBusSignal {
|
||||||
|
|
||||||
private final long timestamp;
|
private final long timestamp;
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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.StickerPackInvalidException;
|
||||||
import org.asamk.signal.manager.UntrustedIdentityException;
|
import org.asamk.signal.manager.UntrustedIdentityException;
|
||||||
import org.asamk.signal.manager.api.Device;
|
import org.asamk.signal.manager.api.Device;
|
||||||
import org.asamk.signal.manager.api.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
|
@ -250,6 +251,24 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendContacts() {
|
||||||
|
try {
|
||||||
|
m.sendContacts();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error.Failure("SendContacts error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendSyncRequest() {
|
||||||
|
try {
|
||||||
|
m.requestAllSyncData();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error.Failure("Request sync data error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long sendNoteToSelfMessage(
|
public long sendNoteToSelfMessage(
|
||||||
final String message, final List<String> attachments
|
final String message, final List<String> attachments
|
||||||
|
@ -335,6 +354,15 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setExpirationTimer(final String number, final int expiration) {
|
||||||
|
try {
|
||||||
|
m.setExpirationTimer(getSingleRecipientIdentifier(number, m.getUsername()), expiration);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error.Failure(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContactBlocked(final String number, final boolean blocked) {
|
public void setContactBlocked(final String number, final boolean blocked) {
|
||||||
try {
|
try {
|
||||||
|
@ -585,6 +613,18 @@ public class DbusSignalImpl implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String uploadStickerPack(String stickerPackPath) {
|
||||||
|
File path = new File(stickerPackPath);
|
||||||
|
try {
|
||||||
|
return m.uploadStickerPack(path).toString();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error.Failure("Upload error (maybe image size is too large):" + e.getMessage());
|
||||||
|
} catch (StickerPackInvalidException e) {
|
||||||
|
throw new Error.Failure("Invalid sticker pack: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void checkSendMessageResult(long timestamp, SendMessageResult result) throws DBusExecutionException {
|
private static void checkSendMessageResult(long timestamp, SendMessageResult result) throws DBusExecutionException {
|
||||||
var error = ErrorUtils.getErrorMessageFromSendMessageResult(result);
|
var error = ErrorUtils.getErrorMessageFromSendMessageResult(result);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue