[git] GpgOL - branch, master, updated. gpgol-2.2.0-161-g4c573f3

by Andre Heinecke cvs at cvs.gnupg.org
Wed Aug 29 11:30: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  4c573f3c898429628c3344c88379319f271b900a (commit)
       via  ab6b52deb626714fb5bab7ff98cb7f36254b4645 (commit)
       via  9e5ad3f129751f0d4d236b34850d7127780f6ae8 (commit)
       via  59e8a7ee3bcd16275091c9535626e49fc2a6c4af (commit)
       via  b6cfbd077e9453dd16e09fff22ec014bc1ee282d (commit)
       via  283892c73ddeb20a16262a0f66ea2e2e9507e57c (commit)
       via  c2c93b0814955019c8a64a2cb8b4721fff100bd7 (commit)
      from  25f501f29ea2c1b617aaba0be747797fcc05dc16 (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 4c573f3c898429628c3344c88379319f271b900a
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 11:28:15 2018 +0200

    Cache icons
    
    * src/ribbon-callbacks.cpp (getIcon): Use dispcache.
    (getIconDisp): New.
    
    --
    While this may not be much it felt excessive to initialize
    GDIPlus and convert the icon from PNG to bitmap for each
    getIcon call even though the icons never change over
    the lifetime of GpgOL
    
    GnuPG-Bug-Id: T4113

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 43ab432..e9f8a5e 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -42,6 +42,7 @@
 #include "mimemaker.h"
 #include "filetype.h"
 #include "mail.h"
+#include "dispcache.h"
 
 #include <gpgme++/context.h>
 #include <gpgme++/data.h>
@@ -73,15 +74,15 @@ HRESULT getContext (LPDISPATCH ctrl, LPDISPATCH *context)
   return context ? S_OK : E_FAIL;
 }
 
-/* getIcon
+/* getIconDisp
    Loads a PNG image from the resurce converts it into a Bitmap
    and Wraps it in an PictureDispatcher that is returned as result.
 
    Based on documentation from:
    http://www.codeproject.com/Articles/3537/Loading-JPG-PNG-resources-using-GDI
 */
-HRESULT
-getIcon (int id, VARIANT* result)
+static LPDISPATCH
+getIconDisp (int id)
 {
   PICTDESC pdesc;
   LPDISPATCH pPict;
@@ -98,12 +99,6 @@ getIcon (int id, VARIANT* result)
   pdesc.cbSizeofstruct = sizeof pdesc;
   pdesc.picType = PICTYPE_BITMAP;
 
-  if (!result)
-    {
-      log_error ("getIcon called without result variant.");
-      return E_POINTER;
-    }
-
   /* Initialize GDI */
   gdiplusStartupInput.DebugEventCallback = NULL;
   gdiplusStartupInput.SuppressBackgroundThread = FALSE;
@@ -117,12 +112,12 @@ getIcon (int id, VARIANT* result)
     {
       log_error ("%s:%s: failed to find image: %i",
                  SRCNAME, __func__, id);
-      return E_FAIL;
+      return nullptr;
     }
 
   imageSize = SizeofResource (glob_hinst, hResource);
   if (!imageSize)
-    return E_FAIL;
+    return nullptr;
 
   pResourceData = LockResource (LoadResource(glob_hinst, hResource));
 
@@ -130,7 +125,7 @@ getIcon (int id, VARIANT* result)
     {
       log_error ("%s:%s: failed to load image: %i",
                  SRCNAME, __func__, id);
-      return E_FAIL;
+      return nullptr;
     }
 
   hBuffer = GlobalAlloc (GMEM_MOVEABLE, imageSize);
@@ -168,11 +163,36 @@ getIcon (int id, VARIANT* result)
     {
       log_error ("%s:%s: OleCreatePictureIndirect failed: hr=%#lx\n",
                  SRCNAME, __func__, hr);
-      return -1;
+      return nullptr;
     }
 
-  result->pdispVal = pPict;
-  result->vt = VT_DISPATCH;
+  return pPict;
+}
+
+HRESULT
+getIcon (int id, VARIANT* result)
+{
+  if (!result)
+    {
+      TRACEPOINT;
+      return S_OK;
+    }
+
+  auto cache = DispCache::instance ();
+  result->pdispVal = cache->getDisp (id);
+
+  if (!result->pdispVal)
+    {
+      result->pdispVal = getIconDisp (id);
+      cache->addDisp (id, result->pdispVal);
+      memdbg_addRef (result->pdispVal);
+    }
+
+  if (result->pdispVal)
+    {
+      result->vt = VT_DISPATCH;
+      result->pdispVal->AddRef();
+    }
 
   return S_OK;
 }

commit ab6b52deb626714fb5bab7ff98cb7f36254b4645
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 11:02:52 2018 +0200

    Accept sent on behalf of as the sender address
    
    * src/mail.cpp (Mail::updateOOMData_o): Cache sent on behalf.
    (Mail::updateSigstate): Fallback to sent on behalf.
    (m_sent_on_behalf): New cache variable.
    * src/oomhelp.cpp (get_sender_SentRepresentingAddress): New.
    
    --
    Outlook clearly shows in the mail:
    "foo at bar.baz at behalf of foo2 at bar.baz"
    
    So we can accept "foo2 at bar.baz" also as the sender address
    as it is visible.
    
    GnuPG-Bug-ID: T4110

diff --git a/src/mail.cpp b/src/mail.cpp
index eeddb92..04d0b8e 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1601,6 +1601,16 @@ Mail::updateOOMData_o ()
           /* Try the sender Object */
           buf = get_sender_Sender (m_mailitem);
         }
+
+      /* We also want to cache sent representing email address so that
+         we can use it for verification information. */
+      char *buf2 = get_sender_SentRepresentingAddress (m_mailitem);
+
+      if (buf2)
+        {
+          m_sent_on_behalf = buf2;
+          xfree (buf2);
+        }
     }
 
   if (!buf)
@@ -2014,6 +2024,17 @@ Mail::updateSigstate ()
                                                         true);
       m_uid = get_uid_for_sender (key, sender.c_str());
 
+      if (m_uid.isNull() && !m_sent_on_behalf.empty ())
+        {
+          m_uid = get_uid_for_sender (key, m_sent_on_behalf.c_str ());
+          if (!m_uid.isNull())
+            {
+              log_debug ("%s:%s: Using sent on behalf '%s' instead of '%s'",
+                         SRCNAME, __func__, m_sent_on_behalf.c_str(),
+                         sender.c_str ());
+            }
+        }
+
       if ((sig.summary() & Signature::Summary::Valid) &&
           m_uid.origin() == GpgME::Key::OriginWKD &&
           (sig.validity() == Signature::Validity::Unknown ||
diff --git a/src/mail.h b/src/mail.h
index ee7fcac..7865336 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -617,6 +617,7 @@ private:
   int m_moss_position; /* The number of the original message attachment. */
   int m_crypto_flags;
   std::string m_sender;
+  std::string m_sent_on_behalf;
   char *m_cached_html_body; /* Cached html body. */
   char *m_cached_plain_body; /* Cached plain body. */
   std::vector<std::string> m_cached_recipients;
diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 06fd72d..0870b34 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -2213,6 +2213,21 @@ get_sender_SenderEMailAddress (LPDISPATCH mailitem)
 }
 
 char *
+get_sender_SentRepresentingAddress (LPDISPATCH mailitem)
+{
+  char *buf = get_pa_string (mailitem,
+                             PR_SENT_REPRESENTING_EMAIL_ADDRESS_W_DASL);
+  if (buf && strlen (buf))
+    {
+      log_debug ("%s:%s Found sent representing address \"%s\"",
+                 SRCNAME, __func__, buf);
+      return buf;
+    }
+  xfree (buf);
+  return nullptr;
+}
+
+char *
 get_inline_body ()
 {
   LPDISPATCH app = GpgolAddin::get_instance ()->get_application ();
diff --git a/src/oomhelp.h b/src/oomhelp.h
index ca7c1fd..0ef2c01 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -135,6 +135,8 @@ DEFINE_OLEGUID(IID_IOleWindow,                0x00000114, 0, 0);
   "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/content-type/0x0000001F"
 #define PR_BLOCK_STATUS_DASL \
   "http://schemas.microsoft.com/mapi/proptag/0x10960003"
+#define PR_SENT_REPRESENTING_EMAIL_ADDRESS_W_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x0065001F"
 
 #define DISTRIBUTION_LIST_ADDRESS_ENTRY_TYPE 11
 
@@ -357,6 +359,7 @@ char *get_sender_CurrentUser (LPDISPATCH mailitem);
 char *get_sender_Sender (LPDISPATCH mailitem);
 char *get_sender_SenderEMailAddress (LPDISPATCH mailitem);
 
+
 /* Get the body of the active inline response */
 char *get_inline_body (void);
 
@@ -370,6 +373,9 @@ int get_ol_ui_language (void);
 
 char *get_sender_SendUsingAccount (LPDISPATCH mailitem, bool *r_is_GSuite);
 
+/* Get the SentRepresentingAddress */
+char *get_sender_SentRepresentingAddress (LPDISPATCH mailitem);
+
 /* memtracing query interface */
 HRESULT gpgol_queryInterface (LPUNKNOWN pObj, REFIID riid, LPVOID FAR *ppvObj);
 

commit 9e5ad3f129751f0d4d236b34850d7127780f6ae8
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 10:37:11 2018 +0200

    Fix minor locking issue
    
    * src/keycache.cpp (KeyCache::Private::getByFpr): Use a copy
    to return after unlocking the map.
    
    --
    I'm not sure if this is neccessary as the iterator is const
    but better be safe.

diff --git a/src/keycache.cpp b/src/keycache.cpp
index 58e7c67..2331c89 100644
--- a/src/keycache.cpp
+++ b/src/keycache.cpp
@@ -456,8 +456,9 @@ public:
     const auto keyIt = m_fpr_map.find (primaryFpr);
     if (keyIt != m_fpr_map.end ())
       {
+        const auto ret = keyIt->second;
         gpgrt_lock_unlock (&fpr_map_lock);
-        return keyIt->second;
+        return ret;
       }
     gpgrt_lock_unlock (&fpr_map_lock);
     return GpgME::Key();

commit 59e8a7ee3bcd16275091c9535626e49fc2a6c4af
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 10:30:02 2018 +0200

    Use dispcache for Multilanguage COM interface
    
    * src/dialogs.h (DISPID_MULTILANG): New.
    * src/mlang-charset.cpp (ansi_charset_to_utf8): Use dispcache.
    
    --
    Using CoCreateInstance for every string to convert seemed excessive
    so we better cache it.
    
    GnuPG-Bug-Id: T4114

diff --git a/src/dialogs.h b/src/dialogs.h
index 217b0d0..4510fb5 100644
--- a/src/dialogs.h
+++ b/src/dialogs.h
@@ -75,4 +75,7 @@
 #define IDI_LEVEL_3_ENC                 (IDI_LEVEL_3 + ENCRYPT_ICON_OFFSET)
 #define IDI_LEVEL_4_ENC                 (IDI_LEVEL_4 + ENCRYPT_ICON_OFFSET)
 
+/* Other ids */
+#define DISPID_MLANG_CHARSET            0x7000
+
 #endif /*DIALOGS_H*/
diff --git a/src/mlang-charset.cpp b/src/mlang-charset.cpp
index e9b327a..0529856 100644
--- a/src/mlang-charset.cpp
+++ b/src/mlang-charset.cpp
@@ -29,6 +29,9 @@ DEFINE_GUID (IID_IMultiLanguage, 0x275c23e1,0x3747,0x11d0,0x9f,
 #include <mlang.h>
 #undef INITGUID
 
+#include "dialogs.h"
+#include "dispcache.h"
+
 #include "mlang-charset.h"
 
 char *ansi_charset_to_utf8 (const char *charset, const char *input,
@@ -51,9 +54,21 @@ char *ansi_charset_to_utf8 (const char *charset, const char *input,
       return xstrdup (input);
     }
 
-  CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
-                   IID_IMultiLanguage, (void**)&multilang);
-  memdbg_addRef (multilang);
+  auto cache = DispCache::instance ();
+  LPDISPATCH cachedLang = cache->getDisp (DISPID_MLANG_CHARSET);
+
+  if (!cachedLang)
+    {
+      CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
+                       IID_IMultiLanguage, (void**)&multilang);
+      memdbg_addRef (multilang);
+      cache->addDisp (DISPID_MLANG_CHARSET, (LPDISPATCH) multilang);
+    }
+  else
+    {
+      multilang = (LPMULTILANGUAGE) cachedLang;
+    }
+
 
   if (!multilang)
     {
@@ -108,7 +123,6 @@ char *ansi_charset_to_utf8 (const char *charset, const char *input,
 
   err = multilang->ConvertStringToUnicode(&mode, enc, const_cast<char*>(input),
                                           &uinlen, buf, &wlen);
-  gpgol_release (multilang);
   if (FAILED (err))
     {
       log_error ("%s:%s: Failed conversion 2.",

commit b6cfbd077e9453dd16e09fff22ec014bc1ee282d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 10:24:14 2018 +0200

    Add generic cache for IDispatch objects
    
    * src/dispcache.cpp, src/dispcache.h: New.
    * src/gpgoladdin.cpp, src/gpgoladdin.h: Carry dispcache as
    member.
    * src/Makefile.am: Add new Files.
    
    --
    The cache shares the lifetime of the addin object and
    can be used to keep IDispatch object around without having
    to create them again and again.

diff --git a/src/Makefile.am b/src/Makefile.am
index 599394f..7906794 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,7 @@ gpgol_SOURCES = \
     cpphelp.cpp cpphelp.h \
     cryptcontroller.cpp cryptcontroller.h \
     dialogs.h \
+    dispcache.h dispcache.cpp \
     eventsink.h \
     eventsinks.h \
     exechelp.c exechelp.h \
diff --git a/src/dispcache.cpp b/src/dispcache.cpp
new file mode 100644
index 0000000..7b1bbf3
--- /dev/null
+++ b/src/dispcache.cpp
@@ -0,0 +1,114 @@
+/* Copyright (C) 2018 Intevation GmbH
+ *
+ * This file is part of GpgOL.
+ *
+ * GpgOL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GpgOL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "dispcache.h"
+#include "gpg-error.h"
+
+#include "common.h"
+#include "gpgoladdin.h"
+
+#include <unordered_map>
+
+GPGRT_LOCK_DEFINE (cache_lock);
+
+class DispCache::Private
+{
+public:
+  Private()
+    {
+
+    }
+
+  void addDisp (int id, LPDISPATCH obj)
+   {
+     if (!id || !obj)
+       {
+         TRACEPOINT;
+         return;
+       }
+     gpgrt_lock_lock (&cache_lock);
+     auto it = m_cache.find (id);
+     if (it != m_cache.end ())
+       {
+         log_debug ("%s:%s Item \"%i\" already cached. Replacing it.",
+                    SRCNAME, __func__, id);
+         gpgol_release (it->second);
+         it->second = obj;
+         gpgrt_lock_unlock (&cache_lock);
+         return;
+       }
+     m_cache.insert (std::make_pair (id, obj));
+     gpgrt_lock_unlock (&cache_lock);
+     return;
+   }
+
+  LPDISPATCH getDisp (int id)
+    {
+      if (!id)
+        {
+          TRACEPOINT;
+          return nullptr;
+        }
+      gpgrt_lock_lock (&cache_lock);
+
+      const auto it = m_cache.find (id);
+      if (it != m_cache.end())
+        {
+          LPDISPATCH ret = it->second;
+          gpgrt_lock_unlock (&cache_lock);
+          return ret;
+        }
+      gpgrt_lock_unlock (&cache_lock);
+      return nullptr;
+    }
+
+  ~Private ()
+    {
+      gpgrt_lock_lock (&cache_lock);
+      for (const auto it: m_cache)
+        {
+          gpgol_release (it.second);
+        }
+      gpgrt_lock_unlock (&cache_lock);
+    }
+
+private:
+  std::unordered_map<int, LPDISPATCH> m_cache;
+};
+
+DispCache::DispCache (): d (new Private)
+{
+}
+
+void
+DispCache::addDisp (int id, LPDISPATCH obj)
+{
+  d->addDisp (id, obj);
+}
+
+LPDISPATCH
+DispCache::getDisp (int id)
+{
+  return d->getDisp (id);
+}
+
+DispCache *
+DispCache::instance ()
+{
+  return GpgolAddin::get_instance ()->get_dispcache ().get ();
+}
diff --git a/src/dispcache.h b/src/dispcache.h
new file mode 100644
index 0000000..465665d
--- /dev/null
+++ b/src/dispcache.h
@@ -0,0 +1,60 @@
+/* @file dispcache.h
+ * @brief Cache for IDispatch objects that are reusable.
+ *
+ * Copyright (C) 2018 Intevation GmbH
+ *
+ * This file is part of GpgOL.
+ *
+ * GpgOL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GpgOL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef DISPCACHE_H
+#define DISPCACHE_H
+
+#include "config.h"
+
+#include <memory>
+
+#include "oomhelp.h"
+
+class GpgolAddin;
+
+class DispCache
+{
+    friend class GpgolAddin;
+protected:
+    DispCache ();
+
+public:
+    /* Accessor. Returns the instance carried by
+       gpgoladdin. */
+    static DispCache *instance ();
+
+    /* Add a IDispatch with the id id to the cache.
+
+       The IDispatch is released on destruction of
+       the cache.
+
+       Id's are meant to be defined in dialogs.h
+    */
+    void addDisp (int id, LPDISPATCH obj);
+
+    /* Get the according IDispatch object. */
+    LPDISPATCH getDisp (int id);
+
+private:
+    class Private;
+    std::shared_ptr<Private> d;
+};
+
+#endif
diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index abf8e71..e331b86 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -47,6 +47,7 @@
 #include "mail.h"
 #include "addin-options.h"
 #include "cpphelp.h"
+#include "dispcache.h"
 
 #include <gpg-error.h>
 #include <list>
@@ -178,7 +179,8 @@ GpgolAddin::GpgolAddin (void) : m_lRef(0),
   m_explorersEventSink(nullptr),
   m_disabled(false),
   m_shutdown(false),
-  m_hook(nullptr)
+  m_hook(nullptr),
+  m_dispcache(new DispCache)
 {
   read_options ();
   /* RibbonExtender is it's own object to avoid the pitfalls of
diff --git a/src/gpgoladdin.h b/src/gpgoladdin.h
index a8c121b..1641942 100644
--- a/src/gpgoladdin.h
+++ b/src/gpgoladdin.h
@@ -27,9 +27,11 @@
 #include "mymapi.h"
 
 #include <vector>
+#include <memory>
 
 class GpgolAddinRibbonExt;
 class ApplicationEventListener;
+class DispCache;
 
 /* Enums for the IDTExtensibility2 interface*/
 typedef enum
@@ -212,6 +214,7 @@ public:
      crypto mails. */
   void shutdown ();
   LPDISPATCH get_application () { return m_application; }
+  std::shared_ptr<DispCache> get_dispcache () { return m_dispcache; }
   bool isShutdown() { return m_shutdown; };
 
 private:
@@ -227,6 +230,7 @@ private:
   bool m_shutdown;
   HHOOK m_hook;
   std::vector<LPDISPATCH> m_explorerEventSinks;
+  std::shared_ptr<DispCache> m_dispcache;
 };
 
 class GpgolAddinFactory: public IClassFactory

commit 283892c73ddeb20a16262a0f66ea2e2e9507e57c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 10:14:10 2018 +0200

    Add missing word from config dialog to i18n
    
    * src/addin-options.cpp: Add (Technical)

diff --git a/src/addin-options.cpp b/src/addin-options.cpp
index f81bed8..05848a6 100644
--- a/src/addin-options.cpp
+++ b/src/addin-options.cpp
@@ -41,6 +41,7 @@ i18n_noops[] = {
     N_("Configure GpgOL"),
     N_("Automation"),
     N_("General"),
+    N_("(Technical)"),
 
     N_("Automatically secure &messages"),
     N_("Configure GnuPG"),

commit c2c93b0814955019c8a64a2cb8b4721fff100bd7
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Aug 29 09:10:13 2018 +0200

    Remove attic
    
    * src/attic.c: Deleted.
    
    --
    This was dead / old code that was just confusing to have
    lying around.

diff --git a/src/attic.c b/src/attic.c
deleted file mode 100644
index 4c30f9a..0000000
--- a/src/attic.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Check whether the preview pane is visisble.  Returns:
-   -1 := Don't know.
-    0 := No
-    1 := Yes.
- */
-int
-is_preview_pane_visible (LPEXCHEXTCALLBACK eecb)
-{
-  HRESULT hr;      
-  LPDISPATCH pDisp;
-  DISPID dispid;
-  DISPPARAMS dispparams;
-  VARIANT aVariant, rVariant;
-      
-  pDisp = find_outlook_property (eecb,
-                                 "Application.ActiveExplorer.IsPaneVisible",
-                                 &dispid);
-  if (!pDisp)
-    {
-      log_debug ("%s:%s: ActiveExplorer.IsPaneVisible NOT found\n",
-                 SRCNAME, __func__);
-      return -1;
-    }
-
-  dispparams.rgvarg = &aVariant;
-  dispparams.rgvarg[0].vt = VT_INT;
-  dispparams.rgvarg[0].intVal = 3; /* olPreview */
-  dispparams.cArgs = 1;
-  dispparams.cNamedArgs = 0;
-  rVariant.bstrVal = NULL;
-  hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
-                      DISPATCH_METHOD, &dispparams,
-                      &rVariant, NULL, NULL);
-  gpgol_release (pDisp);
-  pDisp = NULL;
-  if (hr == S_OK && rVariant.vt != VT_BOOL)
-    {
-      log_debug ("%s:%s: invoking IsPaneVisible succeeded but vt is %d",
-                 SRCNAME, __func__, rVariant.vt);
-      if (rVariant.vt == VT_BSTR && rVariant.bstrVal)
-        SysFreeString (rVariant.bstrVal);
-      return -1;
-    }
-  if (hr != S_OK)
-    {
-      log_debug ("%s:%s: invoking IsPaneVisible failed: %#lx",
-                 SRCNAME, __func__, hr);
-      return -1;
-    }
-  
-  return !!rVariant.boolVal;
-  
-}
-
-
-/* Set the preview pane to visible if visble is true or to invisible
-   if visible is false.  */
-void
-show_preview_pane (LPEXCHEXTCALLBACK eecb, int visible)
-{
-  HRESULT hr;      
-  LPDISPATCH pDisp;
-  DISPID dispid;
-  DISPPARAMS dispparams;
-  VARIANT aVariant[2];
-      
-  pDisp = find_outlook_property (eecb,
-                                 "Application.ActiveExplorer.ShowPane",
-                                 &dispid);
-  if (!pDisp)
-    {
-      log_debug ("%s:%s: ActiveExplorer.ShowPane NOT found\n",
-                 SRCNAME, __func__);
-      return;
-    }
-
-  dispparams.rgvarg = aVariant;
-  dispparams.rgvarg[0].vt = VT_BOOL;
-  dispparams.rgvarg[0].boolVal = !!visible;
-  dispparams.rgvarg[1].vt = VT_INT;
-  dispparams.rgvarg[1].intVal = 3; /* olPreview */
-  dispparams.cArgs = 2;
-  dispparams.cNamedArgs = 0;
-  hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
-                      DISPATCH_METHOD, &dispparams,
-                      NULL, NULL, NULL);
-  gpgol_release (pDisp);
-  pDisp = NULL;
-  if (hr != S_OK)
-    log_debug ("%s:%s: invoking ShowPane(%d) failed: %#lx",
-               SRCNAME, __func__, visible, hr);
-}
-
-
-/***
-Outlook interop – stopping user properties appearing on Outlook message print
-
-Here’s a weird one… we were adding user properties to a message using the IUserProperties interface, but whenever we did this the property would render when the message was printed. This included whenever the message was sent to a recipient within the same Exchange organisation.
-
-Last time I had to ask Microsoft PSS to help was 1992, and in that case they were nice enough to send me a handcrafted sample application on a 3.5″ floppy. This time however they got back to me in a day with this little code snippet:
-
-void MarkPropNoPrint(Outlook.MailItem message, string propertyName)
-{
-// Late Binding in .NET
-// http://support.microsoft.com/default.aspx?scid=kb;EN-US;302902
-Type userPropertyType;
-long dispidMember = 107;
-long ulPropPrintable = 0×4;
-string dispMemberName = String.Format(”[DispID={0}]“, dispidMember);
-object[] dispParams;
-Microsoft.Office.Interop.Outlook.UserProperty userProperty = message.UserProperties[propertyName];
-
-if (null == userProperty) return;
-userPropertyType = userProperty.GetType();
-
-// Call IDispatch::Invoke to get the current flags
-object flags = userPropertyType.InvokeMember(dispMemberName, System.Reflection.BindingFlags.GetProperty, null, userProperty, null);
-long lFlags = long.Parse(flags.ToString());
-
-// Remove the hidden property Printable flag
-lFlags &= ~ulPropPrintable;
-
-// Place the new flags property into an argument array
-dispParams = new object[] {lFlags};
-
-// Call IDispatch::Invoke to set the current flags
-userPropertyType.InvokeMember(dispMemberName,
-System.Reflection.BindingFlags.SetProperty, null, userProperty, dispParams);
-}
-
-Srsly… there is no way I would have worked that out for myself…
-
-*/
-
-
-
-/* HOWTO get the Window handle */
-
-/* Use FindWindow. Use the Inspector.Caption property (be aware that on long */
-/* captions the result will be truncated at about 255 characters). The class */
-/* name to use for the Inspector window is "rctrl_renwnd32". */
-
-/* I usually set any dialogs as modal to the Inspector window using */
-/* SetWindowLong, then the dialog would end up in front of the mail window, */
-/* which would be in front of the Outlook Explorer window. */
-
-

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

Summary of changes:
 src/Makefile.am                |   1 +
 src/addin-options.cpp          |   1 +
 src/attic.c                    | 147 -----------------------------------------
 src/dialogs.h                  |   3 +
 src/dispcache.cpp              | 114 ++++++++++++++++++++++++++++++++
 src/{overlay.h => dispcache.h} |  51 ++++++++------
 src/gpgoladdin.cpp             |   4 +-
 src/gpgoladdin.h               |   4 ++
 src/keycache.cpp               |   3 +-
 src/mail.cpp                   |  21 ++++++
 src/mail.h                     |   1 +
 src/mlang-charset.cpp          |  22 ++++--
 src/oomhelp.cpp                |  15 +++++
 src/oomhelp.h                  |   6 ++
 src/ribbon-callbacks.cpp       |  50 +++++++++-----
 15 files changed, 256 insertions(+), 187 deletions(-)
 delete mode 100644 src/attic.c
 create mode 100644 src/dispcache.cpp
 copy src/{overlay.h => dispcache.h} (50%)


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




More information about the Gnupg-commits mailing list