Blob Blame History Raw
commit f3b832780fb70066f5eb5c62996d613e6d187c59
Author: Milan Crha <mcrha@redhat.com>
Date:   Mon May 18 14:30:06 2015 +0200

    Fix a build break with OpenChange 2.3 QueryRows() API change

diff --git a/configure.ac b/configure.ac
index 8adb57d..ac11615 100644
--- a/configure.ac
+++ b/configure.ac
@@ -229,6 +229,21 @@ fi
 AC_MSG_RESULT([$ac_cv_have_ecrpcfailed])
 
 dnl ****************************
+dnl Check for OpenChange 2.3 QueryRows
+dnl ****************************
+AC_MSG_CHECKING([libmapi QueryRows arguments])
+save_cflags=$CFLAGS; CFLAGS=$LIBMAPI_CFLAGS
+save_libs=$LIBS; LIBS="$LIBMAPI_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM(
+	[[#include <libmapi/libmapi.h>]],
+	[[QueryRows(NULL, 1, TBL_ADVANCE, TBL_FORWARD_READ, NULL);]])],
+	[AC_DEFINE(HAVE_QUERYROWS_FORWARDREAD, 1, [libmapi defines QueryRows with ForwardRead argument]) ac_cv_have_queryrows_forwardread=yes],[ac_cv_have_queryrows_forwardread=no])
+CFLAGS=$save_cflags
+LIBS=$save_libs
+AC_MSG_RESULT([$ac_cv_have_queryrows_forwardread])
+
+
+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 bf4945f..8067e25 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -1523,7 +1523,11 @@ foreach_tablerow (EMapiConnection *conn,
 			break;
 
 		/* Fill the table columns with data from the rows */
-		ms = QueryRows (obj_table, count, TBL_ADVANCE, &SRowSet);
+		ms = QueryRows (obj_table, count, TBL_ADVANCE,
+			#ifdef HAVE_QUERYROWS_FORWARDREAD
+			TBL_FORWARD_READ,
+			#endif
+			&SRowSet);
 		if (ms != MAPI_E_SUCCESS) {
 			make_mapi_error (perror, "QueryRows", ms);
 			break;