Skip to content

Commit

Permalink
fixed sending offline pgp messages
Browse files Browse the repository at this point in the history
  • Loading branch information
iNPUTmice committed Sep 8, 2014
1 parent 58953e6 commit 5cb1139
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions src/eu/siacs/conversations/entities/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public String getBody() {
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) {
Expand Down
3 changes: 2 additions & 1 deletion src/eu/siacs/conversations/generator/MessageGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public MessagePacket generatePgpChat(Message message, boolean addDelay) {
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;
}
Expand Down
14 changes: 7 additions & 7 deletions src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ public View getView(int position, View view, ViewGroup parent) {

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);
Expand All @@ -83,11 +85,9 @@ public View getView(int position, View view, ViewGroup parent) {
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("");
}
Expand Down

0 comments on commit 5cb1139

Please sign in to comment.