aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-08 14:08:59 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-08 14:08:59 +0200
commit5cb11396f662252ff294f6cda719877e0473bac4 (patch)
treef6a95361e2ec442c5276bfe13a05e8cba65492a1
parent58953e6193b25ca9fd7624954ef7cb986e43b3da (diff)
fixed sending offline pgp messages
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/eu/siacs/conversations/entities/Message.java2
-rw-r--r--src/eu/siacs/conversations/generator/MessageGenerator.java3
-rw-r--r--src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java14
4 files changed, 12 insertions, 9 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3aa30e40..b6253060 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 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("");
}