diff options
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/eu/siacs/conversations/entities/Message.java | 2 | ||||
-rw-r--r-- | src/eu/siacs/conversations/generator/MessageGenerator.java | 3 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 14 |
4 files changed, 12 insertions, 9 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 3aa30e40e..b62530606 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -240,7 +240,7 @@ <string name="missing_presence_updates">Missing presence updates from contact</string> <string name="request_presence_updates">Please request presence updates from your contact first.\n\n<small>This will be used to determine what client(s) your contact is using.</small></string> <string name="request_now">Request now</string> - <string name="unable_to_decrypt_otr_message">Unable to decrypt OTR message</string> + <string name="unable_to_decrypt_otr_message"><i>Unable to decrypt OTR message</i></string> <string name="delete_fingerprint">Delete Fingerprint</string> <string name="sure_delete_fingerprint">Are you sure you would like to delete this fingerprint?</string> <string name="ignore">Ignore</string> diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index 2b76773b8..d70374a93 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -151,6 +151,8 @@ 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) { diff --git a/src/eu/siacs/conversations/generator/MessageGenerator.java b/src/eu/siacs/conversations/generator/MessageGenerator.java index ea53432cd..ecfb4744b 100644 --- a/src/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/eu/siacs/conversations/generator/MessageGenerator.java @@ -87,7 +87,8 @@ public class MessageGenerator { packet.addChild("x", "jabber:x:encrypted").setContent( message.getEncryptedBody()); } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { - packet.setBody(message.getBody()); + packet.addChild("x", "jabber:x:encrypted").setContent( + message.getBody()); } return packet; } diff --git a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 6eb9846ad..648c6620d 100644 --- a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -62,15 +62,17 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { if (latestMessage.getType() == Message.TYPE_TEXT || latestMessage.getType() == Message.TYPE_PRIVATE) { - if ((latestMessage.getEncryption() != Message.ENCRYPTION_PGP) + 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) && (latestMessage.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED)) { String body = Config.PARSE_EMOTICONS ? UIHelper .transformAsciiEmoticons(latestMessage.getBody()) : latestMessage.getBody(); convLastMsg.setText(body); } else { - convLastMsg.setText(activity - .getText(R.string.encrypted_message_received)); + convLastMsg.setText(R.string.encrypted_message_received); } convLastMsg.setVisibility(View.VISIBLE); imagePreview.setVisibility(View.GONE); @@ -83,11 +85,9 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { convLastMsg.setVisibility(View.VISIBLE); imagePreview.setVisibility(View.GONE); if (latestMessage.getStatus() == Message.STATUS_RECEIVED_OFFER) { - convLastMsg.setText(activity - .getText(R.string.image_offered_for_download)); + convLastMsg.setText(R.string.image_offered_for_download); } else if (latestMessage.getStatus() == Message.STATUS_RECEIVING) { - convLastMsg.setText(activity - .getText(R.string.receiving_image)); + convLastMsg.setText(R.string.receiving_image); } else { convLastMsg.setText(""); } |