mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 12:30:39 +00:00
added static member attachmentStoragePath
added static setter for attachmentStoragePath added new member storagePath to enable output of full path to the stored attachment on disk
This commit is contained in:
parent
a0bb46b9e6
commit
d1a00d5101
1 changed files with 17 additions and 1 deletions
|
@ -1,15 +1,30 @@
|
||||||
package org.asamk.signal;
|
package org.asamk.signal;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
||||||
|
|
||||||
class JsonAttachment {
|
public class JsonAttachment {
|
||||||
|
|
||||||
String contentType;
|
String contentType;
|
||||||
String filename;
|
String filename;
|
||||||
String id;
|
String id;
|
||||||
|
String storagePath;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
// This is a bit of a kludge, but the alternative of getting a reference
|
||||||
|
// to Manager (who knows about the attachmentPath) from somewhere was even worse.
|
||||||
|
static private String attachmentStoragePath = "";
|
||||||
|
|
||||||
|
static public String getAttachmentStoragePath() {
|
||||||
|
return attachmentStoragePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void setAttachmentStoragePath( String p) {
|
||||||
|
attachmentStoragePath = p;
|
||||||
|
}
|
||||||
|
|
||||||
JsonAttachment(SignalServiceAttachment attachment) {
|
JsonAttachment(SignalServiceAttachment attachment) {
|
||||||
this.contentType = attachment.getContentType();
|
this.contentType = attachment.getContentType();
|
||||||
|
|
||||||
|
@ -22,6 +37,7 @@ class JsonAttachment {
|
||||||
if (pointer.getSize().isPresent()) {
|
if (pointer.getSize().isPresent()) {
|
||||||
this.size = pointer.getSize().get();
|
this.size = pointer.getSize().get();
|
||||||
}
|
}
|
||||||
|
this.storagePath = attachmentStoragePath + File.separator + this.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue