summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-03-15 10:55:56 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-03-15 14:14:06 (GMT)
commit3205cbf499196b32379c66cb0bea4ccd77334210 (patch)
treef888751ed02d990d3b3a63906329d4c6992117b3 /src/com/isode
parent826bc53ab9839d4f6dff28cdb4d5dc1b317016de (diff)
downloadstroke-3205cbf499196b32379c66cb0bea4ccd77334210.zip
stroke-3205cbf499196b32379c66cb0bea4ccd77334210.tar.bz2
Add description to FileTransfer
As per patch 'Show file-transfer description if provided' (523dbfb769069663eda19e381ad35f466b1ef27c) add a description field to the FileTransfer interface and its implementations. Test-information: Unit test still pass ok. Change-Id: I146e2adce67a491ae0381154e54d6d0e480026a2
Diffstat (limited to 'src/com/isode')
-rw-r--r--src/com/isode/stroke/filetransfer/FileTransfer.java4
-rw-r--r--src/com/isode/stroke/filetransfer/IncomingJingleFileTransfer.java12
-rw-r--r--src/com/isode/stroke/filetransfer/OutgoingJingleFileTransfer.java12
3 files changed, 23 insertions, 5 deletions
diff --git a/src/com/isode/stroke/filetransfer/FileTransfer.java b/src/com/isode/stroke/filetransfer/FileTransfer.java
index e12b07d..f3e7bba 100644
--- a/src/com/isode/stroke/filetransfer/FileTransfer.java
+++ b/src/com/isode/stroke/filetransfer/FileTransfer.java
@@ -63,8 +63,10 @@ public interface FileTransfer {
public long getFileSizeInBytes();
- public void setFileInfo(final String name, long size);
+ public void setFileInfo(final String name, long size, String description);
public State getState();
+ public String getDescription();
+
}
diff --git a/src/com/isode/stroke/filetransfer/IncomingJingleFileTransfer.java b/src/com/isode/stroke/filetransfer/IncomingJingleFileTransfer.java
index f7f9c70..60cde19 100644
--- a/src/com/isode/stroke/filetransfer/IncomingJingleFileTransfer.java
+++ b/src/com/isode/stroke/filetransfer/IncomingJingleFileTransfer.java
@@ -32,6 +32,7 @@ import com.isode.stroke.jingle.JingleContentID;
import com.isode.stroke.signals.SignalConnection;
import com.isode.stroke.signals.Slot1;
import com.isode.stroke.signals.Slot;
+
import java.util.logging.Logger;
import java.util.Vector;
import java.util.Map;
@@ -41,6 +42,7 @@ public class IncomingJingleFileTransfer extends JingleFileTransfer implements In
private long fileSizeInBytes = 0; //FileTransferVariables
private String filename = ""; //FileTransferVariables
+ private String ft_description = ""; //FileTransferVariables
/**
* FileTransferMethod.
@@ -62,9 +64,10 @@ public class IncomingJingleFileTransfer extends JingleFileTransfer implements In
* FileTransferMethod.
*/
@Override
- public void setFileInfo(final String name, long size) {
+ public void setFileInfo(final String name, long size, String description) {
this.filename = name;
this.fileSizeInBytes = size;
+ this.ft_description = description;
}
private JingleContentPayload initialContent;
@@ -99,7 +102,7 @@ public class IncomingJingleFileTransfer extends JingleFileTransfer implements In
this.description = initialContent.getDescription(new JingleFileTransferDescription());
assert(description != null);
JingleFileTransferFileInfo fileInfo = description.getFileInfo();
- setFileInfo(fileInfo.getName(), fileInfo.getSize());
+ setFileInfo(fileInfo.getName(), fileInfo.getSize(), fileInfo.getDescription());
hashes = fileInfo.getHashes();
waitOnHashTimer = timerFactory.createTimer(5000);
@@ -501,4 +504,9 @@ public class IncomingJingleFileTransfer extends JingleFileTransfer implements In
terminate(JinglePayload.Reason.Type.MediaError);
}
}
+
+ @Override
+ public String getDescription() {
+ return ft_description;
+ }
} \ No newline at end of file
diff --git a/src/com/isode/stroke/filetransfer/OutgoingJingleFileTransfer.java b/src/com/isode/stroke/filetransfer/OutgoingJingleFileTransfer.java
index 63a11e8..f32821b 100644
--- a/src/com/isode/stroke/filetransfer/OutgoingJingleFileTransfer.java
+++ b/src/com/isode/stroke/filetransfer/OutgoingJingleFileTransfer.java
@@ -37,6 +37,7 @@ import com.isode.stroke.jingle.JingleContentID;
import com.isode.stroke.signals.SignalConnection;
import com.isode.stroke.signals.Slot1;
import com.isode.stroke.signals.Slot;
+
import java.util.logging.Logger;
import java.util.Vector;
@@ -44,6 +45,7 @@ public class OutgoingJingleFileTransfer extends JingleFileTransfer implements Ou
private long fileSizeInBytes = 0; //FileTransferVariables
private String filename = ""; //FileTransferVariables
+ private String ft_description = ""; // FileTransferVariables
/**
* FileTransferMethod.
@@ -65,9 +67,10 @@ public class OutgoingJingleFileTransfer extends JingleFileTransfer implements Ou
* FileTransferMethod.
*/
@Override
- public void setFileInfo(final String name, long size) {
+ public void setFileInfo(final String name, long size, String description) {
this.filename = name;
this.fileSizeInBytes = size;
+ this.ft_description = description;
}
public static final int DEFAULT_BLOCK_SIZE = 4096;
@@ -105,7 +108,7 @@ public class OutgoingJingleFileTransfer extends JingleFileTransfer implements Ou
this.contentID = new JingleContentID(idGenerator.generateID(), JingleContentPayload.Creator.InitiatorCreator);
this.internalState = State.Initial;
this.candidateAcknowledged = false;
- setFileInfo(fileInfo.getName(), fileInfo.getSize());
+ setFileInfo(fileInfo.getName(), fileInfo.getSize(), fileInfo.getDescription());
// calculate both, MD5 and SHA-1 since we don't know which one the other side supports
hashCalculator = new IncrementalBytestreamHashCalculator(true, true, crypto);
@@ -449,4 +452,9 @@ public class OutgoingJingleFileTransfer extends JingleFileTransfer implements Ou
return FileTransfer.State.Type.Initial;
}
+ @Override
+ public String getDescription() {
+ return ft_description;
+ }
+
} \ No newline at end of file