[evolution-mapi] Bug #654382 - Drop unnecessary checks after switch to libmapi 0.11



commit eb5b95e4a3900466e189e9d0c42e18455596d214
Author: Sean Finney <seanius seanius net>
Date:   Mon Jul 25 07:57:08 2011 +0200

    Bug #654382 - Drop unnecessary checks after switch to libmapi 0.11

 configure.ac                                   |  102 ------------------
 src/addressbook/e-book-backend-mapi.c          |    7 +-
 src/calendar/e-cal-backend-mapi.c              |   13 +--
 src/camel/camel-mapi-folder.c                  |    8 +-
 src/libexchangemapi/exchange-mapi-cal-utils.c  |    8 +-
 src/libexchangemapi/exchange-mapi-connection.c |  137 ++++-------------------
 src/libexchangemapi/exchange-mapi-mail-utils.c |   16 ++--
 src/libexchangemapi/exchange-mapi-utils.c      |   49 ---------
 src/libexchangemapi/exchange-mapi-utils.h      |    3 -
 9 files changed, 43 insertions(+), 300 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9ec5bbf..0f7ec05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,108 +142,6 @@ AC_SUBST(LIBMAPI_CFLAGS)
 AC_SUBST(LIBMAPI_LIBS)
 
 dnl ****************************
-dnl Check for windows_to_utf8 function
-dnl ****************************
-AC_MSG_CHECKING([libmapi windows_to_utf8 function])
-save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
-save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-	[[#include <libmapi/libmapi.h>]],
-	[[windows_to_utf8 (NULL, NULL)]])],
-	[AC_DEFINE(HAVE_WINDOWS_TO_UTF8, 1, [libmapi provides windows_to_utf8 function]) ac_cv_have_wtu=yes],[ac_cv_have_wtu=no])
-CFLAGS=$save_cflags
-LIBS=$save_libs
-AC_MSG_RESULT([$ac_cv_have_wtu])
-
-dnl ****************************
-dnl Check for RegisterNotification function with two params
-dnl ****************************
-AC_MSG_CHECKING([libmapi RegisterNotification function with two params])
-save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
-save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-	[[#include <libmapi/libmapi.h>]],
-	[[RegisterNotification (NULL, 0)]])],
-	[AC_DEFINE(HAVE_CORRECT_REGISTERNOTIFICATION, 1, [libmapi provides correct RegisterNotification function]) ac_cv_have_crn=yes],[ac_cv_have_crn=no])
-CFLAGS=$save_cflags
-LIBS=$save_libs
-AC_MSG_RESULT([$ac_cv_have_crn])
-
-dnl ****************************
-dnl Check for GetGALTableCount function
-dnl ****************************
-AC_MSG_CHECKING([libmapi GetGALTableCount function])
-save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
-save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-	[[#include <libmapi/libmapi.h>]],
-	[[GetGALTableCount (NULL, NULL)]])],
-	[AC_DEFINE(HAVE_GETGALTABLECOUNT, 1, [libmapi provides GetGALTableCount function]) ac_cv_have_ggtc=yes],[ac_cv_have_ggtc=no])
-CFLAGS=$save_cflags
-LIBS=$save_libs
-AC_MSG_RESULT([$ac_cv_have_ggtc])
-
-dnl ****************************
-dnl Check for cast_SPropValue function with three params
-dnl ****************************
-AC_MSG_CHECKING([libmapi cast_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_SPropValue (NULL, NULL, NULL)]])],
-	[AC_DEFINE(HAVE_MEMCTX_ON_CAST_SPROPVALUE, 1, [libmapi provides cast_SPropValue with mem context parameter]) ac_cv_have_mocs=yes],[ac_cv_have_mocs=no])
-CFLAGS=$save_cflags
-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 Check for PR_RECIPIENT_FLAGS
-dnl ****************************
-AC_MSG_CHECKING([libmapi provides PR_RECIPIENT_FLAGS])
-save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
-save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-	[[#include <libmapi/libmapi.h>]],
-	[[printf ("%d", PR_RECIPIENT_FLAGS)]])],
-	[AC_DEFINE(HAVE_PR_RECIPIENT_FLAGS, 1, [libmapi provides PR_RECIPIENT_FLAGS]) ac_cv_have_prf=yes],[ac_cv_have_prf=no])
-CFLAGS=$save_cflags
-LIBS=$save_libs
-AC_MSG_RESULT([$ac_cv_have_prf])
-
-if test "x${ac_cv_have_prf}" = "xno"; then
-	CFLAGS="$CFLAGS -DPR_RECIPIENT_FLAGS=PR_RECIPIENTS_FLAGS"
-fi
-
-dnl ****************************
-dnl Check for MAPIInitialize function with two params
-dnl ****************************
-AC_MSG_CHECKING([libmapi MAPIInitialize function with two params])
-save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
-save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
-	[[#include <libmapi/libmapi.h>]],
-	[[MAPIInitialize (NULL, NULL)]])],
-	[AC_DEFINE(HAVE_LIBMAPI_CONTEXT_PARAM, 1, [libmapi uses context parameters]) ac_cv_have_lcp=yes],[ac_cv_have_lcp=no])
-CFLAGS=$save_cflags
-LIBS=$save_libs
-AC_MSG_RESULT([$ac_cv_have_lcp])
-
-dnl ****************************
 dnl Expose version information
 dnl ****************************
 API_VERSION=$EDS_PACKAGE
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index cab80bb..9efea74 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -282,11 +282,8 @@ ebbm_build_cache_update_restriction (EBookBackendMAPI *ebma, TALLOC_CTX *mem_ctx
 
 	set_SPropValue_proptag_date_timeval (&sprop, PR_LAST_MODIFICATION_TIME, &t);
 
-	cast_mapi_SPropValue (
-		#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-		mem_ctx,
-		#endif
-		&(restriction->res.resProperty.lpProp), &sprop);
+	cast_mapi_SPropValue (mem_ctx, &(restriction->res.resProperty.lpProp),
+			      &sprop);
 
 	return restriction;
 }
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index f2be0ad..ab31271 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -736,11 +736,8 @@ 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 (
-			#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-			mem_ctx,
-			#endif
-			&(res.res.resProperty.lpProp), &sprop);
+		cast_mapi_SPropValue (mem_ctx, &(res.res.resProperty.lpProp),
+				      &sprop);
 	}
 
 	itt_current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
@@ -1662,11 +1659,7 @@ get_server_data (ECalBackendMAPI *cbmapi, ECalComponent *comp, struct cal_cbdata
 
 	mem_ctx = talloc_init ("ExchangeMAPI_cal_get_server_data");
 	set_SPropValue_proptag (&sprop, proptag, (gconstpointer ) &sb);
-	cast_mapi_SPropValue (
-		#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-		mem_ctx,
-		#endif
-		&(res.res.resProperty.lpProp), &sprop);
+	cast_mapi_SPropValue (mem_ctx, &(res.res.resProperty.lpProp), &sprop);
 
 	exchange_mapi_connection_fetch_items (priv->conn, priv->fid, &res, NULL,
 					mapi_cal_get_required_props, NULL,
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index d36902f..8088966 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -829,11 +829,9 @@ mapi_refresh_folder(CamelFolder *folder, GCancellable *cancellable, GError **err
 
 			//Creation time ?
 			set_SPropValue_proptag_date_timeval (&sprop, PR_LAST_MODIFICATION_TIME, &t);
-			cast_mapi_SPropValue (
-				#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-				mem_ctx,
-				#endif
-				&(res->res.resProperty.lpProp), &sprop);
+			cast_mapi_SPropValue (mem_ctx,
+					      &(res->res.resProperty.lpProp),
+					      &sprop);
 
 		}
 
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index a855a2b..f7003be 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -1999,11 +1999,9 @@ exchange_mapi_cal_util_get_new_appt_id (ExchangeMapiConnection *conn, mapi_id_t
 			TALLOC_CTX *mem_ctx = talloc_init ("ExchangeMAPI_get_new_appt_id");
 
 			set_SPropValue_proptag (&sprop, PR_OWNER_APPT_ID, (gconstpointer ) &id);
-			cast_mapi_SPropValue (
-				#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-				mem_ctx,
-				#endif
-				&(res.res.resProperty.lpProp), &sprop);
+			cast_mapi_SPropValue (mem_ctx,
+					      &(res.res.resProperty.lpProp),
+					      &sprop);
 			ids = exchange_mapi_connection_check_restriction (conn, fid, 0, &res, NULL);
 			if (ids) {
 				GSList *l;
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index d1184bd..124ea7a 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -141,9 +141,7 @@ make_mapi_error (GError **perror, const gchar *context, enum MAPISTATUS mapi_sta
 	g_propagate_error (perror, error);
 }
 
-#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
 struct mapi_context *mapi_ctx = NULL;
-#endif
 
 struct _ExchangeMapiConnectionPrivate {
 	struct mapi_session *session;
@@ -806,11 +804,7 @@ exchange_mapi_util_modify_recipients (ExchangeMapiConnection *conn, TALLOC_CTX *
 	enum MAPISTATUS	ms;
 	struct SPropTagArray	*SPropTagArray = NULL;
 	struct SRowSet		*SRowSet = NULL;
-	#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
 	struct PropertyTagArray_r *FlagList = NULL;
-	#else
-	struct SPropTagArray	*FlagList = NULL;
-	#endif
 	GSList			*l;
 	const gchar		**users = NULL;
 	uint32_t		i, j, count = 0;
@@ -1270,11 +1264,8 @@ exchange_mapi_util_get_attachments (ExchangeMapiConnection *conn, mapi_id_t fid,
 				continue;
 			}
 
-			cast_SPropValue (
-				#ifdef HAVE_MEMCTX_ON_CAST_SPROPVALUE
-				mem_ctx,
-				#endif
-				&properties.lpProps[z], &(attachment->lpProps[az]));
+			cast_SPropValue (mem_ctx, &properties.lpProps[z],
+					 &(attachment->lpProps[az]));
 
 			if ((attachment->lpProps[az].ulPropTag & 0xFFFF) == PT_STRING8) {
 				struct SPropValue *lpProps;
@@ -1363,13 +1354,11 @@ exchange_mapi_connection_fetch_gal (ExchangeMapiConnection *conn, struct mapi_SR
 
 	LOCK ();
 
-	#ifdef HAVE_GETGALTABLECOUNT
 	ms = GetGALTableCount (priv->session, &n_rows);
 	if (ms != MAPI_E_SUCCESS) {
 		make_mapi_error (perror, "GetGALTableCount", ms);
 		n_rows = 0;
 	}
-	#endif
 
 	propsTagArray = set_SPropTagArray (mem_ctx, 0x1, PR_MESSAGE_CLASS);
 	if (!build_props (conn, 0, mem_ctx, propsTagArray, brp_data)) {
@@ -1814,11 +1803,8 @@ exchange_mapi_connection_fetch_items   (ExchangeMapiConnection *conn, mapi_id_t
 						ll--;
 						properties_array.cValues--;
 					} else {
-						cast_mapi_SPropValue (
-							#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-							mem_ctx,
-							#endif
-							&properties_array.lpProps[ll], &lpProps[k]);
+						cast_mapi_SPropValue (mem_ctx,
+								      &properties_array.lpProps[ll],&lpProps[k]);
 					}
 				}
 			} else {
@@ -1965,11 +1951,8 @@ exchange_mapi_connection_fetch_object_props (ExchangeMapiConnection *conn, mapi_
 				ll--;
 				properties_array.cValues--;
 			} else {
-				cast_mapi_SPropValue (
-					#ifdef HAVE_MEMCTX_ON_CAST_MAPI_SPROPVALUE
-					mem_ctx,
-					#endif
-					&properties_array.lpProps[ll], &lpProps[k]);
+				cast_mapi_SPropValue (mem_ctx,
+						      &properties_array.lpProps[ll], &lpProps[k]);
 			}
 		}
 	} else {
@@ -2966,11 +2949,7 @@ mapi_move_items (ExchangeMapiConnection *conn, mapi_id_t src_fid, guint32 src_fi
 		mapi_id_array_t msg_id_array;
 		gint count = 0;
 
-		mapi_id_array_init (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			&msg_id_array);
+		mapi_id_array_init (mapi_ctx, &msg_id_array);
 
 		for (l = mid_list; l != NULL && count < 500; l = g_slist_next (l), count++)
 			mapi_id_array_add_id (&msg_id_array, *((mapi_id_t *)l->data));
@@ -3159,7 +3138,6 @@ get_child_folders (TALLOC_CTX *mem_ctx, ExchangeMAPIFolderCategory folder_hier,
 
 		for (i = 0; i < rowset.cRows; i++) {
 			ExchangeMAPIFolder *folder = NULL;
-			gchar *newname = NULL;
 
 			const mapi_id_t *fid = (const mapi_id_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_FID);
 			const mapi_id_t *pid = (const mapi_id_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_PARENT_FID);
@@ -3173,18 +3151,15 @@ get_child_folders (TALLOC_CTX *mem_ctx, ExchangeMAPIFolderCategory folder_hier,
 			if (!class)
 				class = IPF_NOTE;
 
-			newname = utf8tolinux (name);
 			g_debug("|---+ %-15s : (Container class: %s %016" G_GINT64_MODIFIER "X) UnRead : %d Total : %d size : %d",
-				newname, class, *fid, unread ? *unread : 0, total ? *total : 0, folder_size ? *folder_size : 0);
+				name, class, *fid, unread ? *unread : 0, total ? *total : 0, folder_size ? *folder_size : 0);
 
-			folder = exchange_mapi_folder_new (newname, class, folder_hier, *fid, pid ? *pid : folder_id,
+			folder = exchange_mapi_folder_new (name, class, folder_hier, *fid, pid ? *pid : folder_id,
 							   child ? *child : 0, unread ? *unread : 0, total ? *total : 0);
 
 			folder->size = folder_size ? *folder_size : 0;
 
 			*mapi_folders = g_slist_prepend (*mapi_folders, folder);
-
-			g_free (newname);
 		}
 
 		cursor_pos += rowset.cRows;
@@ -3363,7 +3338,6 @@ exchange_mapi_connection_get_folders_list (ExchangeMapiConnection *conn, GSList
 	ExchangeMAPIFolder	*folder;
 	uint32_t		count = 0;
 	const gchar		*mailbox_name = NULL;
-	gchar			*utf8_mailbox_name = NULL;
 	const gchar		*mailbox_owner_name = NULL;
 	const gchar		*mailbox_user_name = NULL;
 	const uint32_t          *mailbox_size = NULL;
@@ -3411,10 +3385,8 @@ exchange_mapi_connection_get_folders_list (ExchangeMapiConnection *conn, GSList
 		goto cleanup;
 	}
 
-	utf8_mailbox_name = utf8tolinux (mailbox_name);
-
 	/* FIXME: May have to get the child folders count? Do we need/use it? */
-	folder = exchange_mapi_folder_new (utf8_mailbox_name, IPF_NOTE,
+	folder = exchange_mapi_folder_new (mailbox_name, IPF_NOTE,
 					   MAPI_PERSONAL_FOLDER, mailbox_id, 0, 0, 0 ,0);
 	folder->is_default = true;
 	folder->default_type = olFolderTopInformationStore; /*Is this correct ?*/
@@ -3425,8 +3397,6 @@ exchange_mapi_connection_get_folders_list (ExchangeMapiConnection *conn, GSList
 	/* FIXME: check status of get_child_folders */
 	result = get_child_folders (mem_ctx, MAPI_PERSONAL_FOLDER, &priv->msg_store, mailbox_id, mapi_folders, perror);
 
-	g_free(utf8_mailbox_name);
-
 	*mapi_folders = g_slist_reverse (*mapi_folders);
 
 	if (!set_default_folders (&priv->msg_store, mapi_folders, perror)) {
@@ -3519,11 +3489,7 @@ exchange_mapi_connection_ex_to_smtp (ExchangeMapiConnection *conn, const gchar *
 	TALLOC_CTX		*mem_ctx;
 	struct SPropTagArray	*SPropTagArray;
 	struct SRowSet		*SRowSet = NULL;
-	#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
 	struct PropertyTagArray_r *flaglist = NULL;
-	#else
-	struct SPropTagArray	*flaglist = NULL;
-	#endif
 	const gchar		*str_array[2];
 	gchar			*smtp_addr = NULL;
 
@@ -3572,11 +3538,7 @@ exchange_mapi_connection_events_init (ExchangeMapiConnection *conn, GError **per
 	e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
 
 	LOCK ();
-	#ifdef HAVE_CORRECT_REGISTERNOTIFICATION
 	ms = RegisterNotification (priv->session, 0);
-	#else
-	ms = MAPI_E_INTERFACE_NO_SUPPORT;
-	#endif
 	UNLOCK ();
 
 	if (ms != MAPI_E_SUCCESS)
@@ -3781,11 +3743,7 @@ ensure_mapi_init_called (GError **perror)
 		}
 	}
 
-	ms = MAPIInitialize (
-		#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-		&mapi_ctx,
-		#endif
-		profpath);
+	ms = MAPIInitialize (&mapi_ctx, profpath);
 	if (ms == MAPI_E_SESSION_LIMIT) {
 		/* do nothing, the profile store is already initialized */
 		/* but this shouldn't happen */
@@ -3847,31 +3805,15 @@ mapi_profile_load (const gchar *profname, const gchar *password, GError **perror
 	/* Initialize libmapi logger*/
 	if (g_getenv ("MAPI_DEBUG")) {
 		debug_log_level = atoi (g_getenv ("MAPI_DEBUG"));
-		SetMAPIDumpData (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			TRUE);
-		SetMAPIDebugLevel (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			debug_log_level);
+		SetMAPIDumpData (mapi_ctx, TRUE);
+		SetMAPIDebugLevel (mapi_ctx, debug_log_level);
 	}
 
 	g_debug("Loading profile %s ", profname);
 
-	ms = MapiLogonEx (
-		#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-		mapi_ctx,
-		#endif
-		&session, profname, password);
+	ms = MapiLogonEx (mapi_ctx, &session, profname, password);
 	if (ms == MAPI_E_NOT_FOUND && try_create_profile (profname, password))
-		ms = MapiLogonEx (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			&session, profname, password);
+		ms = MapiLogonEx (mapi_ctx, &session, profname, password);
 
 	if (ms != MAPI_E_SUCCESS) {
 		make_mapi_error (perror, "MapiLogonEx", ms);
@@ -3941,30 +3883,18 @@ mapi_profile_create (const gchar *username, const gchar *password, const gchar *
 	profname = exchange_mapi_util_profile_name (username, domain, server, TRUE);
 
 	/* Delete any existing profiles with the same profilename */
-	ms = DeleteProfile (
-		#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-		mapi_ctx,
-		#endif
-		profname);
+	ms = DeleteProfile (mapi_ctx, profname);
 	/* don't bother to check error - it would be valid if we got an error */
 
-	ms = CreateProfile (
-		#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-		mapi_ctx,
-		#endif
-		profname, username, password, OC_PROFILE_NOPASSWORD);
+	ms = CreateProfile (mapi_ctx, profname, username, password,
+			    OC_PROFILE_NOPASSWORD);
 	if (ms != MAPI_E_SUCCESS) {
 		make_mapi_error (perror, "CreateProfile", ms);
 		goto cleanup;
 	}
 
-	#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
 	#define add_string_attr(_prof,_aname,_val)				\
 		mapi_profile_add_string_attr (mapi_ctx, _prof, _aname, _val)
-	#else
-	#define add_string_attr(_prof,_aname,_val)				\
-		mapi_profile_add_string_attr (_prof, _aname, _val)
-	#endif
 
 	add_string_attr (profname, "binding", server);
 	add_string_attr (profname, "workstation", workstation);
@@ -3982,19 +3912,12 @@ mapi_profile_create (const gchar *username, const gchar *password, const gchar *
 
 	/* Login now */
 	g_debug("Logging into the server... ");
-	ms = MapiLogonProvider (
-		#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-		mapi_ctx,
-		#endif
-		&session, profname, password, PROVIDER_ID_NSPI);
+	ms = MapiLogonProvider (mapi_ctx, &session, profname, password,
+				PROVIDER_ID_NSPI);
 	if (ms != MAPI_E_SUCCESS) {
 		make_mapi_error (perror, "MapiLogonProvider", ms);
 		g_debug ("Deleting profile %s ", profname);
-		DeleteProfile (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			profname);
+		DeleteProfile (mapi_ctx, profname);
 		goto cleanup;
 	}
 	g_debug("MapiLogonProvider : succeeded \n");
@@ -4003,11 +3926,7 @@ mapi_profile_create (const gchar *username, const gchar *password, const gchar *
 	if (ms != MAPI_E_SUCCESS) {
 		make_mapi_error (perror, "ProcessNetworkProfile", ms);
 		g_debug ("Deleting profile %s ", profname);
-		DeleteProfile (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			profname);
+		DeleteProfile (mapi_ctx, profname);
 		goto cleanup;
 	}
 	g_debug("ProcessNetworkProfile : succeeded \n");
@@ -4061,11 +3980,7 @@ exchange_mapi_delete_profile (const gchar *profile, GError **perror)
 
 		g_debug ("Deleting profile %s ", profile);
 
-		ms = DeleteProfile (
-			#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-			mapi_ctx,
-			#endif
-			profile);
+		ms = DeleteProfile (mapi_ctx, profile);
 		if (ms == MAPI_E_SUCCESS) {
 			result = TRUE;
 		} else {
@@ -4087,11 +4002,7 @@ exchange_mapi_rename_profile (const gchar *old_name, const gchar *new_name)
 	/* do not use locking here, it's called with a lock held already */
 	/* g_static_rec_mutex_lock (&profile_mutex); */
 
-	RenameProfile (
-		#ifdef HAVE_LIBMAPI_CONTEXT_PARAM
-		mapi_ctx,
-		#endif
-		old_name, new_name);
+	RenameProfile (mapi_ctx, old_name, new_name);
 
 	/* g_static_rec_mutex_unlock (&profile_mutex); */
 }
diff --git a/src/libexchangemapi/exchange-mapi-mail-utils.c b/src/libexchangemapi/exchange-mapi-mail-utils.c
index 1554518..f3de312 100644
--- a/src/libexchangemapi/exchange-mapi-mail-utils.c
+++ b/src/libexchangemapi/exchange-mapi-mail-utils.c
@@ -181,43 +181,43 @@ fetch_read_item_common_data (MailItem *item, uint32_t propTag, gconstpointer pro
 		} break;
 	/* FIXME : Instead of duping. Use talloc_steal to reuse the memory */
 	case PR_SUBJECT:
-		sv (item->header.subject, utf8tolinux (prop_data));
+		sv (item->header.subject, g_strdup (prop_data));
 		break;
 	case PR_SUBJECT_UNICODE :
 		sv (item->header.subject, g_strdup (prop_data));
 		break;
 	case PR_DISPLAY_TO :
-		sv (item->header.to, utf8tolinux (prop_data));
+		sv (item->header.to, g_strdup (prop_data));
 		break;
 	case PR_DISPLAY_TO_UNICODE :
 		sv (item->header.to, g_strdup (prop_data));
 		break;
 	case PR_DISPLAY_CC:
-		sv (item->header.cc, utf8tolinux (prop_data));
+		sv (item->header.cc, g_strdup (prop_data));
 		break;
 	case PR_DISPLAY_CC_UNICODE:
 		sv (item->header.cc, g_strdup (prop_data));
 		break;
 	case PR_DISPLAY_BCC:
-		sv (item->header.bcc, utf8tolinux (prop_data));
+		sv (item->header.bcc, g_strdup (prop_data));
 		break;
 	case PR_DISPLAY_BCC_UNICODE:
 		sv (item->header.bcc, g_strdup (prop_data));
 		break;
 	case PR_SENT_REPRESENTING_NAME:
-		sv (item->header.from, utf8tolinux (prop_data));
+		sv (item->header.from, g_strdup (prop_data));
 		break;
 	case PR_SENT_REPRESENTING_NAME_UNICODE:
 		sv (item->header.from, g_strdup (prop_data));
 		break;
 	case PR_SENT_REPRESENTING_EMAIL_ADDRESS:
-		sv (item->header.from_email, utf8tolinux (prop_data));
+		sv (item->header.from_email, g_strdup (prop_data));
 		break;
 	case PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE:
 		sv (item->header.from_email, g_strdup (prop_data));
 		break;
 	case PR_SENT_REPRESENTING_ADDRTYPE:
-		sv (item->header.from_type, utf8tolinux (prop_data));
+		sv (item->header.from_type, g_strdup (prop_data));
 		break;
 	case PR_SENT_REPRESENTING_ADDRTYPE_UNICODE:
 		sv (item->header.from_type, g_strdup (prop_data));
@@ -235,7 +235,7 @@ fetch_read_item_common_data (MailItem *item, uint32_t propTag, gconstpointer pro
 		item->header.in_reply_to = g_strdup (prop_data);
 		break;
 	case PR_TRANSPORT_MESSAGE_HEADERS:
-		sv (item->header.transport_headers, utf8tolinux (prop_data));
+		sv (item->header.transport_headers, g_strdup (prop_data));
 		break;
 	case PR_TRANSPORT_MESSAGE_HEADERS_UNICODE:
 		sv (item->header.transport_headers, g_strdup (prop_data));
diff --git a/src/libexchangemapi/exchange-mapi-utils.c b/src/libexchangemapi/exchange-mapi-utils.c
index ba8e2fa..b6c650c 100644
--- a/src/libexchangemapi/exchange-mapi-utils.c
+++ b/src/libexchangemapi/exchange-mapi-utils.c
@@ -41,55 +41,6 @@
 #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
 #endif
 
-/* Converts a string from Windows-UTF8 to classic-UTF8.
- * NOTE: If the returned value is non-NULL, the caller has to free the newly
- * allocated string using g_free()
- */
-gchar *
-utf8tolinux (const gchar *wstring)
-{
-	#ifndef HAVE_WINDOWS_TO_UTF8
-	/* newer Openchange (0.10+) doesn't provide windows_to_utf8 function,
-	   it does all the necessary decoding to utf8 transparently */
-	return g_strdup (wstring);
-	#else
-	TALLOC_CTX	*mem_ctx;
-	gchar		*newstr, *retval = NULL;
-	gint i;
-	gboolean all_ok = TRUE;
-
-	g_return_val_if_fail (wstring != NULL, NULL);
-
-	/* If all letters are with code <128 then there is nothing
-	   to be converted, thus return the original string copy.
-	   It's not working always, but should be fine for now.
-
-	   This is a temporary hack before the windows_to_utf8 will
-	   be fixed to not drop some letters.
-	*/
-	for (i = 0; all_ok && wstring[i]; i++) {
-		/* signed char, thus '> 128' means '< 0' */
-		all_ok = wstring[i] > 0;
-	}
-
-	if (all_ok)
-		return g_strdup (wstring);
-
-	mem_ctx = talloc_init ("ExchangeMAPI_utf8tolinux");
-
-	newstr = windows_to_utf8(mem_ctx, wstring);
-
-	if (g_utf8_validate (newstr, -1, NULL))
-		retval = g_strdup (newstr);
-	else
-		retval = g_strdup (wstring);
-
-	talloc_free (mem_ctx);
-
-	return retval;
-	#endif
-}
-
 inline gchar *
 exchange_mapi_util_mapi_id_to_string (mapi_id_t id)
 {
diff --git a/src/libexchangemapi/exchange-mapi-utils.h b/src/libexchangemapi/exchange-mapi-utils.h
index daaab96..703ca99 100644
--- a/src/libexchangemapi/exchange-mapi-utils.h
+++ b/src/libexchangemapi/exchange-mapi-utils.h
@@ -27,9 +27,6 @@
 #include "exchange-mapi-connection.h"
 
 gchar *
-utf8tolinux (const gchar *wstring);
-
-gchar *
 exchange_mapi_util_mapi_id_to_string (mapi_id_t id);
 gboolean
 exchange_mapi_util_mapi_id_from_string (const gchar *str, mapi_id_t *id);



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