[git] GpgOL - branch, master, updated. gpgol-1.3.0-11-g14e06fe

by Andre Heinecke cvs at cvs.gnupg.org
Tue Dec 1 15:59:18 CET 2015


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  14e06fe2500a1735b2089b03231e45e63a6f40fb (commit)
       via  3b25c803cf70964b0ae32467a0165c3be7b0a980 (commit)
       via  d456bff708712a6036f58b068e021eb023cac320 (commit)
       via  d6c6d56f497874ead334aa282979a9364bf37f92 (commit)
      from  32688545e91e84d88cab9837da715861420acfd7 (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 14e06fe2500a1735b2089b03231e45e63a6f40fb
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Dec 1 15:57:06 2015 +0100

    Activate MIME style handling for PGPMessages >OL14
    
    * src/mapihelp.cpp (get_msgcls_from_pgp_lines): Remove check
      for outlook version.
    
    --
    Now that we can revert PGPMessages the reason for this check
    is no longer valid.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 17032e0..45fe276 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -544,16 +544,6 @@ get_msgcls_from_pgp_lines (LPMESSAGE message)
   ULONG tag;
   int   is_binary = 0;
 
-  if (g_ol_version_major >= 14)
-    {
-      /* XXX For now we want to ignore clearsigned and PGP/Inline
-         signed code as we still have the old body based interface
-         for those. And before we handle them we should tackle
-         some interoperability issues arising from our current
-         handling (e.g. fix the wipe to restore the PGP body) */
-      return NULL;
-    }
-
   hr = 0;
   if (!get_internetcharsetbody_tag (message, &tag) )
     {

commit 3b25c803cf70964b0ae32467a0165c3be7b0a980
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Dec 1 15:54:06 2015 +0100

    Add revert to mail class and use it instead wipe
    
    * src/mail.cpp (Mail::revert_all_mails, Mail::revert): New.
    * src/mail.h: Update accordingly.
    * src/mailitem-events.cpp (MailitemEvents::Invoke): Revert instead
      of wipe.
    
    --
    The wipe code remains intact for now. If we find out that reverting
    is the wrong approach we can fall back to wipining again by changing
    the call in mailitem-events.
    
    For now most messages will be wiped anyway as revert is only
    supported for PGPMESSAGE messages.

diff --git a/src/mail.cpp b/src/mail.cpp
index 9e81e13..8c6f56d 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -26,6 +26,7 @@
 #include "attachment.h"
 #include "mapihelp.h"
 #include "message.h"
+#include "revert.h"
 
 #include <map>
 
@@ -338,6 +339,21 @@ Mail::get_sender ()
   return m_sender;
 }
 
+int
+Mail::revert_all_mails ()
+{
+  int err = 0;
+  std::map<LPDISPATCH, Mail *>::iterator it;
+  for (it = g_mail_map.begin(); it != g_mail_map.end(); ++it)
+    {
+      if (it->second->revert ())
+        {
+          log_error ("Failed to wipe mail: %p ", it->first);
+          err++;
+        }
+    }
+  return err;
+}
 
 int
 Mail::wipe_all_mails ()
@@ -354,3 +370,25 @@ Mail::wipe_all_mails ()
     }
   return err;
 }
+
+int
+Mail::revert ()
+{
+  int err;
+  if (!m_processed)
+    {
+      return 0;
+    }
+
+  err = gpgol_mailitem_revert (m_mailitem);
+
+  if (err == -1)
+    {
+      log_error ("%s:%s: Message revert failed falling back to wipe.",
+                 SRCNAME, __func__);
+      return wipe ();
+    }
+  /* We need to reprocess the mail next time around. */
+  m_processed = false;
+  return 0;
+}
diff --git a/src/mail.h b/src/mail.h
index 0d7084d..e92ebee 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -64,6 +64,15 @@ public:
     */
   static int wipe_all_mails ();
 
+  /** @brief revert all known Mail objects.
+    *
+    * Similar to wipe but works on MAPI to revert our attachment
+    * dance and restore an original MIME mail.
+    *
+    * @returns the number of errors that occured.
+    */
+  static int revert_all_mails ();
+
   /** @brief Reference to the mailitem. Do not Release! */
   LPDISPATCH item () { return m_mailitem; }
 
@@ -101,11 +110,16 @@ public:
   /** @brief Message should be encrypted and or signed. */
   bool needs_crypto ();
 
-  /** @brief wipe the plaintext from the message and ecnrypt attachments.
+  /** @brief wipe the plaintext from the message and encrypt attachments.
    *
    * @returns 0 on success; */
   int wipe ();
 
+  /** @brief revert the message to the original mail before our changes.
+   *
+   * @returns 0 on success; */
+  int revert ();
+
   /** @brief update the sender address.
    *
    * For Exchange 2013 at least we don't have any other way to get the
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 5608356..3c99023 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -101,7 +101,6 @@ request_send (LPVOID arg)
   return 0;
 }
 
-
 /* The main Invoke function. The return value of this
    function does not appear to have any effect on outlook
    although I have read in an example somewhere that you
@@ -197,7 +196,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
              break;
            }
 
-          if (m_mail->wipe ())
+          if (m_mail->revert ())
             {
               /* An error cleaning the mail should not happen normally.
                  But just in case there is an error we cancel the

commit d456bff708712a6036f58b068e021eb023cac320
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Dec 1 15:21:03 2015 +0100

    Add mail revert implementation that works on OOM
    
    * src/revert.cpp (gpgol_mailitem_revert): Revert mail in OOM.
    * src/revert.h: Add prototype.
    
    --
    Using OOM appeared to be necessary. At least I have not found
    a way to modify the Body through MAPI in a way that it survived
    the write event. It appeared that during the Write event the
    OOM Body is synced back to mapi. Same for the attachment model
    in OOM. Some weirdeness there. Now we use OOM as much as possible.
    
    There is some duplication with the old code but I didn't want
    to touch the old code to aviod regressions. Although I doubt
    very much that the old code works correctly.
    
    For now the code returns an error for all messages apart
    from PGP Message.

diff --git a/src/revert.cpp b/src/revert.cpp
index 5e1d474..62a574f 100644
--- a/src/revert.cpp
+++ b/src/revert.cpp
@@ -233,6 +233,231 @@ gpgol_message_revert (LPMESSAGE message, LONG do_save, ULONG save_flags)
   return rc;
 }
 
+/* Helper method for mailitem_revert to add changes on the mapi side
+   and save them. */
+static int finalize_mapi (LPMESSAGE message, char *msgcls)
+{
+  char * oldmsgcls = NULL;
+  HRESULT hr;
+  SPropValue prop;
+  SPropTagArray proparray;
+  ULONG tag_id;
+  if (mapi_save_changes (message, FORCE_SAVE | KEEP_OPEN_READWRITE))
+    {
+      log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+      return -1;
+    }
+  oldmsgcls = mapi_get_old_message_class (message);
+  if (!oldmsgcls)
+    {
+      /* No saved message class, mangle the actual class.  */
+      if (!strcmp (msgcls, "IPM.Note.GpgOL.ClearSigned")
+          || !strcmp (msgcls, "IPM.Note.GpgOL.PGPMessage") )
+        msgcls[8] = 0;
+      else
+        memcpy (msgcls+9, "SMIME", 5);
+      oldmsgcls = msgcls;
+      msgcls = NULL;
+    }
+  /* Change the message class. */
+  prop.ulPropTag = PR_MESSAGE_CLASS_A;
+  prop.Value.lpszA = oldmsgcls;
+  hr = message->SetProps (1, &prop, NULL);
+  if (hr)
+    {
+      log_error ("%s:%s: can't set message class to `%s': hr=%#lx\n",
+                 SRCNAME, __func__, oldmsgcls, hr);
+      return -1;
+    }
+  if (get_gpgollastdecrypted_tag (message, &tag_id))
+    {
+      log_error ("%s:%s: can't getlastdecrypted tag",
+                 SRCNAME, __func__);
+      return -1;
+    }
+  proparray.cValues = 1;
+  proparray.aulPropTag[0] = tag_id;
+  hr = message->DeleteProps (&proparray, NULL);
+  if (hr)
+    {
+      log_error ("%s:%s: failed to delete lastdecrypted tag",
+                 SRCNAME, __func__);
+      return -1;
+    }
+  return 0;
+}
+
+/* Similar to gpgol_message_revert but works on OOM and is
+   used by the Ol > 2010 implementation.
+   Doing this through OOM was necessary as the MAPI structures
+   in the write event are not in sync with the OOM side.
+   Trying to revert in the AfterWrite where MAPI is synced
+   led to an additional save_changes after the wipe and
+   so an additional sync.
+   Updating the BODY through MAPI did not appear to work
+   at all. Not sure why this is the case.
+   Using the property accessor methods instead of
+   MAPI properties might also not be necessary.
+
+   Returns 0 on success, -1 on error. On error this
+   function might leave plaintext in the mail.    */
+EXTERN_C LONG __stdcall
+gpgol_mailitem_revert (LPDISPATCH mailitem)
+{
+  LPDISPATCH attachments = NULL;
+  LPMESSAGE message = NULL;
+  char *item_str;
+  char *msgcls = NULL;
+  int i;
+  int count = 0;
+  LONG result = -1;
+  msgtype_t msgtype;
+
+  /* Check whether we need to care about this message.  */
+  msgcls = get_pa_string (mailitem, PR_MESSAGE_CLASS_W_DASL);
+  log_debug ("%s:%s: message class is `%s'\n",
+             SRCNAME, __func__, msgcls? msgcls:"[none]");
+  if ( !( !strncmp (msgcls, "IPM.Note.GpgOL", 14)
+          && (!msgcls[14] || msgcls[14] == '.') ) )
+    {
+      xfree (msgcls);
+      log_error ("%s:%s: Message processed but not our class. Bug.",
+                 SRCNAME, __func__);
+      return 0;  /* Not one of our message classes.  */
+    }
+
+  message = get_oom_base_message (mailitem);
+  attachments = get_oom_object (mailitem, "Attachments");
+
+  if (!message)
+    {
+      log_error ("%s:%s: No message object.",
+                 SRCNAME, __func__);
+      goto done;
+    }
+
+  if (!attachments)
+    {
+      log_error ("%s:%s: No attachments object.",
+                 SRCNAME, __func__);
+      goto done;
+    }
+  msgtype = mapi_get_message_type (message);
+
+  if (msgtype != MSGTYPE_GPGOL_PGP_MESSAGE)
+    {
+      log_error ("%s:%s: Revert not supported for msgtype: %i",
+                 SRCNAME, __func__, msgtype);
+      goto done;
+    }
+
+  count = get_oom_int (attachments, "Count");
+
+  if (count < 1)
+    {
+      log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+      goto done;
+    }
+
+  /* Yes the items start at 1! */
+  for (i = 1; i <= count; i++)
+    {
+      LPDISPATCH attachment;
+      attachtype_t att_type;
+
+      if (gpgrt_asprintf (&item_str, "Item(%i)", i) == -1)
+        {
+          log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+          goto done;
+        }
+
+      attachment = get_oom_object (attachments, item_str);
+      xfree (item_str);
+      if (!attachment)
+        {
+          log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+          goto done;
+        }
+
+      if (get_pa_int (attachment, GPGOL_ATTACHTYPE_DASL, (int*) &att_type))
+        {
+          log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+          goto done;
+        }
+
+      switch (att_type)
+        {
+          case ATTACHTYPE_PGPBODY:
+            {
+              /* Restore Body */
+              char *body = get_pa_string (attachment, PR_ATTACH_DATA_BIN_DASL);
+              if (!body)
+                {
+                  log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+                  RELDISP (attachment);
+                  goto done;
+                }
+              log_debug ("%s:%s: Restoring pgp-body.",
+                         SRCNAME, __func__);
+              if (put_oom_string (mailitem, "Body", body))
+                {
+                  log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+                  xfree (body);
+                  RELDISP (attachment);
+                  goto done;
+                }
+              xfree (body);
+            } /* No break we also want to delete that. */
+          case ATTACHTYPE_FROMMOSS:
+          case ATTACHTYPE_FROMMOSS_DEC:
+            {
+              if (invoke_oom_method (attachment, "Delete", NULL))
+                {
+                  log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+                  RELDISP (attachment);
+                  goto done;
+                }
+              i--;
+              count--;
+              break;
+            }
+          case ATTACHTYPE_MOSS:
+            {
+              VARIANT value;
+              VariantInit (&value);
+              value.vt = VT_BOOL;
+              value.boolVal = VARIANT_FALSE;
+              if (set_pa_variant (attachment, PR_ATTACHMENT_HIDDEN_DASL,
+                                  &value))
+                {
+                  log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+                  RELDISP (attachment);
+                  goto done;
+                }
+              put_oom_string (mailitem, "Body", "");
+              break;
+            }
+          default:
+            log_error ("%s:%s: Unknown attachment type: %i",
+                       SRCNAME, __func__, att_type);
+        }
+      RELDISP (attachment);
+    }
+
+  if (finalize_mapi (message, msgcls))
+    {
+      log_error ("%s:%s: Finalize failed.",
+                 SRCNAME, __func__);
+      goto done;
+    }
+  result = 0;
+done:
+  RELDISP (message);
+  xfree (msgcls);
+  RELDISP (attachments);
+
+  return result;
+}
 
 /* Revert all messages in the MAPIFOLDEROBJ.  */
 EXTERN_C LONG __stdcall
diff --git a/src/revert.h b/src/revert.h
index abec778..6aa18e0 100644
--- a/src/revert.h
+++ b/src/revert.h
@@ -24,6 +24,8 @@ EXTERN_C LONG __stdcall gpgol_message_revert (LPMESSAGE message,
                                               LONG do_save,
                                               ULONG save_flags);
 
+EXTERN_C LONG __stdcall gpgol_mailitem_revert (LPDISPATCH mailitem);
+
 EXTERN_C LONG __stdcall gpgol_folder_revert (LPDISPATCH mapifolderobj);
 
 

commit d6c6d56f497874ead334aa282979a9364bf37f92
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Dec 1 15:15:46 2015 +0100

    Add OOM PropertyAccessor helper methods
    
    * src/oomhelp.cpp (set_pa_variant): New. Set a property.
      (get_pa_int): New. Get an int property.
      (get_pa_variant): New. Get a generic property as variant.
      (get_pa_string): Refactored to use get_pa_variant.
    * src/oomhelp.h: Add prototpyes and DASL defs.
    
    --
    This code might not be necessary as you mainly can access
    MAPI directly. But it can be useful in case MAPI is out of
    sync and gives weird values. This is added mostly as an
    experiment for now as MAPI is usually easier to use.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 83cc344..3a5de17 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -790,34 +790,97 @@ get_oom_context_window (LPDISPATCH context)
   return ret;
 }
 
-
-/* Get a property string by using the PropertyAccessor of pDisp
- * returns NULL on error or a newly allocated result. */
-char *
-get_pa_string (LPDISPATCH pDisp, const char *property)
+int set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value)
 {
   LPDISPATCH propertyAccessor;
-  VARIANT rVariant,
-          cVariant[1];
+  VARIANT cVariant[2];
+  VARIANT rVariant;
+  DISPID dispid;
+  DISPPARAMS dispparams;
+  HRESULT hr;
+  EXCEPINFO execpinfo;
   BSTR b_property;
+  wchar_t *w_property;
+  unsigned int argErr = 0;
+
+  log_oom ("%s:%s: Looking up property: %s;",
+             SRCNAME, __func__, dasl_id);
+
+  propertyAccessor = get_oom_object (pDisp, "PropertyAccessor");
+  if (!propertyAccessor)
+    {
+      log_error ("%s:%s: Failed to look up property accessor.",
+                 SRCNAME, __func__);
+      return -1;
+    }
+
+  dispid = lookup_oom_dispid (propertyAccessor, "SetProperty");
+
+  if (dispid == DISPID_UNKNOWN)
+  {
+    log_error ("%s:%s: could not find SetProperty DISPID",
+               SRCNAME, __func__);
+    return -1;
+  }
+
+  /* Prepare the parameter */
+  w_property = utf8_to_wchar (dasl_id);
+  b_property = SysAllocString (w_property);
+  xfree (w_property);
+
+  cVariant[1].vt = VT_BSTR;
+  cVariant[1].bstrVal = b_property;
+  VariantCopy (&cVariant[0], value);
+  dispparams.rgvarg = cVariant;
+  dispparams.cArgs = 2;
+  dispparams.cNamedArgs = 0;
+  VariantInit (&rVariant);
+
+  hr = propertyAccessor->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
+                                 DISPATCH_METHOD, &dispparams,
+                                 &rVariant, &execpinfo, &argErr);
+  SysFreeString (b_property);
+  RELDISP (propertyAccessor);
+  if (hr != S_OK)
+    {
+      log_debug ("%s:%s: error: invoking SetProperty p=%p vt=%d"
+                 " hr=0x%x argErr=0x%x",
+                 SRCNAME, __func__,
+                 rVariant.pdispVal, rVariant.vt, (unsigned int)hr,
+                 (unsigned int)argErr);
+      dump_excepinfo (execpinfo);
+      VariantClear (&rVariant);
+      return -1;
+    }
+  return 0;
+}
+
+/* Get a MAPI property through OOM using the PropertyAccessor
+ * interface and the DASL Uid. Returns -1 on error.
+ * Variant has to be cleared with VariantClear.
+ * rVariant must be a pointer to a Variant.
+ */
+int get_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *rVariant)
+{
+  LPDISPATCH propertyAccessor;
+  VARIANT cVariant[1];
   DISPID dispid;
   DISPPARAMS dispparams;
   HRESULT hr;
   EXCEPINFO execpinfo;
+  BSTR b_property;
   wchar_t *w_property;
   unsigned int argErr = 0;
-  char *result = NULL;
 
-  log_debug ("%s:%s: Looking up property: %s;",
-             SRCNAME, __func__, property);
+  log_oom ("%s:%s: Looking up property: %s;",
+             SRCNAME, __func__, dasl_id);
 
   propertyAccessor = get_oom_object (pDisp, "PropertyAccessor");
   if (!propertyAccessor)
     {
       log_error ("%s:%s: Failed to look up property accessor.",
                  SRCNAME, __func__);
-      /* Fall back to address field on error. */
-      return NULL;
+      return -1;
     }
 
   dispid = lookup_oom_dispid (propertyAccessor, "GetProperty");
@@ -826,11 +889,11 @@ get_pa_string (LPDISPATCH pDisp, const char *property)
   {
     log_error ("%s:%s: could not find GetProperty DISPID",
                SRCNAME, __func__);
-    return NULL;
+    return -1;
   }
 
   /* Prepare the parameter */
-  w_property = utf8_to_wchar (property);
+  w_property = utf8_to_wchar (dasl_id);
   b_property = SysAllocString (w_property);
   xfree (w_property);
 
@@ -839,34 +902,99 @@ get_pa_string (LPDISPATCH pDisp, const char *property)
   dispparams.rgvarg = cVariant;
   dispparams.cArgs = 1;
   dispparams.cNamedArgs = 0;
-  VariantInit (&rVariant);
+  VariantInit (rVariant);
 
   hr = propertyAccessor->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
                                  DISPATCH_METHOD, &dispparams,
-                                 &rVariant, &execpinfo, &argErr);
+                                 rVariant, &execpinfo, &argErr);
+  SysFreeString (b_property);
+  RELDISP (propertyAccessor);
   if (hr != S_OK)
     {
-      log_debug ("%s:%s: error: invoking GetPrperty p=%p vt=%d hr=0x%x argErr=0x%x",
+      log_debug ("%s:%s: error: invoking GetProperty p=%p vt=%d"
+                 " hr=0x%x argErr=0x%x",
                  SRCNAME, __func__,
-                 rVariant.pdispVal, rVariant.vt, (unsigned int)hr,
+                 rVariant->pdispVal, rVariant->vt, (unsigned int)hr,
                  (unsigned int)argErr);
       dump_excepinfo (execpinfo);
+      VariantClear (rVariant);
+      return -1;
+    }
+  return 0;
+}
+
+/* Get a property string by using the PropertyAccessor of pDisp
+ * returns NULL on error or a newly allocated result. */
+char *
+get_pa_string (LPDISPATCH pDisp, const char *property)
+{
+  VARIANT rVariant;
+  char *result = NULL;
+
+  if (get_pa_variant (pDisp, property, &rVariant))
+    {
+      return NULL;
+    }
+
+  if (rVariant.vt == VT_BSTR && rVariant.bstrVal)
+    {
+      result = wchar_to_utf8 (rVariant.bstrVal);
+    }
+  else if (rVariant.vt & VT_ARRAY && !(rVariant.vt & VT_BYREF))
+    {
+      LONG uBound, lBound;
+      VARTYPE vt;
+      char *data;
+      SafeArrayGetVartype(rVariant.parray, &vt);
+
+      if (SafeArrayGetUBound (rVariant.parray, 1, &uBound) != S_OK ||
+          SafeArrayGetLBound (rVariant.parray, 1, &lBound) != S_OK ||
+          vt != VT_UI1)
+        {
+          log_error ("%s:%s: Error: %i", SRCNAME, __func__, __LINE__);
+          VariantClear (&rVariant);
+          return NULL;
+        }
+
+      result = (char *)xmalloc (uBound - lBound + 1);
+      data = (char *) rVariant.parray->pvData;
+      memcpy (result, data + lBound, uBound - lBound);
+      result[uBound - lBound] = '\0';
+    }
+  else
+    {
+      log_debug ("%s:%s: Property `%s' is not a string (vt=%d)",
+                 SRCNAME, __func__, property, rVariant.vt);
     }
-  else if (rVariant.vt != VT_BSTR)
-    log_debug ("%s:%s: Property `%s' is not a string (vt=%d)",
-               SRCNAME, __func__, property, rVariant.vt);
-  else if (rVariant.bstrVal)
-    result = wchar_to_utf8 (rVariant.bstrVal);
 
-  SysFreeString (b_property);
-  RELDISP (propertyAccessor);
   VariantClear (&rVariant);
 
-  log_debug ("%s:%s: Lookup result: %s;",
-             SRCNAME, __func__, result);
   return result;
 }
 
+int
+get_pa_int (LPDISPATCH pDisp, const char *property, int *rInt)
+{
+  VARIANT rVariant;
+
+  if (get_pa_variant (pDisp, property, &rVariant))
+    {
+      return -1;
+    }
+
+  if (rVariant.vt != VT_I4)
+    {
+      log_debug ("%s:%s: Property `%s' is not a int (vt=%d)",
+                 SRCNAME, __func__, property, rVariant.vt);
+      return -1;
+    }
+
+  *rInt = rVariant.lVal;
+
+  VariantClear (&rVariant);
+  return 0;
+}
+
 /* Gets a malloced NULL terminated array of recipent strings from
    an OOM recipients Object. */
 char **
diff --git a/src/oomhelp.h b/src/oomhelp.h
index 9d2a3b3..66cff65 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -78,9 +78,22 @@ DEFINE_OLEGUID(IID_IDispatch,                 0x00020400, 0, 0);
 DEFINE_OLEGUID(IID_IOleWindow,                0x00000114, 0, 0);
 
 #ifndef PR_SMTP_ADDRESS_DASL
-#define PR_SMTP_ADDRESS_DASL "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
+#define PR_SMTP_ADDRESS_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
 #endif
 
+#define PR_MESSAGE_CLASS_W_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x001A001F"
+#define GPGOL_ATTACHTYPE_DASL \
+  "http://schemas.microsoft.com/mapi/string/" \
+  "{31805AB8-3E92-11DC-879C-00061B031004}/GpgOL Attach Type/0x00000003"
+#define PR_ATTACH_DATA_BIN_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x37010102"
+#define PR_BODY_W_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x1000001F"
+#define PR_ATTACHMENT_HIDDEN_DASL \
+  "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"
+
 #ifdef __cplusplus
 extern "C" {
 #if 0
@@ -145,6 +158,23 @@ add_oom_attachment (LPDISPATCH disp, wchar_t* inFile);
 char *
 get_pa_string (LPDISPATCH pDisp, const char *property);
 
+/* Look up a long with the propertyAccessor interface.
+ returns -1 on error.*/
+int
+get_pa_int (LPDISPATCH pDisp, const char *property, int *rInt);
+
+/* Set a variant with the propertyAccessor interface */
+int
+set_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *value);
+
+/* Look up a variant with the propertyAccessor interface */
+int
+get_pa_variant (LPDISPATCH pDisp, const char *dasl_id, VARIANT *rVariant);
+
+/* Look up a LONG with the propertyAccessor interface */
+LONG
+get_pa_long (LPDISPATCH pDisp, const char *dasl_id);
+
 /* Queries the interface of the dispatcher for the id
    id. Returns NULL on error. The returned Object
    must be released.

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

Summary of changes:
 src/mail.cpp            |  38 ++++++++
 src/mail.h              |  16 +++-
 src/mailitem-events.cpp |   3 +-
 src/mapihelp.cpp        |  10 ---
 src/oomhelp.cpp         | 182 +++++++++++++++++++++++++++++++++------
 src/oomhelp.h           |  32 ++++++-
 src/revert.cpp          | 225 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/revert.h            |   2 +
 8 files changed, 467 insertions(+), 41 deletions(-)


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




More information about the Gnupg-commits mailing list