signal-cli icon indicating copy to clipboard operation
signal-cli copied to clipboard

[Feature Request] Add support for attachment caption

Open Thireus opened this issue 1 year ago • 0 comments

Caption is currently implemented for ReceiveMessageHandler.java:

https://github.com/AsamK/signal-cli/blob/fab1b96c21ead48b64442f6d07beedef959de6ee/src/main/java/org/asamk/signal/ReceiveMessageHandler.java#L592

And also implemented here:

https://github.com/AsamK/signal-cli/blob/fab1b96c21ead48b64442f6d07beedef959de6ee/src/main/java/org/asamk/signal/json/JsonAttachment.java#L22

While the attachment JSON format supports it, it is currently not possible to set caption for uploaded attachments as it is missing from JSON RPC, CLI options and DBUS. And the function that would need to parse the caption (if any is attached) is defined here:

https://github.com/AsamK/signal-cli/blob/master/lib/src/main/java/org/asamk/signal/manager/util/AttachmentUtils.java#L30-L40

I propose a new --attachment-metadata (-am) vector option where the user could define the additional metadata for each attachment. For example, if 4 attachments are present:

-am '[{"caption":"image1_caption"}, None, {"width":800, "height":600}, {"caption":"image4_caption", "width":800, "height":600}]'

  • attachment 1 would receive caption "image1_caption"
  • attachment 2 has no additional metadata
  • attachment 3 has width set to 800 and height set to 600
  • attachment 4 has caption "image4_caption" and has width set to 800 and height set to 600

This would allow not only to support caption but also additional metadata such as voiceNote, borderless, preview, width, height, custom_filename, etc.

Thireus avatar Oct 04 '24 08:10 Thireus