diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-14 12:31:57 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-15 15:34:12 +0100 |
commit | e7a70a46e0154740177dcdea7fad255dcd4067e9 (patch) | |
tree | 76594b4f495b8b415b47e1d4273c64f6e15f6f60 /src/main/java/eu/siacs/conversations/xmpp | |
parent | 16847a30c88246381a026bce9f2435be2bd77422 (diff) |
some mime and pgp fixes for file transfer
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index 793c6c54..0c79d101 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -1,5 +1,6 @@ package eu.siacs.conversations.xmpp.jingle; +import java.net.URLConnection; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -97,6 +98,9 @@ public class JingleConnection implements Downloadable { Message.STATUS_RECEIVED); } else { message.setDownloadable(null); + if (message.getEncryption() != Message.ENCRYPTION_PGP) { + file.delete(); + } } Log.d(Config.LOGTAG, "sucessfully transmitted file:" + file.getAbsolutePath()); @@ -922,6 +926,21 @@ public class JingleConnection implements Downloadable { @Override public String getMimeType() { - return this.file.getMimeType(); + if (this.message.getType() == Message.TYPE_FILE) { + String mime = null; + String path = this.message.getRelativeFilePath(); + if (path != null && !this.message.getRelativeFilePath().isEmpty()) { + mime = URLConnection.guessContentTypeFromName(this.message.getRelativeFilePath()); + if (mime!=null) { + return mime; + } else { + return ""; + } + } else { + return ""; + } + } else { + return "image/webp"; + } } } |