renamed downloadable to transferable
This commit is contained in:
parent
925801c14e
commit
ce79f4bbe3
|
@ -70,7 +70,7 @@ public class Message extends AbstractEntity {
|
||||||
protected String remoteMsgId = null;
|
protected String remoteMsgId = null;
|
||||||
protected String serverMsgId = null;
|
protected String serverMsgId = null;
|
||||||
protected Conversation conversation = null;
|
protected Conversation conversation = null;
|
||||||
protected Downloadable downloadable = null;
|
protected Transferable transferable = null;
|
||||||
private Message mNextMessage = null;
|
private Message mNextMessage = null;
|
||||||
private Message mPreviousMessage = null;
|
private Message mPreviousMessage = null;
|
||||||
|
|
||||||
|
@ -308,12 +308,12 @@ public class Message extends AbstractEntity {
|
||||||
this.trueCounterpart = trueCounterpart;
|
this.trueCounterpart = trueCounterpart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Downloadable getDownloadable() {
|
public Transferable getTransferable() {
|
||||||
return this.downloadable;
|
return this.transferable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDownloadable(Downloadable downloadable) {
|
public void setTransferable(Transferable transferable) {
|
||||||
this.downloadable = downloadable;
|
this.transferable = transferable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Message message) {
|
public boolean equals(Message message) {
|
||||||
|
@ -364,8 +364,8 @@ public class Message extends AbstractEntity {
|
||||||
public boolean mergeable(final Message message) {
|
public boolean mergeable(final Message message) {
|
||||||
return message != null &&
|
return message != null &&
|
||||||
(message.getType() == Message.TYPE_TEXT &&
|
(message.getType() == Message.TYPE_TEXT &&
|
||||||
this.getDownloadable() == null &&
|
this.getTransferable() == null &&
|
||||||
message.getDownloadable() == null &&
|
message.getTransferable() == null &&
|
||||||
message.getEncryption() != Message.ENCRYPTION_PGP &&
|
message.getEncryption() != Message.ENCRYPTION_PGP &&
|
||||||
this.getType() == message.getType() &&
|
this.getType() == message.getType() &&
|
||||||
//this.getStatus() == message.getStatus() &&
|
//this.getStatus() == message.getStatus() &&
|
||||||
|
@ -471,7 +471,7 @@ public class Message extends AbstractEntity {
|
||||||
if (extensionParts.length == 2) {
|
if (extensionParts.length == 2) {
|
||||||
return extensionParts[extensionParts.length - 1];
|
return extensionParts[extensionParts.length - 1];
|
||||||
} else if (extensionParts.length == 3 && Arrays
|
} else if (extensionParts.length == 3 && Arrays
|
||||||
.asList(Downloadable.VALID_CRYPTO_EXTENSIONS)
|
.asList(Transferable.VALID_CRYPTO_EXTENSIONS)
|
||||||
.contains(extensionParts[extensionParts.length - 1])) {
|
.contains(extensionParts[extensionParts.length - 1])) {
|
||||||
return extensionParts[extensionParts.length -2];
|
return extensionParts[extensionParts.length -2];
|
||||||
}
|
}
|
||||||
|
@ -517,8 +517,8 @@ public class Message extends AbstractEntity {
|
||||||
} else {
|
} else {
|
||||||
return Decision.NEVER;
|
return Decision.NEVER;
|
||||||
}
|
}
|
||||||
} else if (Arrays.asList(Downloadable.VALID_IMAGE_EXTENSIONS).contains(extension)
|
} else if (Arrays.asList(Transferable.VALID_IMAGE_EXTENSIONS).contains(extension)
|
||||||
|| Arrays.asList(Downloadable.WELL_KNOWN_EXTENSIONS).contains(extension)) {
|
|| Arrays.asList(Transferable.WELL_KNOWN_EXTENSIONS).contains(extension)) {
|
||||||
return Decision.SHOULD;
|
return Decision.SHOULD;
|
||||||
} else {
|
} else {
|
||||||
return Decision.NEVER;
|
return Decision.NEVER;
|
||||||
|
@ -539,8 +539,8 @@ public class Message extends AbstractEntity {
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
params = new FileParams();
|
params = new FileParams();
|
||||||
if (this.downloadable != null) {
|
if (this.transferable != null) {
|
||||||
params.size = this.downloadable.getFileSize();
|
params.size = this.transferable.getFileSize();
|
||||||
}
|
}
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
return params;
|
return params;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.siacs.conversations.entities;
|
package eu.siacs.conversations.entities;
|
||||||
|
|
||||||
public interface Downloadable {
|
public interface Transferable {
|
||||||
|
|
||||||
String[] VALID_IMAGE_EXTENSIONS = {"webp", "jpeg", "jpg", "png", "jpe"};
|
String[] VALID_IMAGE_EXTENSIONS = {"webp", "jpeg", "jpg", "png", "jpe"};
|
||||||
String[] VALID_CRYPTO_EXTENSIONS = {"pgp", "gpg", "otr"};
|
String[] VALID_CRYPTO_EXTENSIONS = {"pgp", "gpg", "otr"};
|
|
@ -1,10 +1,10 @@
|
||||||
package eu.siacs.conversations.entities;
|
package eu.siacs.conversations.entities;
|
||||||
|
|
||||||
public class DownloadablePlaceholder implements Downloadable {
|
public class TransferablePlaceholder implements Transferable {
|
||||||
|
|
||||||
private int status;
|
private int status;
|
||||||
|
|
||||||
public DownloadablePlaceholder(int status) {
|
public TransferablePlaceholder(int status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
|
@ -5,34 +5,26 @@ import android.net.Uri;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.apache.http.conn.ssl.StrictHostnameVerifier;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.security.KeyManagementException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.net.ssl.HostnameVerifier;
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.SSLHandshakeException;
|
import javax.net.ssl.SSLHandshakeException;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.CryptoHelper;
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
|
|
||||||
public class HttpConnection implements Downloadable {
|
public class HttpConnection implements Transferable {
|
||||||
|
|
||||||
private HttpConnectionManager mHttpConnectionManager;
|
private HttpConnectionManager mHttpConnectionManager;
|
||||||
private XmppConnectionService mXmppConnectionService;
|
private XmppConnectionService mXmppConnectionService;
|
||||||
|
@ -40,7 +32,7 @@ public class HttpConnection implements Downloadable {
|
||||||
private URL mUrl;
|
private URL mUrl;
|
||||||
private Message message;
|
private Message message;
|
||||||
private DownloadableFile file;
|
private DownloadableFile file;
|
||||||
private int mStatus = Downloadable.STATUS_UNKNOWN;
|
private int mStatus = Transferable.STATUS_UNKNOWN;
|
||||||
private boolean acceptedAutomatically = false;
|
private boolean acceptedAutomatically = false;
|
||||||
private int mProgress = 0;
|
private int mProgress = 0;
|
||||||
private long mLastGuiRefresh = 0;
|
private long mLastGuiRefresh = 0;
|
||||||
|
@ -65,12 +57,12 @@ public class HttpConnection implements Downloadable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(Message message) {
|
public void init(Message message) {
|
||||||
init(message,false);
|
init(message, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(Message message, boolean interactive) {
|
public void init(Message message, boolean interactive) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.message.setDownloadable(this);
|
this.message.setTransferable(this);
|
||||||
try {
|
try {
|
||||||
mUrl = new URL(message.getBody());
|
mUrl = new URL(message.getBody());
|
||||||
String[] parts = mUrl.getPath().toLowerCase().split("\\.");
|
String[] parts = mUrl.getPath().toLowerCase().split("\\.");
|
||||||
|
@ -110,7 +102,7 @@ public class HttpConnection implements Downloadable {
|
||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
mHttpConnectionManager.finishConnection(this);
|
mHttpConnectionManager.finishConnection(this);
|
||||||
message.setDownloadable(null);
|
message.setTransferable(null);
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +110,7 @@ public class HttpConnection implements Downloadable {
|
||||||
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||||
intent.setData(Uri.fromFile(file));
|
intent.setData(Uri.fromFile(file));
|
||||||
mXmppConnectionService.sendBroadcast(intent);
|
mXmppConnectionService.sendBroadcast(intent);
|
||||||
message.setDownloadable(null);
|
message.setTransferable(null);
|
||||||
mHttpConnectionManager.finishConnection(this);
|
mHttpConnectionManager.finishConnection(this);
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
if (acceptedAutomatically) {
|
if (acceptedAutomatically) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.persistance.FileBackend;
|
import eu.siacs.conversations.persistance.FileBackend;
|
||||||
|
@ -27,7 +27,7 @@ import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
|
|
||||||
public class HttpUploadConnection implements Downloadable {
|
public class HttpUploadConnection implements Transferable {
|
||||||
|
|
||||||
private HttpConnectionManager mHttpConnectionManager;
|
private HttpConnectionManager mHttpConnectionManager;
|
||||||
private XmppConnectionService mXmppConnectionService;
|
private XmppConnectionService mXmppConnectionService;
|
||||||
|
@ -76,13 +76,13 @@ public class HttpUploadConnection implements Downloadable {
|
||||||
|
|
||||||
private void fail() {
|
private void fail() {
|
||||||
mHttpConnectionManager.finishUploadConnection(this);
|
mHttpConnectionManager.finishUploadConnection(this);
|
||||||
message.setDownloadable(null);
|
message.setTransferable(null);
|
||||||
mXmppConnectionService.markMessage(message,Message.STATUS_SEND_FAILED);
|
mXmppConnectionService.markMessage(message,Message.STATUS_SEND_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(Message message) {
|
public void init(Message message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
message.setDownloadable(this);
|
message.setTransferable(this);
|
||||||
mXmppConnectionService.markMessage(message,Message.STATUS_UNSEND);
|
mXmppConnectionService.markMessage(message,Message.STATUS_UNSEND);
|
||||||
this.account = message.getConversation().getAccount();
|
this.account = message.getConversation().getAccount();
|
||||||
this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
|
this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
|
||||||
|
@ -164,7 +164,7 @@ public class HttpUploadConnection implements Downloadable {
|
||||||
mGetUrl = new URL(mGetUrl.toString() + "#" + CryptoHelper.bytesToHex(key));
|
mGetUrl = new URL(mGetUrl.toString() + "#" + CryptoHelper.bytesToHex(key));
|
||||||
}
|
}
|
||||||
mXmppConnectionService.getFileBackend().updateFileParams(message, mGetUrl);
|
mXmppConnectionService.getFileBackend().updateFileParams(message, mGetUrl);
|
||||||
message.setDownloadable(null);
|
message.setTransferable(null);
|
||||||
message.setCounterpart(message.getConversation().getJid().toBareJid());
|
message.setCounterpart(message.getConversation().getJid().toBareJid());
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
||||||
mXmppConnectionService.getPgpEngine().encrypt(message, new UiCallback<Message>() {
|
mXmppConnectionService.getPgpEngine().encrypt(message, new UiCallback<Message>() {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
@ -80,7 +80,7 @@ public class FileBackend {
|
||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
return new DownloadableFile(path);
|
return new DownloadableFile(path);
|
||||||
} else {
|
} else {
|
||||||
if (Arrays.asList(Downloadable.VALID_IMAGE_EXTENSIONS).contains(extension)) {
|
if (Arrays.asList(Transferable.VALID_IMAGE_EXTENSIONS).contains(extension)) {
|
||||||
return new DownloadableFile(getConversationsFileDirectory() + path);
|
return new DownloadableFile(getConversationsFileDirectory() + path);
|
||||||
} else {
|
} else {
|
||||||
return new DownloadableFile(getConversationsImageDirectory() + path);
|
return new DownloadableFile(getConversationsImageDirectory() + path);
|
||||||
|
|
|
@ -18,7 +18,6 @@ import android.support.v4.app.NotificationCompat.Builder;
|
||||||
import android.support.v4.app.TaskStackBuilder;
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
@ -42,7 +41,6 @@ import eu.siacs.conversations.ui.ManageAccountActivity;
|
||||||
import eu.siacs.conversations.ui.TimePreference;
|
import eu.siacs.conversations.ui.TimePreference;
|
||||||
import eu.siacs.conversations.utils.GeoHelper;
|
import eu.siacs.conversations.utils.GeoHelper;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
|
||||||
|
|
||||||
public class NotificationService {
|
public class NotificationService {
|
||||||
|
|
||||||
|
@ -303,7 +301,7 @@ public class NotificationService {
|
||||||
final ArrayList<Message> tmp = new ArrayList<>();
|
final ArrayList<Message> tmp = new ArrayList<>();
|
||||||
for (final Message msg : messages) {
|
for (final Message msg : messages) {
|
||||||
if (msg.getType() == Message.TYPE_TEXT
|
if (msg.getType() == Message.TYPE_TEXT
|
||||||
&& msg.getDownloadable() == null) {
|
&& msg.getTransferable() == null) {
|
||||||
tmp.add(msg);
|
tmp.add(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +333,7 @@ public class NotificationService {
|
||||||
private Message getImage(final Iterable<Message> messages) {
|
private Message getImage(final Iterable<Message> messages) {
|
||||||
for (final Message message : messages) {
|
for (final Message message : messages) {
|
||||||
if (message.getType() == Message.TYPE_IMAGE
|
if (message.getType() == Message.TYPE_IMAGE
|
||||||
&& message.getDownloadable() == null
|
&& message.getTransferable() == null
|
||||||
&& message.getEncryption() != Message.ENCRYPTION_PGP) {
|
&& message.getEncryption() != Message.ENCRYPTION_PGP) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
@ -346,7 +344,7 @@ public class NotificationService {
|
||||||
private Message getFirstDownloadableMessage(final Iterable<Message> messages) {
|
private Message getFirstDownloadableMessage(final Iterable<Message> messages) {
|
||||||
for (final Message message : messages) {
|
for (final Message message : messages) {
|
||||||
if ((message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) &&
|
if ((message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) &&
|
||||||
message.getDownloadable() != null) {
|
message.getTransferable() != null) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,11 @@ import eu.siacs.conversations.entities.Blockable;
|
||||||
import eu.siacs.conversations.entities.Bookmark;
|
import eu.siacs.conversations.entities.Bookmark;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadablePlaceholder;
|
import eu.siacs.conversations.entities.TransferablePlaceholder;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.entities.MucOptions;
|
import eu.siacs.conversations.entities.MucOptions;
|
||||||
import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
|
import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
|
||||||
import eu.siacs.conversations.entities.Presences;
|
|
||||||
import eu.siacs.conversations.generator.IqGenerator;
|
import eu.siacs.conversations.generator.IqGenerator;
|
||||||
import eu.siacs.conversations.generator.MessageGenerator;
|
import eu.siacs.conversations.generator.MessageGenerator;
|
||||||
import eu.siacs.conversations.generator.PresenceGenerator;
|
import eu.siacs.conversations.generator.PresenceGenerator;
|
||||||
|
@ -975,7 +974,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
@Override
|
@Override
|
||||||
public void onMessageFound(Message message) {
|
public void onMessageFound(Message message) {
|
||||||
if (!getFileBackend().isFileAvailable(message)) {
|
if (!getFileBackend().isFileAvailable(message)) {
|
||||||
message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_DELETED));
|
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -986,7 +985,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
Message message = conversation.findMessageWithFileAndUuid(uuid);
|
Message message = conversation.findMessageWithFileAndUuid(uuid);
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
if (!getFileBackend().isFileAvailable(message)) {
|
if (!getFileBackend().isFileAvailable(message)) {
|
||||||
message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_DELETED));
|
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
|
||||||
updateConversationUi();
|
updateConversationUi();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -45,9 +45,9 @@ import eu.siacs.conversations.crypto.PgpEngine;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.DownloadablePlaceholder;
|
import eu.siacs.conversations.entities.TransferablePlaceholder;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.entities.MucOptions;
|
import eu.siacs.conversations.entities.MucOptions;
|
||||||
import eu.siacs.conversations.entities.Presences;
|
import eu.siacs.conversations.entities.Presences;
|
||||||
|
@ -439,14 +439,14 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
MenuItem downloadFile = menu.findItem(R.id.download_file);
|
MenuItem downloadFile = menu.findItem(R.id.download_file);
|
||||||
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
|
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
|
||||||
if ((m.getType() == Message.TYPE_TEXT || m.getType() == Message.TYPE_PRIVATE)
|
if ((m.getType() == Message.TYPE_TEXT || m.getType() == Message.TYPE_PRIVATE)
|
||||||
&& m.getDownloadable() == null
|
&& m.getTransferable() == null
|
||||||
&& !GeoHelper.isGeoUri(m.getBody())
|
&& !GeoHelper.isGeoUri(m.getBody())
|
||||||
&& m.treatAsDownloadable() != Message.Decision.MUST) {
|
&& m.treatAsDownloadable() != Message.Decision.MUST) {
|
||||||
copyText.setVisible(true);
|
copyText.setVisible(true);
|
||||||
}
|
}
|
||||||
if ((m.getType() != Message.TYPE_TEXT
|
if ((m.getType() != Message.TYPE_TEXT
|
||||||
&& m.getType() != Message.TYPE_PRIVATE
|
&& m.getType() != Message.TYPE_PRIVATE
|
||||||
&& m.getDownloadable() == null)
|
&& m.getTransferable() == null)
|
||||||
|| (GeoHelper.isGeoUri(m.getBody()))) {
|
|| (GeoHelper.isGeoUri(m.getBody()))) {
|
||||||
shareWith.setVisible(true);
|
shareWith.setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -458,11 +458,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
|| m.treatAsDownloadable() == Message.Decision.MUST) {
|
|| m.treatAsDownloadable() == Message.Decision.MUST) {
|
||||||
copyUrl.setVisible(true);
|
copyUrl.setVisible(true);
|
||||||
}
|
}
|
||||||
if (m.getType() == Message.TYPE_TEXT && m.getDownloadable() == null && m.treatAsDownloadable() != Message.Decision.NEVER) {
|
if (m.getType() == Message.TYPE_TEXT && m.getTransferable() == null && m.treatAsDownloadable() != Message.Decision.NEVER) {
|
||||||
downloadFile.setVisible(true);
|
downloadFile.setVisible(true);
|
||||||
downloadFile.setTitle(activity.getString(R.string.download_x_file,UIHelper.getFileDescriptionString(activity, m)));
|
downloadFile.setTitle(activity.getString(R.string.download_x_file,UIHelper.getFileDescriptionString(activity, m)));
|
||||||
}
|
}
|
||||||
if ((m.getDownloadable() != null && !(m.getDownloadable() instanceof DownloadablePlaceholder))
|
if ((m.getTransferable() != null && !(m.getTransferable() instanceof TransferablePlaceholder))
|
||||||
|| (m.isFileOrImage() && (m.getStatus() == Message.STATUS_WAITING
|
|| (m.isFileOrImage() && (m.getStatus() == Message.STATUS_WAITING
|
||||||
|| m.getStatus() == Message.STATUS_OFFERED))) {
|
|| m.getStatus() == Message.STATUS_OFFERED))) {
|
||||||
cancelTransmission.setVisible(true);
|
cancelTransmission.setVisible(true);
|
||||||
|
@ -529,7 +529,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
|
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
|
||||||
message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_DELETED));
|
message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,9 +561,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelTransmission(Message message) {
|
private void cancelTransmission(Message message) {
|
||||||
Downloadable downloadable = message.getDownloadable();
|
Transferable transferable = message.getTransferable();
|
||||||
if (downloadable != null) {
|
if (transferable != null) {
|
||||||
downloadable.cancel();
|
transferable.cancel();
|
||||||
} else {
|
} else {
|
||||||
activity.xmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED);
|
activity.xmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED);
|
||||||
}
|
}
|
||||||
|
@ -757,7 +757,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_PGP
|
if (message.getEncryption() == Message.ENCRYPTION_PGP
|
||||||
&& (message.getStatus() == Message.STATUS_RECEIVED || message
|
&& (message.getStatus() == Message.STATUS_RECEIVED || message
|
||||||
.getStatus() >= Message.STATUS_SEND)
|
.getStatus() >= Message.STATUS_SEND)
|
||||||
&& message.getDownloadable() == null) {
|
&& message.getTransferable() == null) {
|
||||||
if (!mEncryptedMessages.contains(message)) {
|
if (!mEncryptedMessages.contains(message)) {
|
||||||
mEncryptedMessages.add(message);
|
mEncryptedMessages.add(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.concurrent.RejectedExecutionException;
|
||||||
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.ui.ConversationActivity;
|
import eu.siacs.conversations.ui.ConversationActivity;
|
||||||
import eu.siacs.conversations.ui.XmppActivity;
|
import eu.siacs.conversations.ui.XmppActivity;
|
||||||
|
@ -69,8 +69,8 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.getFileParams().width > 0
|
if (message.getFileParams().width > 0
|
||||||
&& (message.getDownloadable() == null
|
&& (message.getTransferable() == null
|
||||||
|| message.getDownloadable().getStatus() != Downloadable.STATUS_DELETED)) {
|
|| message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
|
||||||
mLastMessage.setVisibility(View.GONE);
|
mLastMessage.setVisibility(View.GONE);
|
||||||
imagePreview.setVisibility(View.VISIBLE);
|
imagePreview.setVisibility(View.VISIBLE);
|
||||||
activity.loadBitmap(message, imagePreview);
|
activity.loadBitmap(message, imagePreview);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.entities.Message.FileParams;
|
import eu.siacs.conversations.entities.Message.FileParams;
|
||||||
|
@ -99,14 +99,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
}
|
}
|
||||||
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
|
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
|
||||||
&& message.getMergedStatus() <= Message.STATUS_RECEIVED;
|
&& message.getMergedStatus() <= Message.STATUS_RECEIVED;
|
||||||
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getDownloadable() != null) {
|
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) {
|
||||||
FileParams params = message.getFileParams();
|
FileParams params = message.getFileParams();
|
||||||
if (params.size > (1.5 * 1024 * 1024)) {
|
if (params.size > (1.5 * 1024 * 1024)) {
|
||||||
filesize = params.size / (1024 * 1024)+ " MiB";
|
filesize = params.size / (1024 * 1024)+ " MiB";
|
||||||
} else if (params.size > 0) {
|
} else if (params.size > 0) {
|
||||||
filesize = params.size / 1024 + " KiB";
|
filesize = params.size / 1024 + " KiB";
|
||||||
}
|
}
|
||||||
if (message.getDownloadable() != null && message.getDownloadable().getStatus() == Downloadable.STATUS_FAILED) {
|
if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
info = getContext().getString(R.string.waiting);
|
info = getContext().getString(R.string.waiting);
|
||||||
break;
|
break;
|
||||||
case Message.STATUS_UNSEND:
|
case Message.STATUS_UNSEND:
|
||||||
Downloadable d = message.getDownloadable();
|
Transferable d = message.getTransferable();
|
||||||
if (d!=null) {
|
if (d!=null) {
|
||||||
info = getContext().getString(R.string.sending_file,d.getProgress());
|
info = getContext().getString(R.string.sending_file,d.getProgress());
|
||||||
} else {
|
} else {
|
||||||
|
@ -482,11 +482,11 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final Downloadable downloadable = message.getDownloadable();
|
final Transferable transferable = message.getTransferable();
|
||||||
if (downloadable != null && downloadable.getStatus() != Downloadable.STATUS_UPLOADING) {
|
if (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING) {
|
||||||
if (downloadable.getStatus() == Downloadable.STATUS_OFFER) {
|
if (transferable.getStatus() == Transferable.STATUS_OFFER) {
|
||||||
displayDownloadableMessage(viewHolder,message,activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)));
|
displayDownloadableMessage(viewHolder,message,activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)));
|
||||||
} else if (downloadable.getStatus() == Downloadable.STATUS_OFFER_CHECK_FILESIZE) {
|
} else if (transferable.getStatus() == Transferable.STATUS_OFFER_CHECK_FILESIZE) {
|
||||||
displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)));
|
displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)));
|
||||||
} else {
|
} else {
|
||||||
displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first);
|
displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first);
|
||||||
|
@ -536,9 +536,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDownloadable(Message message) {
|
public void startDownloadable(Message message) {
|
||||||
Downloadable downloadable = message.getDownloadable();
|
Transferable transferable = message.getTransferable();
|
||||||
if (downloadable != null) {
|
if (transferable != null) {
|
||||||
if (!downloadable.start()) {
|
if (!transferable.start()) {
|
||||||
Toast.makeText(activity, R.string.not_connected_try_again,
|
Toast.makeText(activity, R.string.not_connected_try_again,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.siacs.conversations.utils;
|
package eu.siacs.conversations.utils;
|
||||||
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -10,7 +9,7 @@ import java.util.Locale;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
|
|
||||||
|
@ -142,24 +141,24 @@ public class UIHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pair<String,Boolean> getMessagePreview(final Context context, final Message message) {
|
public static Pair<String,Boolean> getMessagePreview(final Context context, final Message message) {
|
||||||
final Downloadable d = message.getDownloadable();
|
final Transferable d = message.getTransferable();
|
||||||
if (d != null ) {
|
if (d != null ) {
|
||||||
switch (d.getStatus()) {
|
switch (d.getStatus()) {
|
||||||
case Downloadable.STATUS_CHECKING:
|
case Transferable.STATUS_CHECKING:
|
||||||
return new Pair<>(context.getString(R.string.checking_image),true);
|
return new Pair<>(context.getString(R.string.checking_image),true);
|
||||||
case Downloadable.STATUS_DOWNLOADING:
|
case Transferable.STATUS_DOWNLOADING:
|
||||||
return new Pair<>(context.getString(R.string.receiving_x_file,
|
return new Pair<>(context.getString(R.string.receiving_x_file,
|
||||||
getFileDescriptionString(context,message),
|
getFileDescriptionString(context,message),
|
||||||
d.getProgress()),true);
|
d.getProgress()),true);
|
||||||
case Downloadable.STATUS_OFFER:
|
case Transferable.STATUS_OFFER:
|
||||||
case Downloadable.STATUS_OFFER_CHECK_FILESIZE:
|
case Transferable.STATUS_OFFER_CHECK_FILESIZE:
|
||||||
return new Pair<>(context.getString(R.string.x_file_offered_for_download,
|
return new Pair<>(context.getString(R.string.x_file_offered_for_download,
|
||||||
getFileDescriptionString(context,message)),true);
|
getFileDescriptionString(context,message)),true);
|
||||||
case Downloadable.STATUS_DELETED:
|
case Transferable.STATUS_DELETED:
|
||||||
return new Pair<>(context.getString(R.string.file_deleted),true);
|
return new Pair<>(context.getString(R.string.file_deleted),true);
|
||||||
case Downloadable.STATUS_FAILED:
|
case Transferable.STATUS_FAILED:
|
||||||
return new Pair<>(context.getString(R.string.file_transmission_failed),true);
|
return new Pair<>(context.getString(R.string.file_transmission_failed),true);
|
||||||
case Downloadable.STATUS_UPLOADING:
|
case Transferable.STATUS_UPLOADING:
|
||||||
if (message.getStatus() == Message.STATUS_OFFERED) {
|
if (message.getStatus() == Message.STATUS_OFFERED) {
|
||||||
return new Pair<>(context.getString(R.string.offering_x_file,
|
return new Pair<>(context.getString(R.string.offering_x_file,
|
||||||
getFileDescriptionString(context, message)), true);
|
getFileDescriptionString(context, message)), true);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package eu.siacs.conversations.xmpp.jingle;
|
package eu.siacs.conversations.xmpp.jingle;
|
||||||
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -16,9 +15,9 @@ import android.util.Log;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.DownloadablePlaceholder;
|
import eu.siacs.conversations.entities.TransferablePlaceholder;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
@ -29,7 +28,7 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
|
||||||
import eu.siacs.conversations.xmpp.jingle.stanzas.Reason;
|
import eu.siacs.conversations.xmpp.jingle.stanzas.Reason;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
|
|
||||||
public class JingleConnection implements Downloadable {
|
public class JingleConnection implements Transferable {
|
||||||
|
|
||||||
private JingleConnectionManager mJingleConnectionManager;
|
private JingleConnectionManager mJingleConnectionManager;
|
||||||
private XmppConnectionService mXmppConnectionService;
|
private XmppConnectionService mXmppConnectionService;
|
||||||
|
@ -43,7 +42,7 @@ public class JingleConnection implements Downloadable {
|
||||||
private int ibbBlockSize = 4096;
|
private int ibbBlockSize = 4096;
|
||||||
|
|
||||||
private int mJingleStatus = -1;
|
private int mJingleStatus = -1;
|
||||||
private int mStatus = Downloadable.STATUS_UNKNOWN;
|
private int mStatus = Transferable.STATUS_UNKNOWN;
|
||||||
private Message message;
|
private Message message;
|
||||||
private String sessionId;
|
private String sessionId;
|
||||||
private Account account;
|
private Account account;
|
||||||
|
@ -199,8 +198,8 @@ public class JingleConnection implements Downloadable {
|
||||||
this.contentCreator = "initiator";
|
this.contentCreator = "initiator";
|
||||||
this.contentName = this.mJingleConnectionManager.nextRandomId();
|
this.contentName = this.mJingleConnectionManager.nextRandomId();
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.message.setDownloadable(this);
|
this.message.setTransferable(this);
|
||||||
this.mStatus = Downloadable.STATUS_UPLOADING;
|
this.mStatus = Transferable.STATUS_UPLOADING;
|
||||||
this.account = message.getConversation().getAccount();
|
this.account = message.getConversation().getAccount();
|
||||||
this.initiator = this.account.getJid();
|
this.initiator = this.account.getJid();
|
||||||
this.responder = this.message.getCounterpart();
|
this.responder = this.message.getCounterpart();
|
||||||
|
@ -256,8 +255,8 @@ public class JingleConnection implements Downloadable {
|
||||||
packet.getFrom().toBareJid(), false);
|
packet.getFrom().toBareJid(), false);
|
||||||
this.message = new Message(conversation, "", Message.ENCRYPTION_NONE);
|
this.message = new Message(conversation, "", Message.ENCRYPTION_NONE);
|
||||||
this.message.setStatus(Message.STATUS_RECEIVED);
|
this.message.setStatus(Message.STATUS_RECEIVED);
|
||||||
this.mStatus = Downloadable.STATUS_OFFER;
|
this.mStatus = Transferable.STATUS_OFFER;
|
||||||
this.message.setDownloadable(this);
|
this.message.setTransferable(this);
|
||||||
final Jid from = packet.getFrom();
|
final Jid from = packet.getFrom();
|
||||||
this.message.setCounterpart(from);
|
this.message.setCounterpart(from);
|
||||||
this.account = account;
|
this.account = account;
|
||||||
|
@ -408,7 +407,7 @@ public class JingleConnection implements Downloadable {
|
||||||
|
|
||||||
private void sendAccept() {
|
private void sendAccept() {
|
||||||
mJingleStatus = JINGLE_STATUS_ACCEPTED;
|
mJingleStatus = JINGLE_STATUS_ACCEPTED;
|
||||||
this.mStatus = Downloadable.STATUS_DOWNLOADING;
|
this.mStatus = Transferable.STATUS_DOWNLOADING;
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
this.mJingleConnectionManager.getPrimaryCandidate(this.account, new OnPrimaryCandidateFound() {
|
this.mJingleConnectionManager.getPrimaryCandidate(this.account, new OnPrimaryCandidateFound() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -639,7 +638,7 @@ public class JingleConnection implements Downloadable {
|
||||||
this.disconnectSocks5Connections();
|
this.disconnectSocks5Connections();
|
||||||
this.mJingleStatus = JINGLE_STATUS_FINISHED;
|
this.mJingleStatus = JINGLE_STATUS_FINISHED;
|
||||||
this.message.setStatus(Message.STATUS_RECEIVED);
|
this.message.setStatus(Message.STATUS_RECEIVED);
|
||||||
this.message.setDownloadable(null);
|
this.message.setTransferable(null);
|
||||||
this.mXmppConnectionService.updateMessage(message);
|
this.mXmppConnectionService.updateMessage(message);
|
||||||
this.mJingleConnectionManager.finishConnection(this);
|
this.mJingleConnectionManager.finishConnection(this);
|
||||||
}
|
}
|
||||||
|
@ -716,7 +715,7 @@ public class JingleConnection implements Downloadable {
|
||||||
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
|
if (this.transport != null && this.transport instanceof JingleInbandTransport) {
|
||||||
this.transport.disconnect();
|
this.transport.disconnect();
|
||||||
}
|
}
|
||||||
this.message.setDownloadable(null);
|
this.message.setTransferable(null);
|
||||||
this.mJingleConnectionManager.finishConnection(this);
|
this.mJingleConnectionManager.finishConnection(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +727,7 @@ public class JingleConnection implements Downloadable {
|
||||||
this.sendCancel();
|
this.sendCancel();
|
||||||
this.mJingleConnectionManager.finishConnection(this);
|
this.mJingleConnectionManager.finishConnection(this);
|
||||||
if (this.responder.equals(account.getJid())) {
|
if (this.responder.equals(account.getJid())) {
|
||||||
this.message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_FAILED));
|
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
|
||||||
if (this.file!=null) {
|
if (this.file!=null) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
@ -736,7 +735,7 @@ public class JingleConnection implements Downloadable {
|
||||||
} else {
|
} else {
|
||||||
this.mXmppConnectionService.markMessage(this.message,
|
this.mXmppConnectionService.markMessage(this.message,
|
||||||
Message.STATUS_SEND_FAILED);
|
Message.STATUS_SEND_FAILED);
|
||||||
this.message.setDownloadable(null);
|
this.message.setTransferable(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +747,7 @@ public class JingleConnection implements Downloadable {
|
||||||
}
|
}
|
||||||
if (this.message != null) {
|
if (this.message != null) {
|
||||||
if (this.responder.equals(account.getJid())) {
|
if (this.responder.equals(account.getJid())) {
|
||||||
this.message.setDownloadable(new DownloadablePlaceholder(Downloadable.STATUS_FAILED));
|
this.message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_FAILED));
|
||||||
if (this.file!=null) {
|
if (this.file!=null) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
@ -756,7 +755,7 @@ public class JingleConnection implements Downloadable {
|
||||||
} else {
|
} else {
|
||||||
this.mXmppConnectionService.markMessage(this.message,
|
this.mXmppConnectionService.markMessage(this.message,
|
||||||
Message.STATUS_SEND_FAILED);
|
Message.STATUS_SEND_FAILED);
|
||||||
this.message.setDownloadable(null);
|
this.message.setTransferable(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mJingleConnectionManager.finishConnection(this);
|
this.mJingleConnectionManager.finishConnection(this);
|
||||||
|
|
|
@ -9,14 +9,13 @@ import android.annotation.SuppressLint;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.services.AbstractConnectionManager;
|
import eu.siacs.conversations.services.AbstractConnectionManager;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.utils.Xmlns;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
|
import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
|
@ -59,7 +58,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public JingleConnection createNewConnection(Message message) {
|
public JingleConnection createNewConnection(Message message) {
|
||||||
Downloadable old = message.getDownloadable();
|
Transferable old = message.getTransferable();
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
old.cancel();
|
old.cancel();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue