diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0170b0066..e941ed6dc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -281,5 +281,6 @@
Message text
URL copied to clipboard
Message copied to clipboard
+ Image transmission failed
\ No newline at end of file
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java
index dd88c1261..8a83c465c 100644
--- a/src/eu/siacs/conversations/entities/Message.java
+++ b/src/eu/siacs/conversations/entities/Message.java
@@ -16,7 +16,6 @@ public class Message extends AbstractEntity {
public static final int STATUS_UNSEND = 1;
public static final int STATUS_SEND = 2;
public static final int STATUS_SEND_FAILED = 3;
- public static final int STATUS_SEND_REJECTED = 4;
public static final int STATUS_WAITING = 5;
public static final int STATUS_OFFERED = 6;
public static final int STATUS_SEND_RECEIVED = 7;
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java
index bb72711bb..20eeeb300 100644
--- a/src/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/eu/siacs/conversations/ui/ConversationFragment.java
@@ -11,7 +11,6 @@ import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
-import eu.siacs.conversations.entities.Downloadable;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.Presences;
diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 2b4263e87..a24f90d7b 100644
--- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -100,6 +100,9 @@ public class MessageAdapter extends ArrayAdapter {
if (params.size != 0) {
filesize = params.size / 1024 + " KB";
}
+ if (message.getDownloadable() != null && message.getDownloadable().getStatus() == Downloadable.STATUS_FAILED) {
+ error = true;
+ }
}
switch (message.getMergedStatus()) {
case Message.STATUS_WAITING:
@@ -125,10 +128,6 @@ public class MessageAdapter extends ArrayAdapter {
info = getContext().getString(R.string.send_failed);
error = true;
break;
- case Message.STATUS_SEND_REJECTED:
- info = getContext().getString(R.string.send_rejected);
- error = true;
- break;
default:
if (multiReceived) {
Contact contact = message.getContact();
@@ -484,6 +483,8 @@ public class MessageAdapter extends ArrayAdapter {
&& d.getStatus() == Downloadable.STATUS_OFFER_CHECK_FILESIZE) {
displayDownloadableMessage(viewHolder, item,
R.string.check_image_filesize);
+ } else if (d != null && d.getStatus() == Downloadable.STATUS_FAILED) {
+ displayInfoMessage(viewHolder, R.string.image_transmission_failed);
} else if ((item.getEncryption() == Message.ENCRYPTION_DECRYPTED)
|| (item.getEncryption() == Message.ENCRYPTION_NONE)
|| (item.getEncryption() == Message.ENCRYPTION_OTR)) {
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index 7e803f0b6..6b9ca9aa7 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -73,11 +73,7 @@ public class JingleConnection implements Downloadable {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE_ERROR) {
- if (initiator.equals(account.getFullJid())) {
- mXmppConnectionService.markMessage(message,
- Message.STATUS_SEND_FAILED);
- }
- mJingleStatus = JINGLE_STATUS_FAILED;
+ cancel();
}
}
};
@@ -354,6 +350,7 @@ public class JingleConnection implements Downloadable {
}
private void sendInitRequest() {
+ this.mXmppConnectionService.markMessage(this.message, Message.STATUS_OFFERED);
JinglePacket packet = this.bootstrapPacket("session-initiate");
Content content = new Content(this.contentCreator, this.contentName);
if (message.getType() == Message.TYPE_IMAGE) {
@@ -716,13 +713,8 @@ public class JingleConnection implements Downloadable {
this.mStatus = Downloadable.STATUS_FAILED;
this.mXmppConnectionService.updateConversationUi();
} else {
- if (this.mJingleStatus == JINGLE_STATUS_INITIATED) {
- this.mXmppConnectionService.markMessage(this.message,
- Message.STATUS_SEND_REJECTED);
- } else {
- this.mXmppConnectionService.markMessage(this.message,
- Message.STATUS_SEND_FAILED);
- }
+ this.mXmppConnectionService.markMessage(this.message,
+ Message.STATUS_SEND_FAILED);
}
}
this.mJingleConnectionManager.finishConnection(this);
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
index 1e7c84d45..d937146ae 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
@@ -44,8 +44,13 @@ public class JingleConnectionManager extends AbstractConnectionManager {
return;
}
}
- account.getXmppConnection().sendIqPacket(
- packet.generateRespone(IqPacket.TYPE_ERROR), null);
+ IqPacket response = packet.generateRespone(IqPacket.TYPE_ERROR);
+ Element error = response.addChild("error");
+ error.setAttribute("type", "cancel");
+ error.addChild("item-not-found",
+ "urn:ietf:params:xml:ns:xmpp-stanzas");
+ error.addChild("unknown-session", "urn:xmpp:jingle:errors:1");
+ account.getXmppConnection().sendIqPacket(response, null);
}
}