diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-09-08 14:08:59 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-09-08 14:08:59 +0200 |
commit | 5cb11396f662252ff294f6cda719877e0473bac4 (patch) | |
tree | f6a95361e2ec442c5276bfe13a05e8cba65492a1 /src/eu/siacs | |
parent | 58953e6193b25ca9fd7624954ef7cb986e43b3da (diff) |
fixed sending offline pgp messages
Diffstat (limited to 'src/eu/siacs')
3 files changed, 11 insertions, 8 deletions
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index 2b76773b..d70374a9 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 ea53432c..ecfb4744 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 6eb9846a..648c6620 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(""); } |