[evolution-mapi] Bug #668816 - Contact search fails in GAL after certain limit



commit 3077ff5215b799a3d3e09e9d5338f2c8a52c9a33
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 27 11:19:07 2012 +0100

    Bug #668816 - Contact search fails in GAL after certain limit

 configure.ac                            |   14 ++++++++++++++
 src/libexchangemapi/e-mapi-connection.c |    8 +++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 46ae992..9e5c6c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,6 +184,20 @@ LIBS=$save_libs
 AC_MSG_RESULT([$ac_cv_have_rns])
 
 dnl ****************************
+dnl Check for nspi_GetMatches with ulResult availability
+dnl ****************************
+AC_MSG_CHECKING([libmapi nspi_GetMatches with ulResult parameter])
+save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
+save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
+	[[#include <libmapi/libmapi.h>]],
+	[[nspi_GetMatches (NULL, NULL, NULL, NULL, 5000, NULL, NULL);]])],
+	[AC_DEFINE(HAVE_NSPI_GETMATCHES_ULRESULT, 1, [libmapi supports nspi_GetMatches with ulResult parameter]) ac_cv_have_ngmr=yes],[ac_cv_have_ngmr=no])
+CFLAGS=$save_cflags
+LIBS=$save_libs
+AC_MSG_RESULT([$ac_cv_have_ngmr])
+
+dnl ****************************
 dnl Expose version information
 dnl ****************************
 API_VERSION=$EDS_PACKAGE
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index f83eeee..0d4b1a0 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -4254,10 +4254,16 @@ e_mapi_connection_list_gal_objects (EMapiConnection *conn,
 		}
 	}
 
-	ms = nspi_GetMatches (priv->session->nspi->ctx, mem_ctx, propTagArray, use_restriction, &rows, &pMIds);
+	ms = nspi_GetMatches (priv->session->nspi->ctx, mem_ctx, propTagArray, use_restriction,
+		#ifdef HAVE_NSPI_GETMATCHES_ULRESULT
+		(uint32_t) -1,
+		#endif
+		&rows, &pMIds);
 	if (ms != MAPI_E_SUCCESS || !rows) {
 		if (ms == MAPI_E_NOT_FOUND || (!rows && ms == MAPI_E_SUCCESS))
 			ms = MAPI_E_SUCCESS;
+		else if (ms == MAPI_E_TABLE_TOO_BIG)
+			g_set_error (perror, E_MAPI_ERROR, MAPI_E_TABLE_TOO_BIG, _("Search result exceeded allowed size limit. Use more specific search term, please"));
 		else if (ms != MAPI_E_SUCCESS)
 			make_mapi_error (perror, "nspi_GetMatches", ms);
 		goto cleanup;



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