From ced34cb15e095836767971aa4d27b141fb1d7ec9 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 18 Oct 2014 08:47:54 -0400
Subject: [PATCH] Merge pull request #230 from bytesatwork-xx/master

---
 plugins/enigma/enigma.php |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php
index 1194d26..870b923 100644
--- a/plugins/enigma/enigma.php
+++ b/plugins/enigma/enigma.php
@@ -149,7 +149,7 @@
      */
     function parse_structure($p)
     {
-        $struct = $p['structure'];
+//        $struct = $p['structure'];
 
         if ($p['mimetype'] == 'text/plain' || $p['mimetype'] == 'application/pgp') {
             $this->parse_plain($p);
@@ -179,10 +179,11 @@
     {
         // add labels
         $this->add_texts('localization/');
-
+/*
         $p['list']['enigmasettings'] = array(
             'id' => 'enigmasettings', 'section' => $this->gettext('enigmasettings'),
         );
+*/
         $p['list']['enigmacerts'] = array(
             'id' => 'enigmacerts', 'section' => $this->gettext('enigmacerts'),
         );
@@ -203,11 +204,13 @@
      */
     function preferences_list($p)
     {
+/*
         if ($p['section'] == 'enigmasettings') {
             // This makes that section is not removed from the list
             $p['blocks']['dummy']['options']['dummy'] = array();
         }
-        else if ($p['section'] == 'enigmacerts') {
+        else */
+        if ($p['section'] == 'enigmacerts') {
             // This makes that section is not removed from the list
             $p['blocks']['dummy']['options']['dummy'] = array();
         }
@@ -313,18 +316,24 @@
             $attrib['id'] = 'enigma-message';
 
             if ($sig instanceof enigma_signature) {
-                if ($sig->valid) {
+                $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>';
+
+                if ($sig->valid === enigma_error::E_UNVERIFIED) {
+                    $attrib['class'] = 'enigmawarning';
+                    $msg = str_replace('$sender', $sender, $this->gettext('sigunverified'));
+                    $msg = str_replace('$keyid', $sig->id, $msg);
+                    $msg = rcube::Q($msg);
+                }
+                else if ($sig->valid) {
                     $attrib['class'] = 'enigmanotice';
-                    $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>';
                     $msg = rcube::Q(str_replace('$sender', $sender, $this->gettext('sigvalid')));
                 }
                 else {
                     $attrib['class'] = 'enigmawarning';
-                    $sender = ($sig->name ? $sig->name . ' ' : '') . '<' . $sig->email . '>';
                     $msg = rcube::Q(str_replace('$sender', $sender, $this->gettext('siginvalid')));
                 }
             }
-            else if ($sig->getCode() == enigma_error::E_KEYNOTFOUND) {
+            else if ($sig && $sig->getCode() == enigma_error::E_KEYNOTFOUND) {
                 $attrib['class'] = 'enigmawarning';
                 $msg = rcube::Q(str_replace('$keyid', enigma_key::format_id($sig->getData('id')),
                     $this->gettext('signokey')));
@@ -391,7 +400,7 @@
     function message_load($p)
     {
         $this->message = $p['object'];
-    
+
         // handle attachments vcard attachments
         foreach ((array)$this->message->attachments as $attachment) {
             if ($this->is_keys_part($attachment)) {
@@ -399,7 +408,7 @@
             }
         }
         // the same with message bodies
-        foreach ((array)$this->message->parts as $idx => $part) {
+        foreach ((array)$this->message->parts as $part) {
             if ($this->is_keys_part($part)) {
                 $this->keys_parts[] = $part->mime_id;
                 $this->keys_bodies[] = $part->mime_id;

--
Gitblit v1.9.1