-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command to get an attachment #1080
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, I've added some comments for specifics.
Also please add the command to the man page: https://github.com/AsamK/signal-cli/blob/master/man/signal-cli.1.adoc
lib/src/main/java/org/asamk/signal/manager/AttachmentStore.java
Outdated
Show resolved
Hide resolved
Serializing the stream is better for memory handling than loading the whole thing into the file.
@AsamK I'm just writing the doc but I'm not sure that calling the parameter I guess generally the external number is referred to as recipient so maybe it's fine, but just wanted to throw that out. |
Yeah, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, looks good!
As gone over in #1078 here is a separate pull request on pulling attachment data.
The following command line command will write the Base64 string to the console:
The following JSON RPC request will pull up the attachment in the following format:
Response:
The actual command implementation was simple. However, the trick was to get access to the actual attachment through the attachment store. The best way I found was through the
Manager
instance passed to the command. To not have to expose all the guts of the manager etc. I wired this through theAttachmentHelper
and to theAttachmentStore
. Where this got a bit messy is theDbusManagerImpl
as this would need to expose the function to get an attachment, but I did not see anything in that class for handling attachments really. Maybe you have a better idea of how to implement this.