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
|
@ -107,6 +107,8 @@ public interface Signal extends DBusInterface {
|
|||
|
||||
byte[] joinGroup(final String groupLink) throws Error.Failure;
|
||||
|
||||
String uploadStickerPack(String stickerPackPath) throws Error.Failure;
|
||||
|
||||
class MessageReceived extends DBusSignal {
|
||||
|
||||
private final long timestamp;
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.asamk.signal.BaseConfig;
|
|||
import org.asamk.signal.manager.AttachmentInvalidException;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.NotMasterDeviceException;
|
||||
import org.asamk.signal.manager.StickerPackInvalidException;
|
||||
import org.asamk.signal.manager.UntrustedIdentityException;
|
||||
import org.asamk.signal.manager.api.Message;
|
||||
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 {
|
||||
var error = ErrorUtils.getErrorMessageFromSendMessageResult(result);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue