[git] GpgOL - branch, master, updated. gpgol-2.1.0-5-ge8451f0

by Andre Heinecke cvs at cvs.gnupg.org
Thu Apr 19 14:50:07 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  e8451f067808125b79b36eda0828fb53bbe32e4f (commit)
       via  a50a286ca62b23c4890d37b4e8157447f2dd652e (commit)
       via  1a6d274993996d90319f8ff5093bbbcbbd28dce0 (commit)
       via  9308a6e74d2bc5d3b2aa3885bbfdf2cd06d8a3bc (commit)
      from  8695b2eda8a9e665f0088a21fba67d097dfa592a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e8451f067808125b79b36eda0828fb53bbe32e4f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Apr 19 14:48:28 2018 +0200

    Accept keys out of WKD as usable for encryption
    
    * src/keycache.cpp (KeyCache::getEncryptionKeys): Accept
    keys with Original WKD.
    
    --
    We are trying to determine here if "automatic" certificate
    selection is Ok. When we have a key from WKD we find
    that Ok.

diff --git a/src/keycache.cpp b/src/keycache.cpp
index 29382d5..2817b80 100644
--- a/src/keycache.cpp
+++ b/src/keycache.cpp
@@ -263,7 +263,8 @@ public:
                 // Ignore unmatching addr specs
                 continue;
               }
-            if (uid.validity() >= GpgME::UserID::Marginal)
+            if (uid.validity() >= GpgME::UserID::Marginal ||
+                uid.origin() == GpgME::Key::OriginWKD)
               {
                 validEnough = true;
                 break;

commit a50a286ca62b23c4890d37b4e8157447f2dd652e
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Apr 19 14:47:17 2018 +0200

    Fix launch cert details on signature error
    
    * src/mail.cpp, src/mail.h (get_verification_result_dump): New.
    * src/ribbon-callbacks.cpp (launch_cert_details): Handle the
    case that we don't have a sig fingerprint.

diff --git a/src/mail.cpp b/src/mail.cpp
index 92bbc87..a0e5727 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -54,7 +54,7 @@
 #include <set>
 #include <vector>
 #include <memory>
-
+#include <sstream>
 
 #undef _
 #define _(a) utf8_gettext (a)
@@ -2915,3 +2915,11 @@ Mail::has_crypted_or_empty_body ()
 
   return false;
 }
+
+std::string
+Mail::get_verification_result_dump()
+{
+  std::stringstream ss;
+  ss << m_verify_result;
+  return ss.str();
+}
diff --git a/src/mail.h b/src/mail.h
index d3b6afa..677ac7b 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -485,6 +485,8 @@ public:
   /* Attachment removal state variables. */
   bool attachment_remove_warning_disabled () { return m_disable_att_remove_warning; }
 
+  /* Gets the string dump of the verification result. */
+  std::string get_verification_result_dump ();
 private:
   void update_categories ();
   void update_sigstate ();
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index c853678..cfbc329 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1464,8 +1464,8 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
                  SRCNAME, __func__);
       gpgol_release (context);
       return NULL;
-
     }
+
   if (!strcmp (ctx_name.c_str(), "_Inspector"))
     {
       mailitem = get_oom_object (context, "CurrentItem");
@@ -1736,6 +1736,14 @@ HRESULT launch_cert_details (LPDISPATCH ctrl)
       return S_OK;
     }
 
+  if (!mail->get_sig_fpr())
+    {
+      std::string buf = _("There was an error verifying the signature.\n"
+                           "Full details:\n");
+      buf += mail->get_verification_result_dump();
+      gpgol_message_box (get_active_hwnd(), buf.c_str(), _("GpgOL"), MB_OK);
+    }
+
   char *uiserver = get_uiserver_name ();
   bool showError = false;
   if (uiserver)

commit 1a6d274993996d90319f8ff5093bbbcbbd28dce0
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Apr 19 14:36:39 2018 +0200

    Add quick print context menu entry
    
    * src/gpgoladdin.cpp: Extend ribbon UI and callbacks.
    * src/ribbon-callbacks.cpp (print_decrypted, get_is_crypto_mail):
    New.
    
    --
    As the Quick Print and File -> Print do not work if mails
    are only viewed in the Explorer this is a shortcut to
    avoid that users have to explicitly open the mail before
    printing.
    
    GnuPG-Bug-Id: T3762

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index d8931de..6f393ca 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -649,6 +649,8 @@ GpgolRibbonExtender::GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames,
       ID_MAPPER (L"getSigTip", ID_GET_SIG_TTIP)
       ID_MAPPER (L"launchDetails", ID_LAUNCH_CERT_DETAILS)
       ID_MAPPER (L"getIsDetailsEnabled", ID_GET_IS_DETAILS_ENABLED)
+      ID_MAPPER (L"getIsCrypto", ID_GET_IS_CRYPTO_MAIL)
+      ID_MAPPER (L"printDecrypted", ID_CMD_PRINT_DECRYPTED)
     }
 
   if (cNames > 1)
@@ -756,6 +758,10 @@ GpgolRibbonExtender::Invoke (DISPID dispid, REFIID riid, LCID lcid,
             options_dialog_box (NULL);
             return S_OK;
           }
+      case ID_CMD_PRINT_DECRYPTED:
+        return print_decrypted (parms->rgvarg[0].pdispVal);
+      case ID_GET_IS_CRYPTO_MAIL:
+        return get_is_crypto_mail (parms->rgvarg[0].pdispVal, result);
       case ID_BTN_CERTMANAGER:
       case ID_BTN_ENCRYPT:
       case ID_BTN_DECRYPT:
@@ -974,8 +980,20 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml)
         "      </group>"
         "    </tab>"
         "   </tabSet>"
-        "   </contextualTabs>"
+        "  </contextualTabs>"
         " </ribbon>"
+        " <contextMenus>"
+        "  <contextMenu idMso=\"ContextMenuMailItem\">"
+        "   <button id=\"decryptedPrintBtn\""
+//        "idMso=\"FilePrintQuick\""
+        "           label=\"%s\""
+        "           onAction=\"printDecrypted\""
+        "           getImage=\"btnEncryptSmall\""
+        "           getVisible=\"getIsCrypto\""
+        "           insertAfterMso=\"FilePrintQuick\""
+        "   />"
+        "  </contextMenu>"
+        " </contextMenus>"
         "</customUI>",
         _("GpgOL"),
         optsSTip,
@@ -983,7 +1001,8 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml)
         _("Secure"), secureTTip, secureSTip,
         _("Sign"), signTTip, signSTip,
         _("Encrypt"), encryptTTip, encryptSTip,
-        optsSTip
+        optsSTip,
+        _("&Print decrypted")
         );
     }
   else if (!wcscmp (RibbonID, L"Microsoft.Outlook.Explorer"))
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index ee427e5..c853678 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -1548,6 +1548,21 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
             }
         }
     }
+  else if (!strcmp (ctx_name.c_str(), "Selection"))
+    {
+      int count = get_oom_int (context, "Count");
+      if (count == 1)
+        {
+          // If we call this on a selection with more items
+          // Outlook sends an ItemLoad event for each mail
+          // in that selection.
+          mailitem = get_oom_object (context, "Item(1)");
+        }
+      if (!mailitem)
+        {
+          *none_selected = true;
+        }
+    }
 
   gpgol_release (context);
   if (!mailitem)
@@ -1786,3 +1801,29 @@ HRESULT get_crypto_icon (LPDISPATCH ctrl, VARIANT *result)
     }
   return getIcon (IDI_LEVEL_0, result);
 }
+
+HRESULT get_is_crypto_mail (LPDISPATCH ctrl, VARIANT *result)
+{
+  MY_MAIL_GETTER
+
+  result->vt = VT_BOOL | VT_BYREF;
+  result->pboolVal = (VARIANT_BOOL*) xmalloc (sizeof (VARIANT_BOOL));
+  *(result->pboolVal) = (mail && (mail->is_signed () || mail->is_encrypted ())) ?
+                          VARIANT_TRUE : VARIANT_FALSE;
+
+  return S_OK;
+}
+
+HRESULT print_decrypted (LPDISPATCH ctrl)
+{
+  MY_MAIL_GETTER
+
+  if (!mail)
+    {
+      log_error ("%s:%s: Failed to get mail.",
+                 SRCNAME, __func__);
+      return S_OK;
+    }
+  invoke_oom_method (mail->item(), "PrintOut", NULL);
+  return S_OK;
+}
diff --git a/src/ribbon-callbacks.h b/src/ribbon-callbacks.h
index c6afcc0..6fe63df 100644
--- a/src/ribbon-callbacks.h
+++ b/src/ribbon-callbacks.h
@@ -57,6 +57,8 @@
 #define ID_GET_SIGN_ENCRYPT_PRESSED_EX 31
 #define ID_CMD_SIGN_ENCRYPT_MIME 32
 #define ID_CMD_SIGN_ENCRYPT_MIME_EX 33
+#define ID_CMD_PRINT_DECRYPTED 34
+#define ID_GET_IS_CRYPTO_MAIL 35
 
 #define ID_BTN_CERTMANAGER       IDI_KEY_MANAGER_64_PNG
 #define ID_BTN_DECRYPT           IDI_DECRYPT_16_PNG
@@ -100,4 +102,8 @@ HRESULT launch_cert_details (LPDISPATCH ctrl);
 HRESULT get_crypto_icon (LPDISPATCH ctrl, VARIANT *result);
 /* Callback to get our own control reference */
 HRESULT ribbon_loaded (LPDISPATCH ctrl);
+/* Is the currently selected mail a crypto mail ? */
+HRESULT get_is_crypto_mail (LPDISPATCH ctrl, VARIANT *result);
+/* Print out the decrypted mail */
+HRESULT print_decrypted (LPDISPATCH ctrl);
 #endif

commit 9308a6e74d2bc5d3b2aa3885bbfdf2cd06d8a3bc
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Apr 19 13:19:38 2018 +0200

    Don't write OpenPGP Encrypted Message for sig only
    
    * src/mail.cpp (Mail::decrypt_verify): Write only
    that it is an OpenPGP or S/MIME message and not that
    its encrypted even if its only signed.

diff --git a/src/mail.cpp b/src/mail.cpp
index cbff50d..92bbc87 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -931,7 +931,7 @@ Mail::decrypt_verify()
   else if (gpgrt_asprintf (&placeholder_buf, opt.prefer_html ? decrypt_template_html :
                       decrypt_template,
                       is_smime() ? "S/MIME" : "OpenPGP",
-                      _("Encrypted message"),
+                      _("message"),
                       _("Please wait while the message is being decrypted / verified...")) == -1)
     {
       log_error ("%s:%s: Failed to format placeholder.",

-----------------------------------------------------------------------

Summary of changes:
 src/gpgoladdin.cpp       | 23 ++++++++++++++++++++--
 src/keycache.cpp         |  3 ++-
 src/mail.cpp             | 12 ++++++++++--
 src/mail.h               |  2 ++
 src/ribbon-callbacks.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++-
 src/ribbon-callbacks.h   |  6 ++++++
 6 files changed, 91 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list