AsamK / signal-cli

signal-cli provides an unofficial commandline, JSON-RPC and dbus interface for the Signal messenger.
GNU General Public License v3.0
3.22k stars 306 forks source link

[Feature Request] Add support for attachment caption #1601

Open Thireus opened 1 month ago

Thireus commented 1 month ago

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}]'

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