From 007c9ddcb0c49733522688c4d2364d1a4ab9ec8e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 30 Mar 2016 06:56:44 -0400
Subject: [PATCH] Enigma: Handle messages with text before an encrypted block (#5149)

---
 plugins/enigma/lib/enigma_ui.php |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php
index ca28c32..6ae69da 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -791,6 +791,10 @@
                     $msg = rcube::Q($this->enigma->gettext('decrypterror'));
                 }
             }
+            else if ($status === enigma_engine::ENCRYPTED_PARTIALLY) {
+                $attrib['class'] = 'enigmawarning';
+                $msg = rcube::Q($this->enigma->gettext('decryptpartial'));
+            }
             else {
                 $attrib['class'] = 'enigmanotice';
                 $msg = rcube::Q($this->enigma->gettext('decryptok'));
@@ -821,8 +825,9 @@
                     $msg = rcube::Q($msg);
                 }
                 else if ($sig->valid) {
-                    $attrib['class'] = 'enigmanotice';
-                    $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext('sigvalid')));
+                    $attrib['class'] = $sig->partial ? 'enigmawarning' : 'enigmanotice';
+                    $label = 'sigvalid' . ($sig->partial ? 'partial' : '');
+                    $msg = rcube::Q(str_replace('$sender', $sender, $this->enigma->gettext($label)));
                 }
                 else {
                     $attrib['class'] = 'enigmawarning';

--
Gitblit v1.9.1