[git] GpgOL - branch, master, updated. gpgol-2.3.2-31-g5e21862

by Andre Heinecke cvs at cvs.gnupg.org
Fri Feb 22 06:49:16 CET 2019


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  5e218623fd5d8e1793bf833d1fbbfc961e2c5784 (commit)
       via  0d8baad07bced3db6f008a475d6fc0afdf5ff18c (commit)
       via  bd4516dd3aa7ede9ac3852797d2ac2ad84cd69a1 (commit)
      from  815c500864db46e7bc4a9f5d4b8ccd942e60fd15 (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 5e218623fd5d8e1793bf833d1fbbfc961e2c5784
Author: Andre Heinecke <aheinecke at gnupg.org>
Date:   Fri Feb 22 06:47:18 2019 +0100

    Add decrypt permanently feature
    
    * src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames),
    (GpgolRibbonExtender::Invoke),
    (GetCustomUI_MIME): Add decrypt permanently.
    * src/mail.cpp (Mail::decryptPermanently_o): New.
    * src/ribbon-callbacks.cpp (decrypt_permanently): Wire up.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index c098a0b..4cc8c75 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -718,6 +718,7 @@ GpgolRibbonExtender::GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames,
       ID_MAPPER (L"printDecrypted", ID_CMD_PRINT_DECRYPTED)
       ID_MAPPER (L"openContactKey", ID_CMD_OPEN_CONTACT_KEY)
       ID_MAPPER (L"overrideFileClose", ID_CMD_FILE_CLOSE)
+      ID_MAPPER (L"decryptPermanently", ID_CMD_DECRYPT_PERMANENTLY)
     }
 
   if (cNames > 1)
@@ -805,6 +806,8 @@ GpgolRibbonExtender::Invoke (DISPID dispid, REFIID riid, LCID lcid,
           }
       case ID_CMD_PRINT_DECRYPTED:
         return print_decrypted (parms->rgvarg[0].pdispVal);
+      case ID_CMD_DECRYPT_PERMANENTLY:
+        return decrypt_permanently (parms->rgvarg[0].pdispVal);
       case ID_GET_IS_CRYPTO_MAIL:
         return get_is_crypto_mail (parms->rgvarg[0].pdispVal, result);
       case ID_CMD_OPEN_CONTACT_KEY:
@@ -1035,6 +1038,13 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml)
         "           getVisible=\"getIsCrypto\""
         "           insertAfterMso=\"FilePrintQuick\""
         "   />"
+        "   <button id=\"decryptPermanentlyBtn\""
+        "           label=\"%s\""
+        "           onAction=\"decryptPermanently\""
+        "           getImage=\"btnEncryptSmall\""
+        "           getVisible=\"getIsCrypto\""
+//"           insertAfterMso=\"FilePrintQuick\""
+        "   />"
         "  </contextMenu>"
         " </contextMenus>"
         "</customUI>",
@@ -1045,7 +1055,8 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml)
         _("Sign"), signTTip, signSTip,
         _("Encrypt"), encryptTTip, encryptSTip,
         optsSTip,
-        _("&Print decrypted")
+        _("&Print decrypted"),
+        _("Permanenlty &decrypt")
         );
     }
   else if (!wcscmp (RibbonID, L"Microsoft.Outlook.Explorer"))
diff --git a/src/mail.cpp b/src/mail.cpp
index db137b1..40812c2 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -3925,3 +3925,45 @@ Mail::releaseCurrentItem()
   gpgol_release (tmp);
   TRETURN;
 }
+
+void
+Mail::decryptPermanently_o()
+{
+  if (!m_needs_wipe)
+    {
+      log_debug ("%s:%s: Mail does not yet need wipe. Called to early?",
+                 SRCNAME, __func__);
+      return;
+    }
+
+  /* Drop our state variables */
+  m_decrypt_result = GpgME::DecryptionResult();
+  m_verify_result = GpgME::VerificationResult();
+  m_needs_wipe = false;
+  m_processed = false;
+  m_is_smime = false;
+  m_type = MSGTYPE_UNKNOWN;
+
+  /* Remove our own attachments */
+  removeOurAttachments_o ();
+
+  updateSigstate();
+
+  removeCategories_o ();
+
+  auto msg = MAKE_SHARED (get_oom_base_message (m_mailitem));
+  if (!msg)
+    {
+      STRANGEPOINT;
+      return;
+    }
+  mapi_delete_gpgol_tags ((LPMESSAGE)msg.get());
+
+  mapi_set_mesage_class ((LPMESSAGE)msg.get(), "IPM.Note");
+
+  if (invoke_oom_method (m_mailitem, "Save", NULL))
+    {
+      log_error ("Failed to save decrypted mail: %p ", m_mailitem);
+    }
+  return;
+}
diff --git a/src/mail.h b/src/mail.h
index 9a10cbf..83342d3 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -601,6 +601,9 @@ public:
   /* Get the storeID for this mail */
   std::string storeID() { return m_store_id; }
 
+  /* Remove encryption permanently. */
+  void decryptPermanently_o ();
+
 private:
   void updateCategories_o ();
   void updateSigstate ();
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 8cafc9a..18bab16 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -810,6 +810,21 @@ HRESULT print_decrypted (LPDISPATCH ctrl)
   return S_OK;
 }
 
+HRESULT decrypt_permanently (LPDISPATCH ctrl)
+{
+  MY_MAIL_GETTER
+
+  if (!mail)
+    {
+      log_error ("%s:%s: Failed to get mail.",
+                 SRCNAME, __func__);
+      return S_OK;
+    }
+
+  mail->decryptPermanently_o ();
+  return S_OK;
+}
+
 HRESULT open_contact_key (LPDISPATCH ctrl)
 {
   if (!ctrl)
diff --git a/src/ribbon-callbacks.h b/src/ribbon-callbacks.h
index 83fd5d1..a084884 100644
--- a/src/ribbon-callbacks.h
+++ b/src/ribbon-callbacks.h
@@ -51,6 +51,7 @@
 #define ID_GET_IS_CRYPTO_MAIL 35
 #define ID_CMD_OPEN_CONTACT_KEY 36
 #define ID_CMD_FILE_CLOSE 37
+#define ID_CMD_DECRYPT_PERMANENTLY 38
 
 #define ID_BTN_DECRYPT           IDI_DECRYPT_16_PNG
 #define ID_BTN_DECRYPT_LARGE     IDI_DECRYPT_48_PNG
@@ -91,4 +92,6 @@ HRESULT print_decrypted (LPDISPATCH ctrl);
 HRESULT open_contact_key (LPDISPATCH ctrl);
 /* An explorer is closed by File->Close */
 HRESULT override_file_close ();
+/* Decrypt permanently */
+HRESULT decrypt_permanently (LPDISPATCH ctrl);
 #endif

commit 0d8baad07bced3db6f008a475d6fc0afdf5ff18c
Author: Andre Heinecke <aheinecke at gnupg.org>
Date:   Fri Feb 22 06:46:02 2019 +0100

    Add new mapi helpers for decrypt permanently
    
    * src/mapihelp.cpp (mapi_delete_gpgol_tags): New. delete
    our tags.
    (mapi_set_message_class): Explicitly set a message class.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 8d2cc01..0d40664 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -3685,3 +3685,60 @@ mapi_get_header_info (LPMESSAGE message,
   rfc822parse_close (msg);
   TRETURN true;
 }
+
+void
+mapi_delete_gpgol_tags (LPMESSAGE message)
+{
+  if (!message)
+    {
+      STRANGEPOINT;
+      return;
+    }
+
+  ULONG tag;
+  if (!get_gpgolmsgclass_tag (message, &tag))
+    {
+      HRESULT hr;
+      SPropTagArray proparray;
+      proparray.cValues = 1;
+      proparray.aulPropTag[0] = tag;
+      hr = message->DeleteProps (&proparray, NULL);
+      if (hr)
+        {
+          log_error ("%s:%s: deleteprops failed: hr=%#lx\n",
+                     SRCNAME, __func__, hr);
+
+        }
+    }
+}
+
+void
+mapi_set_mesage_class (LPMESSAGE message, const char *cls)
+{
+  if (!message || !cls)
+    {
+      STRANGEPOINT;
+      return;
+    }
+  HRESULT hr;
+  SPropValue prop;
+  prop.ulPropTag = PR_MESSAGE_CLASS_A;
+  prop.Value.lpszA = xstrdup (cls);
+  hr = HrSetOneProp (message, &prop);
+  xfree (prop.Value.lpszA);
+
+  if (hr)
+    {
+      log_error ("%s:%s: set msg class failed: hr=%#lx\n",
+                 SRCNAME, __func__, hr);
+
+    }
+
+  hr = mapi_save_changes (message, KEEP_OPEN_READWRITE);
+  if (hr)
+    {
+      log_error ("%s:%s: save failed: hr=%#lx\n",
+                 SRCNAME, __func__, hr);
+
+    }
+}
diff --git a/src/mapihelp.h b/src/mapihelp.h
index be42711..372d211 100644
--- a/src/mapihelp.h
+++ b/src/mapihelp.h
@@ -118,6 +118,12 @@ int mapi_body_to_attachment (LPMESSAGE message);
 /* Get malloced uid of a message */
 char * mapi_get_uid (LPMESSAGE message);
 
+/* Remove the gpgol specific mapi tags */
+void mapi_delete_gpgol_tags (LPMESSAGE message);
+
+/* Explicitly change the message class */
+void mapi_set_mesage_class (LPMESSAGE message, const char *cls);
+
 #ifdef __cplusplus
 }
 #include <string>

commit bd4516dd3aa7ede9ac3852797d2ac2ad84cd69a1
Author: Andre Heinecke <aheinecke at gnupg.org>
Date:   Fri Feb 22 06:45:13 2019 +0100

    Fix encoding of protected header subject
    
    * src/mimedataprovider.cpp (MimeDataProvider::finalize): Parse
    the subject through rfc2047

diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp
index 6afcdcd..7e3f8a4 100644
--- a/src/mimedataprovider.cpp
+++ b/src/mimedataprovider.cpp
@@ -1107,6 +1107,10 @@ void MimeDataProvider::finalize ()
           else
             {
               m_internal_subject = subject + strlen ("Subject: ");
+              if (m_internal_subject.size())
+                {
+                  m_internal_subject = rfc2047_parse (m_internal_subject.c_str ());
+                }
             }
         }
     }

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

Summary of changes:
 src/gpgoladdin.cpp       | 13 ++++++++++-
 src/mail.cpp             | 42 +++++++++++++++++++++++++++++++++++
 src/mail.h               |  3 +++
 src/mapihelp.cpp         | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/mapihelp.h           |  6 +++++
 src/mimedataprovider.cpp |  4 ++++
 src/ribbon-callbacks.cpp | 15 +++++++++++++
 src/ribbon-callbacks.h   |  3 +++
 8 files changed, 142 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list