[git] GpgOL - branch, outlook14, updated. gpgol-1.1.3-24-g7d3eccb

by Andre Heinecke cvs at cvs.gnupg.org
Fri Jul 12 10:35:46 CEST 2013


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, outlook14 has been updated
       via  7d3eccb79093dab365b2e4124b98baacfa527671 (commit)
      from  289c0700ecf91048f122adddf86b00eb4b22675a (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 7d3eccb79093dab365b2e4124b98baacfa527671
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Jul 12 08:03:34 2013 +0000

    Remove GpgolExt reference and check Version
    
        The addin should only be used in Ol 14 otherwise
        the old ExchangeExtension is used.
    
        * src/gpgoladdin.cpp, src/gpgoladdin.h (GpgolAddin): Remove
        reference to GpgolExt Object.
        (QueryInterface, ~GpgolAddin): Check if addin is enabled.
        (OnConnection): Disable based on Version and handle
        initialization.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 77ec44c..bd1368b 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -147,13 +147,10 @@ STDMETHODIMP GpgolAddinFactory::CreateInstance (LPUNKNOWN punk, REFIID riid,
 
    The ref count is set by the factory after creation.
 */
-GpgolAddin::GpgolAddin (void) : m_lRef(0), m_application(0), m_addin(0)
+GpgolAddin::GpgolAddin (void) : m_lRef(0), m_application(0),
+  m_addin(0), m_disabled(false)
 {
-  /* Create the COM Extension Object that handles the startup and
-     endinge initialization
-  */
-  m_gpgolext = new GpgolExt();
-
+  read_options ();
   /* RibbonExtender is it's own object to avoid the pitfalls of
      multiple inheritance
   */
@@ -165,11 +162,14 @@ GpgolAddin::~GpgolAddin (void)
   log_debug ("%s:%s: cleaning up GpgolAddin object;",
              SRCNAME, __func__);
 
-  engine_deinit ();
-  write_options ();
-  delete m_gpgolext;
   delete m_ribbonExtender;
 
+  if (!m_disabled)
+    {
+      engine_deinit ();
+      write_options ();
+    }
+
   log_debug ("%s:%s: Object deleted\n", SRCNAME, __func__);
 }
 
@@ -180,6 +180,9 @@ GpgolAddin::QueryInterface (REFIID riid, LPVOID* ppvObj)
 
   *ppvObj = NULL;
 
+  if (m_disabled)
+    return E_NOINTERFACE;
+
   if ((riid == IID_IUnknown) || (riid == IID_IDTExtensibility2) ||
       (riid == IID_IDispatch))
     {
@@ -191,15 +194,12 @@ GpgolAddin::QueryInterface (REFIID riid, LPVOID* ppvObj)
     }
   else
     {
-      hr = m_gpgolext->QueryInterface (riid, ppvObj);
+      hr = E_NOINTERFACE;
 #if 0
-      if (FAILED(hr))
-        {
-          LPOLESTR sRiid = NULL;
-          StringFromIID(riid, &sRiid);
-          log_debug ("%s:%s: queried for unimplmented interface: %S",
-                     SRCNAME, __func__, sRiid);
-        }
+      LPOLESTR sRiid = NULL;
+      StringFromIID(riid, &sRiid);
+      log_debug ("%s:%s: queried for unimplmented interface: %S",
+                 SRCNAME, __func__, sRiid);
 #endif
     }
 
@@ -214,22 +214,32 @@ GpgolAddin::OnConnection (LPDISPATCH Application, ext_ConnectMode ConnectMode,
                           LPDISPATCH AddInInst, SAFEARRAY ** custom)
 {
   (void)custom;
-  TRACEPOINT();
+  char* version;
 
-  if (!m_application)
-    {
-      m_application = Application;
-      m_application->AddRef();
-      m_addin = AddInInst;
-    }
-  else
+  log_debug ("%s:%s: this is GpgOL %s\n",
+             SRCNAME, __func__, PACKAGE_VERSION);
+  log_debug ("%s:%s:   in Outlook %s\n",
+             SRCNAME, __func__, gpgme_check_version (NULL));
+
+  m_application = Application;
+  m_application->AddRef();
+  m_addin = AddInInst;
+
+  version = get_oom_string (Application, "Version");
+
+  log_debug ("%s:%s:   using GPGME %s\n",
+             SRCNAME, __func__, version);
+
+  if (!version || !strlen (version) || strncmp (version, "14", 2))
     {
-      /* This should not happen but happened during development when
-         the vtable was incorrect and the wrong function was called */
-      log_debug ("%s:%s: Application already set. Ignoring new value.",
+      m_disabled = true;
+      log_debug ("%s:%s: Disabled addin for unsupported version.",
                  SRCNAME, __func__);
+
+      xfree (version);
       return S_OK;
     }
+  engine_init ();
 
   if (ConnectMode != ext_cm_Startup)
     {
@@ -244,9 +254,8 @@ GpgolAddin::OnDisconnection (ext_DisconnectMode RemoveMode,
 {
   (void)custom;
   (void)RemoveMode;
-  /* Deleting the extension causes everything to be cleaned up */
-  delete m_gpgolext;
 
+  write_options();
   return S_OK;
 }
 
diff --git a/src/gpgoladdin.h b/src/gpgoladdin.h
index 9518d9e..cf98e8c 100644
--- a/src/gpgoladdin.h
+++ b/src/gpgoladdin.h
@@ -185,11 +185,11 @@ public:
 
 private:
   ULONG m_lRef;
-  GpgolExt* m_gpgolext;
   GpgolRibbonExtender* m_ribbonExtender;
 
   LPDISPATCH m_application;
   LPDISPATCH m_addin;
+  bool m_disabled;
 
 };
 

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

Summary of changes:
 src/gpgoladdin.cpp |   69 +++++++++++++++++++++++++++++----------------------
 src/gpgoladdin.h   |    2 +-
 2 files changed, 40 insertions(+), 31 deletions(-)


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




More information about the Gnupg-commits mailing list