diff options
Diffstat (limited to 'juick-xmpp-ft')
-rw-r--r-- | juick-xmpp-ft/src/main/java/com/juick/components/XMPPFTServer.java | 9 |
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 e8b9861c8..37ca7ec6f 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); |