[git] GpgOL - branch, master, updated. gpgol-1.2.0-80-geb54d1f

by Andre Heinecke cvs at cvs.gnupg.org
Fri Oct 30 18:26:11 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  eb54d1fb786b2944d787ee764f99843bbfab2641 (commit)
      from  6f2f9a3042f856ec54ec89808cb204f0b9dcd058 (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 eb54d1fb786b2944d787ee764f99843bbfab2641
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Oct 30 18:24:10 2015 +0100

    Fix from address lookup for exchange
    
    * src/mapihelp.cpp (mapi_get_from_address): Try additional SMTP
      tags before falling back to EMAIL tag.
    * src/mymapitags.h (PidTagSenderSmtpAddress_W),
     (PR_SENT_REPRESENTING_SMTP_ADDRESS_W): Define property ids.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index fed0848..abd5d9b 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -1474,18 +1474,34 @@ mapi_get_from_address (LPMESSAGE message)
   HRESULT hr;
   LPSPropValue propval = NULL;
   char *buf;
-  
+  ULONG try_props[3] = {PidTagSenderSmtpAddress_W,
+                        PR_SENT_REPRESENTING_SMTP_ADDRESS_W,
+                        PR_SENDER_EMAIL_ADDRESS_W};
+
   if (!message)
     return xstrdup ("[no message]"); /* Ooops.  */
 
-  hr = HrGetOneProp ((LPMAPIPROP)message, PR_SENDER_EMAIL_ADDRESS_W, &propval);
+  for (int i = 0; i < 3; i++)
+    {
+      /* We try to get different properties first as they contain
+         the SMTP address of the sender. EMAIL address can be
+         some LDAP stuff for exchange. */
+      hr = HrGetOneProp ((LPMAPIPROP)message, try_props[i],
+                         &propval);
+      if (!FAILED (hr))
+        {
+          break;
+        }
+    }
+   /* This is the last result that should always work but not necessarily
+      contain an SMTP Address. */
   if (FAILED (hr))
     {
       log_debug ("%s:%s: HrGetOneProp failed: hr=%#lx\n",
                  SRCNAME, __func__, hr);
       return NULL;
     }
-    
+
   if (PROP_TYPE (propval->ulPropTag) != PT_UNICODE) 
     {
       log_debug ("%s:%s: HrGetOneProp returns invalid type %lu\n",
diff --git a/src/mymapitags.h b/src/mymapitags.h
index c85ce37..c2d6e4f 100644
--- a/src/mymapitags.h
+++ b/src/mymapitags.h
@@ -841,6 +841,10 @@
 #define PR_SMTP_ADDRESS                       PROP_TAG( PT_TSTRING,     0x39fe)
 #define PR_SMTP_ADDRESS_W                     PROP_TAG( PT_UNICODE,     0x39fe)
 #define PR_SMTP_ADDRESS_A                     PROP_TAG( PT_STRING8,     0x39fe)
+#define PR_SENT_REPRESENTING_SMTP_ADDRESS     PROP_TAG( PT_TSTRING,     0x5d02)
+#define PR_SENT_REPRESENTING_SMTP_ADDRESS_A   PROP_TAG( PT_STRING8,     0x5d02)
+#define PR_SENT_REPRESENTING_SMTP_ADDRESS_W   PROP_TAG( PT_UNICODE,     0x5d02)
+#define PidTagSenderSmtpAddress_W             PROP_TAG( PT_UNICODE,     0x5d01)
 
 #define PROP_ID_SECURE_MIN                0x67F0
 #define PROP_ID_SECURE_MAX                0x67FF

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

Summary of changes:
 src/mapihelp.cpp | 22 +++++++++++++++++++---
 src/mymapitags.h |  4 ++++
 2 files changed, 23 insertions(+), 3 deletions(-)


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




More information about the Gnupg-commits mailing list