diff options
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-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; |