aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-29 11:31:03 +0100
committeriNPUTmice <daniel@gultsch.de>2014-10-29 11:31:03 +0100
commit03593ba56fe0a15312e3ae231dfdaf3be6c7548a (patch)
treef3ca3a45423f3730fe530836a4e517c216d888b4
parent64209829f779214ae7fc0c6ab35de4d006c745c4 (diff)
proper error state for images
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/eu/siacs/conversations/entities/Message.java1
-rw-r--r--src/eu/siacs/conversations/ui/ConversationFragment.java1
-rw-r--r--src/eu/siacs/conversations/ui/adapter/MessageAdapter.java9
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java16
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java9
6 files changed, 17 insertions, 20 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0170b006..e941ed6d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -281,5 +281,6 @@
<string name="message_text">Message text</string>
<string name="url_copied_to_clipboard">URL copied to clipboard</string>
<string name="message_copied_to_clipboard">Message copied to clipboard</string>
+ <string name="image_transmission_failed">Image transmission failed</string>
</resources> \ 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 dd88c126..8a83c465 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 bb72711b..20eeeb30 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 2b4263e8..a24f90d7 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<Message> {
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<Message> {
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<Message> {
&& 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 7e803f0b..6b9ca9aa 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 1e7c84d4..d937146a 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);
}
}