aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp-ft/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-11 14:38:48 +0300
committerGravatar Vitaly Takmazov2016-11-11 14:38:48 +0300
commit49d632e5e234cf9dbc057d20f5e3eabc34b48969 (patch)
tree40fecf27c61afdfd90e57de05ce9b23b0433d92f /juick-xmpp-ft/src/main/java/com/juick
parentcd423cf3c3f64e072d6d67458e277329d4c38663 (diff)
xmpp-ft: fix attachment name
Diffstat (limited to 'juick-xmpp-ft/src/main/java/com/juick')
-rw-r--r--juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java b/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java
index e8b9861c..37ca7ec6 100644
--- a/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java
+++ b/juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java
@@ -1,5 +1,6 @@
package com.juick.components;
+import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
@@ -51,17 +52,19 @@ public class XMPPFTServer {
msg.setTo(Jid.of(juickJid));
msg.setBody(e.getDescription());
try {
- msg.addExtension(new OobX(new URL(filePath.toString()), "!!!!Juick!!"));
+ String attachmentUrl = DigestUtils.md5Hex(String.format("%s-%s", e.getInitiator().toString(), e.getSessionId()).getBytes());
+ msg.addExtension(new OobX(new URL(attachmentUrl), "!!!!Juick!!"));
+ component.sendMessage(msg);
} catch (MalformedURLException e1) {
- e1.printStackTrace();
+ logger.warn("attachment error", e1);
}
- component.sendMessage(msg);
}
});
ft.transfer();
logger.info("transfer started");
} else {
e.reject();
+ logger.info("transfer rejected");
}
} catch (IOException | InterruptedException | ExecutionException e1) {
logger.error("ft error", e1);