[evolution-mapi/evolution-mapi-3-12] Bug #729028 - Adapt to OpenChange 2.1 API changes



commit aa0a1d41f0f195ad15003d09c78f4a9c8dddb22f
Author: Jordi Mallach <jordi debian org>
Date:   Mon Apr 28 11:04:44 2014 +0200

    Bug #729028 - Adapt to OpenChange 2.1 API changes

 configure.ac                               |   14 ++++++++
 src/configuration/e-mapi-search-gal-user.c |    8 ++--
 src/libexchangemapi/e-mapi-book-utils.c    |    8 ++--
 src/libexchangemapi/e-mapi-cal-utils.c     |    6 +---
 src/libexchangemapi/e-mapi-connection.c    |    4 +-
 src/libexchangemapi/e-mapi-fast-transfer.c |   47 +++++++++++++++++----------
 src/libexchangemapi/e-mapi-mail-utils.c    |    5 +--
 7 files changed, 55 insertions(+), 37 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ed984e9..5dda6fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -189,6 +189,20 @@ LIBS=$save_libs
 AC_MSG_RESULT([$ac_cv_have_rns])
 
 dnl ****************************
+dnl Check for OpenChange 2.1 fast-transfer tags availability
+dnl ****************************
+AC_MSG_CHECKING([libmapi fast-transfer tags])
+save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
+save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
+       [[#include <libmapi/libmapi.h>]],
+       [[uint32_t tag; tag = StartMessage; tag = EndMessage; tag = StartRecip; tag = EndToRecip; tag = 
NewAttach; tag = EndAttach; tag = StartEmbed; tag = EndEmbed;]])],
+       [AC_DEFINE(HAVE_FAST_TRANSFER_TAGS_2_1, 1, [libmapi supports fast-transfer tags from OpenChange 2.1]) 
ac_cv_have_ftt21=yes],[ac_cv_have_ftt21=no])
+CFLAGS=$save_cflags
+LIBS=$save_libs
+AC_MSG_RESULT([$ac_cv_have_ftt21])
+
+dnl ****************************
 dnl Expose version information
 dnl ****************************
 API_VERSION=$EDS_PACKAGE
diff --git a/src/configuration/e-mapi-search-gal-user.c b/src/configuration/e-mapi-search-gal-user.c
index bc084be..1512d2a 100644
--- a/src/configuration/e-mapi-search-gal-user.c
+++ b/src/configuration/e-mapi-search-gal-user.c
@@ -270,8 +270,8 @@ build_gal_search_restriction_cb (EMapiConnection *conn,
 
        restriction->res.resOr.res[1].rt = RES_CONTENT;
        restriction->res.resOr.res[1].res.resContent.fuzzy = FL_SUBSTRING | FL_IGNORECASE;
-       restriction->res.resOr.res[1].res.resContent.ulPropTag = PidTagPrimarySmtpAddress;
-       restriction->res.resOr.res[1].res.resContent.lpProp.ulPropTag = PidTagPrimarySmtpAddress;
+       restriction->res.resOr.res[1].res.resContent.ulPropTag = PidTagSmtpAddress;
+       restriction->res.resOr.res[1].res.resContent.lpProp.ulPropTag = PidTagSmtpAddress;
        restriction->res.resOr.res[1].res.resContent.lpProp.value.lpszW = talloc_strdup (mem_ctx, 
search_text);
 
        *restrictions = restriction;
@@ -316,7 +316,7 @@ search_gal_build_properties_cb (EMapiConnection *conn,
 
        SPropTagArray_add (mem_ctx, props, PidTagEntryId);
        SPropTagArray_add (mem_ctx, props, PidTagDisplayName);
-       SPropTagArray_add (mem_ctx, props, PidTagPrimarySmtpAddress);
+       SPropTagArray_add (mem_ctx, props, PidTagSmtpAddress);
        SPropTagArray_add (mem_ctx, props, PidTagEmailAddress);
 
        return TRUE;
@@ -341,7 +341,7 @@ transfer_gal_search_objects_cb (EMapiConnection *conn,
        g_return_val_if_fail (sid != NULL, FALSE);
 
        display_name = e_mapi_util_find_array_propval (&object->properties, PidTagDisplayName);
-       email = e_mapi_util_find_array_propval (&object->properties, PidTagPrimarySmtpAddress);
+       email = e_mapi_util_find_array_propval (&object->properties, PidTagSmtpAddress);
        entry_id = e_mapi_util_find_array_propval (&object->properties, PidTagEntryId);
        user_dn = e_mapi_util_find_array_propval (&object->properties, PidTagEmailAddress);
 
diff --git a/src/libexchangemapi/e-mapi-book-utils.c b/src/libexchangemapi/e-mapi-book-utils.c
index 99226ff..7b70669 100644
--- a/src/libexchangemapi/e-mapi-book-utils.c
+++ b/src/libexchangemapi/e-mapi-book-utils.c
@@ -95,7 +95,7 @@ static const uint32_t extra_proptags[] = {
        PidTagStateOrProvince,
        PidTagPostalCode,
        PidTagCountry,
-       PidTagPrimarySmtpAddress,
+       PidTagSmtpAddress,
        PidTagFolderId
 };
 
@@ -371,7 +371,7 @@ e_mapi_book_utils_contact_from_object (EMapiConnection *conn,
 
        email_1 = e_contact_get (contact, E_CONTACT_EMAIL_1);
        if (!email_1) {
-               gconstpointer value = get_proptag (PidTagPrimarySmtpAddress);
+               gconstpointer value = get_proptag (PidTagSmtpAddress);
 
                if (value)
                        e_contact_set (contact, E_CONTACT_EMAIL_1, value);
@@ -1009,7 +1009,7 @@ func_eval_text_compare (struct _ESExp *f,
                                res->res.resOr.cRes = 4;
                                res->res.resOr.res = talloc_zero_array (esp->mem_ctx, struct 
mapi_SRestriction_or, res->res.resOr.cRes + 1);
 
-                               proptag = PidTagPrimarySmtpAddress;
+                               proptag = PidTagSmtpAddress;
                                res->res.resOr.res[0].rt = RES_CONTENT;
                                res->res.resOr.res[0].res.resContent.fuzzy = fuzzy | FL_IGNORECASE;
                                res->res.resOr.res[0].res.resContent.ulPropTag = proptag;
@@ -1115,7 +1115,7 @@ func_eval_field_exists (struct _ESExp *f,
                        res->res.resOr.res = talloc_zero_array (esp->mem_ctx, struct mapi_SRestriction_or, 
res->res.resOr.cRes + 1);
 
                        res->res.resOr.res[0].rt = RES_EXIST;
-                       res->res.resOr.res[0].res.resExist.ulPropTag = PidTagPrimarySmtpAddress;
+                       res->res.resOr.res[0].res.resExist.ulPropTag = PidTagSmtpAddress;
 
                        for (ii = 1, jj = 0; emails[jj]; jj++) {
                                proptag = get_proptag_from_field_name (emails[jj], TRUE);
diff --git a/src/libexchangemapi/e-mapi-cal-utils.c b/src/libexchangemapi/e-mapi-cal-utils.c
index 75ec6f2..3170899 100644
--- a/src/libexchangemapi/e-mapi-cal-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-utils.c
@@ -686,11 +686,10 @@ populate_ical_attendees (EMapiConnection *conn,
                PidTagNickname,
                PidTagRecipientDisplayName,
                PidTagDisplayName,
-               PidTag7BitDisplayName
+               PidTagAddressBookDisplayNamePrintable
        };
 
        const uint32_t email_proptags[] = {
-               PidTagPrimarySmtpAddress,
                PidTagSmtpAddress
        };
 
@@ -1352,7 +1351,6 @@ e_mapi_cal_utils_add_organizer (EMapiObject *object,
                set_value (PidTagEmailAddress, email);
 
                set_value (PidTagSmtpAddress, email);
-               set_value (PidTagPrimarySmtpAddress, email);
 
                ui32 = 0;
                set_value (PidTagSendInternetEncoding, &ui32);
@@ -1433,9 +1431,7 @@ e_mapi_cal_utils_add_recipients (EMapiObject *object,
 
                set_value (PidTagAddressType, "SMTP");
                set_value (PidTagEmailAddress, email);
-
                set_value (PidTagSmtpAddress, email);
-               set_value (PidTagPrimarySmtpAddress, email);
 
                ui32 = 0;
                set_value (PidTagSendInternetEncoding, &ui32);
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index dc73408..5ae1aab 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -3756,7 +3756,7 @@ add_object_recipients (EMapiConnection *conn,
 
        count = 0;
        for (recipient = recipients, ii = 0; recipient; recipient = recipient->next, ii++) {
-               if (!e_mapi_util_find_array_propval (&recipient->properties, PidTagPrimarySmtpAddress)
+               if (!e_mapi_util_find_array_propval (&recipient->properties, PidTagSmtpAddress)
                    && !e_mapi_util_find_array_propval (&recipient->properties, PidTagDisplayName))
                        g_debug ("%s: Cannot get email or display name for a recipient %d, skipping it", 
G_STRFUNC, ii);
                else
@@ -3777,7 +3777,7 @@ add_object_recipients (EMapiConnection *conn,
        }
 
        for (ii = 0, jj = 0, recipient = recipients; ii < count && recipient != NULL; ii++, recipient = 
recipient->next) {
-               users[ii] = e_mapi_util_find_array_propval (&recipient->properties, PidTagPrimarySmtpAddress);
+               users[ii] = e_mapi_util_find_array_propval (&recipient->properties, PidTagSmtpAddress);
                if (!users[ii])
                        users[ii] = e_mapi_util_find_array_propval (&recipient->properties, 
PidTagDisplayName);
                if (!users[ii]) {
diff --git a/src/libexchangemapi/e-mapi-fast-transfer.c b/src/libexchangemapi/e-mapi-fast-transfer.c
index 298839b..05fb207 100644
--- a/src/libexchangemapi/e-mapi-fast-transfer.c
+++ b/src/libexchangemapi/e-mapi-fast-transfer.c
@@ -30,6 +30,17 @@
 
 #include "e-mapi-fast-transfer.h"
 
+#ifndef HAVE_FAST_TRANSFER_TAGS_2_1
+#define StartMessage PidTagStartMessage
+#define EndMessage PidTagEndMessage
+#define StartRecip PidTagStartRecip
+#define EndToRecip PidTagEndToRecip
+#define NewAttach PidTagNewAttach
+#define EndAttach PidTagEndAttach
+#define StartEmbed PidTagStartEmbed
+#define EndEmbed PidTagEndEmbed
+#endif
+
 struct _EMapiFXParserClosure;
 typedef struct _EMapiFXParserClosure EMapiFXParserClosure;
 
@@ -107,9 +118,9 @@ parse_marker_cb (uint32_t marker, void *closure)
 
        /* g_print ("\tMarker: %s (0x%08x)\n", get_proptag_name (marker), marker); */
        switch (marker) {
-               case PidTagStartMessage:
+               case StartMessage:
                        if (data->object) {
-                               g_debug ("%s: PidTagStartMessage: out of order, previous object not finished 
yet", G_STRFUNC);
+                               g_debug ("%s: StartMessage: out of order, previous object not finished yet", 
G_STRFUNC);
                                e_mapi_object_finish_read (data->object);
                                stop = !process_parsed_object (data);
                                e_mapi_object_free (data->object);
@@ -134,9 +145,9 @@ parse_marker_cb (uint32_t marker, void *closure)
                        data->current_streamed_properties_count = &data->object->streamed_properties_count;
                        data->marker = marker;
                        break;
-               case PidTagEndMessage:
+               case EndMessage:
                        if (!data->object) {
-                               g_debug ("%s: PidTagEndMessage no object started", G_STRFUNC);
+                               g_debug ("%s: EndMessage no object started", G_STRFUNC);
                        } else {
                                e_mapi_object_finish_read (data->object);
                                stop = !process_parsed_object (data);
@@ -154,9 +165,9 @@ parse_marker_cb (uint32_t marker, void *closure)
                        }
                        data->marker = 0;
                        break;
-               case PidTagStartRecip:
+               case StartRecip:
                        if (!data->current_object) {
-                               g_debug ("%s: PidTagStartRecip no object started", G_STRFUNC);
+                               g_debug ("%s: StartRecip no object started", G_STRFUNC);
                        } else {
                                EMapiRecipient *recipient;
 
@@ -173,16 +184,16 @@ parse_marker_cb (uint32_t marker, void *closure)
                        }
                        data->marker = marker;
                        break;
-               case PidTagEndToRecip:
+               case EndToRecip:
                        data->current_properties = NULL;
                        data->current_streamed_mem_ctx = NULL;
                        data->current_streamed_properties = NULL;
                        data->current_streamed_properties_count = NULL;
                        data->marker = 0;
                        break;
-               case PidTagNewAttach:
+               case NewAttach:
                        if (!data->current_object) {
-                               g_debug ("%s: PidTagNewAttach no object started", G_STRFUNC);
+                               g_debug ("%s: NewAttach no object started", G_STRFUNC);
                        } else {
                                EMapiAttachment *attachment;
 
@@ -199,20 +210,20 @@ parse_marker_cb (uint32_t marker, void *closure)
                        }
                        data->marker = marker;
                        break;
-               case PidTagEndAttach:
+               case EndAttach:
                        data->current_properties = NULL;
                        data->current_streamed_mem_ctx = NULL;
                        data->current_streamed_properties = NULL;
                        data->current_streamed_properties_count = NULL;
                        data->marker = 0;
                        break;
-               case PidTagStartEmbed:
+               case StartEmbed:
                        if (!data->current_object) {
-                               g_debug ("%s: PidTagStartEmbed no object started", G_STRFUNC);
+                               g_debug ("%s: StartEmbed no object started", G_STRFUNC);
                        } else if (!data->current_object->attachments) {
-                               g_debug ("%s: PidTagStartEmbed no attachment started", G_STRFUNC);
+                               g_debug ("%s: StartEmbed no attachment started", G_STRFUNC);
                        } else if (data->current_object->attachments->embedded_object) {
-                               g_debug ("%s: PidTagStartEmbed attachment has embedded object already", 
G_STRFUNC);
+                               g_debug ("%s: StartEmbed attachment has embedded object already", G_STRFUNC);
                        } else {
                                EMapiObject *object;
 
@@ -228,11 +239,11 @@ parse_marker_cb (uint32_t marker, void *closure)
                        }
                        data->marker = marker;
                        break;
-               case PidTagEndEmbed:
+               case EndEmbed:
                        if (!data->current_object) {
-                               g_debug ("%s: PidTagEndEmbed no object started", G_STRFUNC);
+                               g_debug ("%s: EndEmbed no object started", G_STRFUNC);
                        } else if (!data->current_object->parent) {
-                               g_debug ("%s: PidTagEndEmbed no parent object", G_STRFUNC);
+                               g_debug ("%s: EndEmbed no parent object", G_STRFUNC);
                        } else {
                                e_mapi_object_finish_read (data->current_object);
                                data->current_object = data->current_object->parent;
@@ -397,7 +408,7 @@ e_mapi_fast_transfer_internal (EMapiConnection *conn,
                data.current_streamed_mem_ctx = data.object;
                data.current_streamed_properties = &data.object->streamed_properties;
                data.current_streamed_properties_count = &data.object->streamed_properties_count;
-               data.marker = PidTagStartMessage;
+               data.marker = StartMessage;
        }
                
        parser = fxparser_init (data.mem_ctx, &data);
diff --git a/src/libexchangemapi/e-mapi-mail-utils.c b/src/libexchangemapi/e-mapi-mail-utils.c
index 479777a..0622571 100644
--- a/src/libexchangemapi/e-mapi-mail-utils.c
+++ b/src/libexchangemapi/e-mapi-mail-utils.c
@@ -112,11 +112,10 @@ e_mapi_mail_utils_decode_recipients (EMapiConnection *conn,
                PidTagNickname,
                PidTagDisplayName,
                PidTagRecipientDisplayName,
-               PidTag7BitDisplayName
+               PidTagAddressBookDisplayNamePrintable
        };
 
        const uint32_t email_proptags[] = {
-               PidTagPrimarySmtpAddress,
                PidTagSmtpAddress
        };
 
@@ -987,9 +986,7 @@ e_mapi_mail_add_recipients (EMapiObject *object,
                if (email && *email) {
                        set_value (PidTagAddressType, "SMTP");
                        set_value (PidTagEmailAddress, email);
-
                        set_value (PidTagSmtpAddress, email);
-                       set_value (PidTagPrimarySmtpAddress, email);
                }
 
                ui32 = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]