aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-01-04 19:41:20 +0100
committersteckbrief <steckbrief@chefmail.de>2017-01-04 19:41:20 +0100
commit95cb2394154a287afcd295590d741096985ff69a (patch)
tree51f0b10fa41844885fc4ec40164b80e5892e3316 /src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
parentb85035c2bf57de75280ae0b4eedeff6fbf87e9eb (diff)
Added columns to fileparams table: url, original file name, key and ivtrz/beta-5
auto download of files moved from MessageParser to MessageAdapter download and open file representation cleaned up
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
index 1eef078f..290b87b8 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
@@ -9,6 +9,7 @@ import eu.siacs.conversations.utils.MimeUtils;
*/
public class FileParams {
private String name;
+ private String originalFilename;
private String path;
private String url;
private String mimeType;
@@ -16,6 +17,8 @@ public class FileParams {
private int width = 0;
private int height = 0;
private FileStatus fileStatus;
+ private byte[] aeskey;
+ private byte[] iv;
public FileParams() {
fileStatus = FileStatus.UNDEFINED;
@@ -89,6 +92,37 @@ public class FileParams {
return path;
}
+ public void setKeyAndIv(byte[] keyIvCombo) {
+ if (keyIvCombo.length == 48) {
+ this.aeskey = new byte[32];
+ this.iv = new byte[16];
+ System.arraycopy(keyIvCombo, 0, this.iv, 0, 16);
+ System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32);
+ } else if (keyIvCombo.length >= 32) {
+ this.aeskey = new byte[32];
+ System.arraycopy(keyIvCombo, 0, aeskey, 0, 32);
+ } else if (keyIvCombo.length >= 16) {
+ this.aeskey = new byte[16];
+ System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16);
+ }
+ }
+
+ public void setKey(byte[] key) {
+ this.aeskey = key;
+ }
+
+ public void setIv(byte[] iv) {
+ this.iv = iv;
+ }
+
+ public byte[] getKey() {
+ return this.aeskey;
+ }
+
+ public byte[] getIv() {
+ return this.iv;
+ }
+
/**
* Sets the path to the file.
* If no file name is stored yet here - this method tries to extract the file name from the path.
@@ -127,4 +161,12 @@ public class FileParams {
public FileStatus getFileStatus() {
return this.fileStatus;
}
+
+ public void setOriginalFilename(String originalFilename) {
+ this.originalFilename = originalFilename;
+ }
+
+ public String getOriginalFilename() {
+ return this.originalFilename;
+ }
}