"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
+{
+ "name":"org.asamk.signal.json.JsonAttachmentData",
+ "allDeclaredFields":true,
+ "queryAllDeclaredMethods":true,
+ "queryAllDeclaredConstructors":true,
+ "methods":[{"name":"data","parameterTypes":[] }]
+},
{
"name":"org.asamk.signal.json.JsonCallMessage",
"allDeclaredFields":true,
{"name":"startColor","parameterTypes":[] }
]
},
+{
+ "name":"org.asamk.signal.json.JsonStreamSerializer",
+ "methods":[{"name":"<init>","parameterTypes":[] }]
+},
{
"name":"org.asamk.signal.json.JsonSyncDataMessage",
"allDeclaredFields":true,
public StreamDetails retrieveAttachment(final String id) throws IOException {
final var attachmentFile = new File(attachmentsPath, id);
- if (!attachmentFile.exists()) {
- return null;
- }
return Utils.createStreamDetailsFromFile(attachmentFile);
}
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
2,
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
- new SignalContactDiscoveryUrl[]{new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL,
- TRUST_STORE)},
+ new SignalContactDiscoveryUrl[]{
+ new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL, TRUST_STORE)
+ },
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
new SignalCdnUrl[]{new SignalCdnUrl(CDN_URL, TRUST_STORE)},
2,
new SignalCdnUrl[]{new SignalCdnUrl(CDN2_URL, TRUST_STORE)}),
- new SignalContactDiscoveryUrl[]{new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL,
- TRUST_STORE)},
+ new SignalContactDiscoveryUrl[]{
+ new SignalContactDiscoveryUrl(SIGNAL_CONTACT_DISCOVERY_URL, TRUST_STORE)
+ },
new SignalKeyBackupServiceUrl[]{new SignalKeyBackupServiceUrl(SIGNAL_KEY_BACKUP_URL, TRUST_STORE)},
new SignalStorageUrl[]{new SignalStorageUrl(STORAGE_URL, TRUST_STORE)},
new SignalCdsiUrl[]{new SignalCdsiUrl(SIGNAL_CDSI_URL, TRUST_STORE)},
return attachmentStore.retrieveAttachment(id);
}
-
public List<SignalServiceAttachment> uploadAttachments(final List<String> attachments) throws AttachmentInvalidException, IOException {
var attachmentStreams = AttachmentUtils.createAttachmentStreams(attachments);
=== getAttachment
-Gets teh raw data for a specified attachment. This is done using the ID of the attachment the recipient or group ID.
+Gets the raw data for a specified attachment.
+This is done using the ID of the attachment the recipient or group ID.
The attachment data is returned as a Base64 String.
*--id* [ID]::
The ID of the attachment as given in the attachment list of the message.
*--recipient* [RECIPIENT]::
-Specify the number which sent the attachment. Referred to generally as recipient.
+Specify the number which sent the attachment.
+Referred to generally as recipient.
*-g* [GROUP], *--group-id* [GROUP]::
-Alternatively, specify the group IDs that for which to get the attachment.
+Alternatively, specify the group IDs for which to get the attachment.
=== daemon
static {
addCommand(new AddDeviceCommand());
- addCommand(new GetAttachmentCommand());
addCommand(new BlockCommand());
addCommand(new DaemonCommand());
addCommand(new DeleteLocalAccountDataCommand());
addCommand(new FinishLinkCommand());
+ addCommand(new GetAttachmentCommand());
addCommand(new GetUserStatusCommand());
addCommand(new JoinGroupCommand());
addCommand(new JsonRpcDispatcherCommand());
@Override
public void attachToSubparser(final Subparser subparser) {
- subparser.addArgument("--id")
- .required(true)
- .help("The ID of the attachment file.");
- var mut = subparser.addMutuallyExclusiveGroup()
- .required(true);
- mut.addArgument("--recipient")
- .help("Sender of the attachment");
- mut.addArgument("-g", "--group-id")
- .help("Group in which the attachment was received");
+ subparser.addArgument("--id").required(true).help("The ID of the attachment file.");
+ var mut = subparser.addMutuallyExclusiveGroup().required(true);
+ mut.addArgument("--recipient").help("Sender of the attachment");
+ mut.addArgument("-g", "--group-id").help("Group in which the attachment was received");
}
@Override
public void handleCommand(
- final Namespace ns,
- final Manager m,
- final OutputWriter outputWriter
+ final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
final var id = ns.getString("id");
- try(InputStream attachment = m.retrieveAttachment(id)) {
+ try (InputStream attachment = m.retrieveAttachment(id)) {
if (outputWriter instanceof PlainTextWriter writer) {
final var bytes = attachment.readAllBytes();
final var base64 = Base64.getEncoder().encodeToString(bytes);
import java.io.InputStream;
public record JsonAttachmentData(
- @JsonSerialize(using=JsonStreamSerializer.class) InputStream data
+ @JsonSerialize(using = JsonStreamSerializer.class) InputStream data
) {}
}
public record Gradient(
- String startColor,
- String endColor,
- List<String> colors,
- List<Float> positions,
- Integer angle
+ String startColor, String endColor, List<String> colors, List<Float> positions, Integer angle
) {
static Gradient from(MessageEnvelope.Story.TextAttachment.Gradient gradient) {
@Override
public void serialize(
- final InputStream value,
- final JsonGenerator jsonGenerator,
- final SerializerProvider serializers
+ final InputStream value, final JsonGenerator jsonGenerator, final SerializerProvider serializers
) throws IOException {
jsonGenerator.writeBinary(value, -1);
}
public class Hex {
- private final static char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ private final static char[] HEX_DIGITS = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
private Hex() {
}