mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
implement Dbus stickerpack method (#740)
implement uploadStickerPack update documentation
This commit is contained in:
parent
982e887c9f
commit
1ca0e75ef1
3 changed files with 21 additions and 0 deletions
|
@ -248,6 +248,12 @@ version() -> version<s>::
|
||||||
isRegistred -> result<b>::
|
isRegistred -> result<b>::
|
||||||
* result : Currently always returns 1=true
|
* result : Currently always returns 1=true
|
||||||
|
|
||||||
|
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>)::
|
||||||
|
|
|
@ -107,6 +107,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.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||||
|
@ -536,6 +537,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