aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu')
-rw-r--r--src/eu/siacs/conversations/crypto/OtrEngine.java16
-rw-r--r--src/eu/siacs/conversations/entities/Downloadable.java5
-rw-r--r--src/eu/siacs/conversations/entities/Message.java13
-rw-r--r--src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java5
-rw-r--r--src/eu/siacs/conversations/ui/adapter/MessageAdapter.java13
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java7
6 files changed, 20 insertions, 39 deletions
diff --git a/src/eu/siacs/conversations/crypto/OtrEngine.java b/src/eu/siacs/conversations/crypto/OtrEngine.java
index 07430140..46dd714f 100644
--- a/src/eu/siacs/conversations/crypto/OtrEngine.java
+++ b/src/eu/siacs/conversations/crypto/OtrEngine.java
@@ -174,21 +174,7 @@ public class OtrEngine implements OtrEngineHost {
@Override
public void messageFromAnotherInstanceReceived(SessionID id) {
- String jid = id.getAccountID();
- Conversation conversation = mXmppConnectionService
- .findOrCreateConversation(account, jid, false);
- Message error = new Message(conversation, null, Message.ENCRYPTION_OTR);
- conversation.getMessages().add(error);
- error.setStatus(Message.STATUS_RECEPTION_FAILED);
- mXmppConnectionService.databaseBackend.createMessage(error);
- SessionImpl session = conversation.getOtrSession();
- if (session != null
- && session.getSessionStatus() != SessionStatus.ENCRYPTED) {
- try {
- session.startSession();
- } catch (OtrException e) {
- }
- }
+ Log.d(Config.LOGTAG,"unreadable message received from "+id.getAccountID());
}
@Override
diff --git a/src/eu/siacs/conversations/entities/Downloadable.java b/src/eu/siacs/conversations/entities/Downloadable.java
new file mode 100644
index 00000000..8fb4977e
--- /dev/null
+++ b/src/eu/siacs/conversations/entities/Downloadable.java
@@ -0,0 +1,5 @@
+package eu.siacs.conversations.entities;
+
+public interface Downloadable {
+ public void start();
+}
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java
index d70374a9..5cbd68dd 100644
--- a/src/eu/siacs/conversations/entities/Message.java
+++ b/src/eu/siacs/conversations/entities/Message.java
@@ -2,7 +2,6 @@ package eu.siacs.conversations.entities;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
-import eu.siacs.conversations.xmpp.jingle.JingleConnection;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
@@ -60,7 +59,7 @@ public class Message extends AbstractEntity {
protected transient Conversation conversation = null;
- protected transient JingleConnection jingleConnection = null;
+ protected transient Downloadable downloadable = null;
private Message() {
@@ -151,8 +150,6 @@ public class Message extends AbstractEntity {
public String getReadableBody(Context context) {
if ((encryption == ENCRYPTION_PGP) && (type == TYPE_TEXT)) {
return context.getText(R.string.encrypted_message_received).toString();
- } else if (encryption == ENCRYPTION_OTR && type == TYPE_TEXT && status == STATUS_RECEPTION_FAILED) {
- return context.getText(R.string.unable_to_decrypt_otr_message).toString();
} else if ((encryption == ENCRYPTION_OTR) && (type == TYPE_IMAGE)) {
return context.getText(R.string.encrypted_image_received).toString();
} else if (encryption == ENCRYPTION_DECRYPTION_FAILED) {
@@ -270,12 +267,12 @@ public class Message extends AbstractEntity {
}
}
- public void setJingleConnection(JingleConnection connection) {
- this.jingleConnection = connection;
+ public void setDownloadable(Downloadable downloadable) {
+ this.downloadable = downloadable;
}
- public JingleConnection getJingleConnection() {
- return this.jingleConnection;
+ public Downloadable getDownloadable() {
+ return this.downloadable;
}
public static Message createStatusMessage(Conversation conversation) {
diff --git a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
index 648c6620..bfcba135 100644
--- a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
@@ -62,10 +62,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
if (latestMessage.getType() == Message.TYPE_TEXT
|| latestMessage.getType() == Message.TYPE_PRIVATE) {
- if (latestMessage.getEncryption() == Message.ENCRYPTION_OTR
- && latestMessage.getStatus() == Message.STATUS_RECEPTION_FAILED) {
- convLastMsg.setText(R.string.unable_to_decrypt_otr_message);
- } else if ((latestMessage.getEncryption() != Message.ENCRYPTION_PGP)
+ if ((latestMessage.getEncryption() != Message.ENCRYPTION_PGP)
&& (latestMessage.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED)) {
String body = Config.PARSE_EMOTICONS ? UIHelper
.transformAsciiEmoticons(latestMessage.getBody())
diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 074e38fb..1abd208d 100644
--- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -7,6 +7,7 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
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.ui.ConversationActivity;
import eu.siacs.conversations.utils.UIHelper;
@@ -461,10 +462,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
@Override
public void onClick(View v) {
- JingleConnection connection = item
- .getJingleConnection();
- if (connection != null) {
- connection.accept();
+ Downloadable downloadable = item.getDownloadable();
+ if (downloadable != null) {
+ downloadable.start();
}
}
});
@@ -495,11 +495,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
} else if (item.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
displayDecryptionFailed(viewHolder);
- } else if (item.getEncryption() == Message.ENCRYPTION_OTR
- && item.getStatus() == Message.STATUS_RECEPTION_FAILED
- && item.getType() == Message.TYPE_TEXT) {
- displayInfoMessage(viewHolder,
- R.string.unable_to_decrypt_otr_message);
} else {
displayTextMessage(viewHolder, item);
}
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index a5cc2c49..e26fcad9 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -15,6 +15,7 @@ import android.util.Log;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation;
+import eu.siacs.conversations.entities.Downloadable;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element;
@@ -24,7 +25,7 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
import eu.siacs.conversations.xmpp.jingle.stanzas.Reason;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
-public class JingleConnection {
+public class JingleConnection implements Downloadable {
private final String[] extensions = { "webp", "jpeg", "jpg", "png" };
private final String[] cryptoExtensions = { "pgp", "gpg", "otr" };
@@ -259,7 +260,7 @@ public class JingleConnection {
this.message = new Message(conversation, "", Message.ENCRYPTION_NONE);
this.message.setType(Message.TYPE_IMAGE);
this.message.setStatus(Message.STATUS_RECEIVED_OFFER);
- this.message.setJingleConnection(this);
+ this.message.setDownloadable(this);
String[] fromParts = packet.getFrom().split("/");
this.message.setPresence(fromParts[1]);
this.account = account;
@@ -866,7 +867,7 @@ public class JingleConnection {
return this.transport;
}
- public void accept() {
+ public void start() {
if (status == STATUS_INITIATED) {
new Thread(new Runnable() {