diff options
author | Beriain <beriain@bitmessage.ch> | 2014-05-12 17:09:32 +0200 |
---|---|---|
committer | Beriain <beriain@bitmessage.ch> | 2014-05-12 17:09:32 +0200 |
commit | 75f7695087355978a236a701283a86bacdd8a54c (patch) | |
tree | 516c1262b83a4a4ae5240a8451c10c79eb31584c /src/eu/siacs/conversations/entities/Message.java | |
parent | 42c07bf4ae83a4bc51664fdf35f02b917b57baa4 (diff) | |
parent | 4be8280beb9c61e4a11b67b61617455dbe52b466 (diff) |
Merge https://github.com/siacs/Conversations into development
Diffstat (limited to 'src/eu/siacs/conversations/entities/Message.java')
-rw-r--r-- | src/eu/siacs/conversations/entities/Message.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index a17d552f..33f7a8d4 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -1,7 +1,9 @@ package eu.siacs.conversations.entities; +import eu.siacs.conversations.R; import eu.siacs.conversations.xmpp.jingle.JingleConnection; import android.content.ContentValues; +import android.content.Context; import android.database.Cursor; public class Message extends AbstractEntity { @@ -103,6 +105,20 @@ public class Message extends AbstractEntity { public String getBody() { return body; } + + public String getReadableBody(Context context) { + if ((encryption == ENCRYPTION_PGP)&&(type == TYPE_TEXT)) { + return ""+context.getText(R.string.encrypted_message_received); + } else if ((encryption == ENCRYPTION_OTR)&&(type == TYPE_IMAGE)) { + return ""+context.getText(R.string.encrypted_image_received); + } else if (encryption == ENCRYPTION_DECRYPTION_FAILED) { + return ""+context.getText(R.string.decryption_failed); + } else if (type == TYPE_IMAGE) { + return ""+context.getText(R.string.image_file); + } else { + return body.trim(); + } + } public long getTimeSent() { return timeSent; |