[evolution-mapi] Adapt to recent openchange svn trunk
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Adapt to recent openchange svn trunk
- Date: Fri, 9 Jul 2010 09:04:12 +0000 (UTC)
commit 58c6252a3c3622a2ac1d870ae27812c719af2f17
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 9 11:03:43 2010 +0200
Adapt to recent openchange svn trunk
configure.ac | 14 ++++++++++++
src/calendar/e-cal-backend-mapi.c | 28 +++++++++++++++++++++--
src/camel/camel-mapi-folder.c | 11 ++++++++-
src/libexchangemapi/exchange-mapi-cal-utils.c | 10 +++++++-
src/libexchangemapi/exchange-mapi-connection.c | 12 ++++++++-
5 files changed, 68 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1e17704..fbb99b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,6 +219,20 @@ LIBS=$save_libs
AC_MSG_RESULT([$ac_cv_have_mocs])
dnl ****************************
+dnl Check for cast_mapi_SPropValue function with three params
+dnl ****************************
+AC_MSG_CHECKING([libmapi cast_mapi_SPropValue function with three params])
+save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
+save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[#include <libmapi/libmapi.h>]],
+ [[cast_mapi_SPropValue (NULL, NULL, NULL)]])],
+ [AC_DEFINE(HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE, 1, [libmapi provides cast_mapi_SPropValue with mem context parameter]) ac_cv_have_mocms=yes],[ac_cv_have_mocms=no])
+CFLAGS=$save_cflags
+LIBS=$save_libs
+AC_MSG_RESULT([$ac_cv_have_mocms])
+
+dnl ****************************
dnl Expose version information
dnl ****************************
API_VERSION=$EDS_PACKAGE
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 66e4601..323568c 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -679,7 +679,8 @@ get_deltas (gpointer handle)
struct deleted_items_data did;
ESource *source = NULL;
guint32 options= MAPI_OPTIONS_FETCH_ALL;
- gboolean is_public = FALSE;
+ gboolean is_public = FALSE;
+ TALLOC_CTX *mem_ctx = NULL;
if (!handle)
return FALSE;
@@ -701,6 +702,7 @@ get_deltas (gpointer handle)
struct SPropValue sprop;
struct timeval t;
+ mem_ctx = talloc_init ("ExchangeMAPI_get_deltas_cal");
use_restriction = TRUE;
res.rt = RES_PROPERTY;
res.res.resProperty.relop = RELOP_GE;
@@ -709,7 +711,11 @@ get_deltas (gpointer handle)
t.tv_sec = icaltime_as_timet_with_zone (itt_cache, icaltimezone_get_utc_timezone ());
t.tv_usec = 0;
set_SPropValue_proptag_date_timeval (&sprop, PR_LAST_MODIFICATION_TIME, &t);
- cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
+ cast_mapi_SPropValue (
+ #ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
+ mem_ctx,
+ #endif
+ &(res.res.resProperty.lpProp), &sprop);
}
itt_current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
@@ -736,6 +742,8 @@ get_deltas (gpointer handle)
e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Error fetching changes from the server."));
// e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache));
g_static_mutex_unlock (&updating);
+ if (mem_ctx)
+ talloc_free (mem_ctx);
return FALSE;
}
} else {
@@ -753,6 +761,8 @@ get_deltas (gpointer handle)
e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Error fetching changes from the server."));
// e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache));
g_static_mutex_unlock (&updating);
+ if (mem_ctx)
+ talloc_free (mem_ctx);
return FALSE;
}
}
@@ -764,6 +774,10 @@ get_deltas (gpointer handle)
e_cal_backend_cache_put_server_utc_time (priv->cache, time_string);
g_free (time_string);
+ if (mem_ctx) {
+ talloc_free (mem_ctx);
+ mem_ctx = NULL;
+ }
/* handle deleted items here by going over the entire cache and
* checking for deleted items.*/
@@ -1530,6 +1544,7 @@ get_server_data (ECalBackendMAPI *cbmapi, icalcomponent *comp, struct cal_cbdata
struct SPropValue sprop;
struct Binary_r sb;
uint32_t proptag = 0x0;
+ TALLOC_CTX *mem_ctx;
uid = icalcomponent_get_uid (comp);
exchange_mapi_util_mapi_id_from_string (uid, &mid);
@@ -1549,13 +1564,20 @@ get_server_data (ECalBackendMAPI *cbmapi, icalcomponent *comp, struct cal_cbdata
exchange_mapi_cal_util_generate_globalobjectid (TRUE, uid, &sb);
+ mem_ctx = talloc_init ("ExchangeMAPI_cal_get_server_data");
set_SPropValue_proptag (&sprop, proptag, (gconstpointer ) &sb);
- cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
+ cast_mapi_SPropValue (
+ #ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
+ mem_ctx,
+ #endif
+ &(res.res.resProperty.lpProp), &sprop);
exchange_mapi_connection_fetch_items (priv->conn, priv->fid, &res, NULL,
mapi_cal_get_required_props, NULL,
capture_req_props, cbdata,
MAPI_OPTIONS_FETCH_GENERIC_STREAMS);
+
+ talloc_free (mem_ctx);
}
static icaltimezone *e_cal_backend_mapi_internal_get_timezone (ECalBackend *backend, const gchar *tzid);
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 2361dfd..b04660f 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -962,6 +962,7 @@ mapi_refresh_folder(CamelFolder *folder, GError **error)
gboolean status;
gboolean success = TRUE;
+ TALLOC_CTX *mem_ctx = NULL;
struct mapi_SRestriction *res = NULL;
struct SSortOrderSet *sort = NULL;
struct mapi_update_deleted_msg *deleted_items_op_msg;
@@ -1014,6 +1015,7 @@ mapi_refresh_folder(CamelFolder *folder, GError **error)
struct SPropValue sprop;
struct timeval t;
+ mem_ctx = talloc_init ("ExchangeMAPI_mapi_refresh_folder");
res = g_new0 (struct mapi_SRestriction, 1);
res->rt = RES_PROPERTY;
/*RELOP_GE acts more like >=. Few extra items are being fetched.*/
@@ -1025,7 +1027,11 @@ mapi_refresh_folder(CamelFolder *folder, GError **error)
//Creation time ?
set_SPropValue_proptag_date_timeval (&sprop, PR_LAST_MODIFICATION_TIME, &t);
- cast_mapi_SPropValue (&(res->res.resProperty.lpProp), &sprop);
+ cast_mapi_SPropValue (
+ #ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
+ mem_ctx,
+ #endif
+ &(res->res.resProperty.lpProp), &sprop);
}
@@ -1101,6 +1107,9 @@ end1:
g_slist_free (fetch_data->items_list);
g_free (fetch_data);
+ if (mem_ctx)
+ talloc_free (mem_ctx);
+
return success;
}
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index 8db5d49..acf16c7 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -1780,8 +1780,14 @@ exchange_mapi_cal_util_get_new_appt_id (ExchangeMapiConnection *conn, mapi_id_t
id = g_random_int ();
if (id) {
GSList *ids = NULL;
+ TALLOC_CTX *mem_ctx = talloc_init ("ExchangeMAPI_get_new_appt_id");
+
set_SPropValue_proptag (&sprop, PR_OWNER_APPT_ID, (gconstpointer ) &id);
- cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
+ cast_mapi_SPropValue (
+ #ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
+ mem_ctx,
+ #endif
+ &(res.res.resProperty.lpProp), &sprop);
ids = exchange_mapi_connection_check_restriction (conn, fid, 0, &res);
if (ids) {
GSList *l;
@@ -1789,6 +1795,8 @@ exchange_mapi_cal_util_get_new_appt_id (ExchangeMapiConnection *conn, mapi_id_t
g_free (l->data);
} else
found = TRUE;
+
+ talloc_free (mem_ctx);
}
};
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index 6d55b56..53ba1e4 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -1584,7 +1584,11 @@ exchange_mapi_connection_fetch_items (ExchangeMapiConnection *conn, mapi_id_t
properties_array.lpProps[k].value.MVbin.bin[ci].lpb = lpProps[k].value.MVbin.lpbin[ci].lpb;
}
} else {
- cast_mapi_SPropValue (&properties_array.lpProps[k], &lpProps[k]);
+ cast_mapi_SPropValue (
+ #ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
+ mem_ctx,
+ #endif
+ &properties_array.lpProps[k], &lpProps[k]);
}
}
} else
@@ -1711,7 +1715,11 @@ exchange_mapi_connection_fetch_object_props (ExchangeMapiConnection *conn, mapi_
properties_array.cValues = prop_count;
properties_array.lpProps = talloc_zero_array (mem_ctx, struct mapi_SPropValue, prop_count + 1);
for (k=0; k < prop_count; k++)
- cast_mapi_SPropValue(&properties_array.lpProps[k], &lpProps[k]);
+ cast_mapi_SPropValue (
+ #ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
+ mem_ctx,
+ #endif
+ &properties_array.lpProps[k], &lpProps[k]);
} else
retval = GetPropsAll (obj_message, &properties_array);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]