[git] GpgOL - branch, master, updated. gpgol-2.3.1-37-gbe57fa9

by Andre Heinecke cvs at cvs.gnupg.org
Fri Nov 9 11:24:11 CET 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  be57fa9d9f52cdd52151c5a0a874abf108932c51 (commit)
      from  289643c1016d3e145329bedbc6bb91656f9e48f7 (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 be57fa9d9f52cdd52151c5a0a874abf108932c51
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Nov 9 11:20:05 2018 +0100

    Override file close cmd to trigger shutdown
    
    * src/gpgoladdin.cpp (GpgolRibbonExtender::GetIDsOfNames)
    (GpgolRibbonExtender::Invoke): Hookup override.
    (GetCustomUI_MIME): Override File->Close command.
    * src/ribbon-callbacks.cpp (override_file_close): New.
    * src/ribbon-callbacks.h: Update accordingly.
    
    --
    There are two ways Outlook can be closed. Either through
    a Windowmessage (which wie handled already) or through
    the FileClose Command. We now also handle the FileClose
    to shutdown.
    Doing the shutdown later does not work for us because before
    we get any events or shutdown notifications we already have
    to close / discard our decrypted contents.
    
    GnuPG-Bug-Id: T4236

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index bd9cdb8..c098a0b 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -717,6 +717,7 @@ GpgolRibbonExtender::GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames,
       ID_MAPPER (L"getIsCrypto", ID_GET_IS_CRYPTO_MAIL)
       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)
     }
 
   if (cNames > 1)
@@ -808,6 +809,8 @@ GpgolRibbonExtender::Invoke (DISPID dispid, REFIID riid, LCID lcid,
         return get_is_crypto_mail (parms->rgvarg[0].pdispVal, result);
       case ID_CMD_OPEN_CONTACT_KEY:
         return open_contact_key (parms->rgvarg[0].pdispVal);
+      case ID_CMD_FILE_CLOSE :
+        return override_file_close ();
       case ID_BTN_ENCRYPT:
       case ID_BTN_DECRYPT:
       case ID_BTN_DECRYPT_LARGE:
@@ -958,6 +961,10 @@ GetCustomUI_MIME (BSTR RibbonID, BSTR * RibbonXml)
       gpgrt_asprintf (&buffer,
         "<customUI xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\""
         " onLoad=\"ribbonLoaded\">"
+        " <commands>"
+        "  <command idMso=\"FileCloseAndLogOff\""
+        "           onAction=\"overrideFileClose\"/>"
+        " </commands>"
         " <ribbon>"
         "   <tabs>"
         "    <tab idMso=\"TabMail\">"
diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index fc5d79a..8cafc9a 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -842,3 +842,18 @@ HRESULT open_contact_key (LPDISPATCH ctrl)
   gpgol_release (contact);
   return S_OK;
 }
+
+HRESULT override_file_close ()
+{
+  TSTART;
+  auto inst = GpgolAddin::get_instance ();
+  /* We need to get it first as shutdown releases the reference */
+  auto app = inst->get_application ();
+  app->AddRef ();
+  inst->shutdown();
+  log_debug ("%s:%s: Shutdown complete. Quitting.",
+             SRCNAME, __func__);
+  invoke_oom_method (app, "Quit", nullptr);
+
+  TRETURN S_OK;
+}
diff --git a/src/ribbon-callbacks.h b/src/ribbon-callbacks.h
index ce71c1a..83fd5d1 100644
--- a/src/ribbon-callbacks.h
+++ b/src/ribbon-callbacks.h
@@ -50,6 +50,7 @@
 #define ID_CMD_PRINT_DECRYPTED 34
 #define ID_GET_IS_CRYPTO_MAIL 35
 #define ID_CMD_OPEN_CONTACT_KEY 36
+#define ID_CMD_FILE_CLOSE 37
 
 #define ID_BTN_DECRYPT           IDI_DECRYPT_16_PNG
 #define ID_BTN_DECRYPT_LARGE     IDI_DECRYPT_48_PNG
@@ -88,4 +89,6 @@ HRESULT get_is_crypto_mail (LPDISPATCH ctrl, VARIANT *result);
 HRESULT print_decrypted (LPDISPATCH ctrl);
 /* Open key configuration for a contact */
 HRESULT open_contact_key (LPDISPATCH ctrl);
+/* An explorer is closed by File->Close */
+HRESULT override_file_close ();
 #endif

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

Summary of changes:
 src/gpgoladdin.cpp       |  7 +++++++
 src/ribbon-callbacks.cpp | 15 +++++++++++++++
 src/ribbon-callbacks.h   |  3 +++
 3 files changed, 25 insertions(+)


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




More information about the Gnupg-commits mailing list