aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src/main/java')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java b/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java
index 8317c600..ff879bee 100644
--- a/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java
+++ b/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java
@@ -176,7 +176,7 @@ public class XMPPConnection implements AutoCloseable {
FileTransfer ft = e.accept(filePath).get();
ft.addFileTransferStatusListener(st -> {
logger.debug("{}: received {} of {}", e.getName(), st.getBytesTransferred(), e.getSize());
- if (ft.isDone()) {
+ if (st.getStatus().equals(FileTransfer.Status.COMPLETED)) {
logger.info("transfer completed");
Message msg = new Message();
msg.setType(Message.Type.CHAT);
@@ -190,6 +190,16 @@ public class XMPPConnection implements AutoCloseable {
} catch (URISyntaxException e1) {
logger.warn("attachment error", e1);
}
+ } else if (st.getStatus().equals(FileTransfer.Status.FAILED)) {
+ logger.info("transfer failed", ft.getException());
+ Message msg = new Message();
+ msg.setType(Message.Type.CHAT);
+ msg.setFrom(xmpp.getJid());
+ msg.setTo(e.getInitiator());
+ msg.setBody("File transfer failed, please report to us");
+ router.sendMessage(msg);
+ } else if (st.getStatus().equals(FileTransfer.Status.CANCELED)) {
+ logger.info("transfer cancelled");
}
});
ft.transfer();