mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Implement downloading attachments
This commit is contained in:
parent
f06672db89
commit
e1b584ab84
2 changed files with 43 additions and 8 deletions
|
@ -20,6 +20,7 @@ import net.sourceforge.argparse4j.ArgumentParsers;
|
|||
import net.sourceforge.argparse4j.impl.Arguments;
|
||||
import net.sourceforge.argparse4j.inf.*;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.whispersystems.libaxolotl.InvalidMessageException;
|
||||
import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException;
|
||||
import org.whispersystems.textsecure.api.messages.*;
|
||||
import org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage;
|
||||
|
@ -262,6 +263,12 @@ public class Main {
|
|||
System.out.println("- " + attachment.getContentType() + " (" + (attachment.isPointer() ? "Pointer" : "") + (attachment.isStream() ? "Stream" : "") + ")");
|
||||
if (attachment.isPointer()) {
|
||||
System.out.println(" Id: " + attachment.asPointer().getId() + " Key length: " + attachment.asPointer().getKey().length + (attachment.asPointer().getRelay().isPresent() ? " Relay: " + attachment.asPointer().getRelay().get() : ""));
|
||||
try {
|
||||
File file = m.retrieveAttachment(attachment.asPointer());
|
||||
System.out.println(" Stored plaintext in: " + file);
|
||||
} catch (IOException | InvalidMessageException e) {
|
||||
System.out.println("Failed to retrieve attachment: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue