[evolution-mapi/gal-ldap: 2/3] GAL LDAP : integrate into evolution-mapi build. (Suman Manjunath)



commit d85208828681ecdad76e6f2e1d4d534c76a65a69
Author: Johnny Jacob <jjohnny novell com>
Date:   Tue Jun 16 09:57:08 2009 +0530

    GAL LDAP : integrate into evolution-mapi build. (Suman Manjunath)

 configure.ac                                       |   93 ++++++++++++++++++++
 src/Makefile.am                                    |    4 +-
 .../exchange-mapi-account-listener.c               |   20 ++++
 src/galldap/e-book-backend-galldap.c               |    3 +
 4 files changed, 118 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8736c43..0f3f584 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,95 @@ PKG_CHECK_MODULES(LIBEDATACAL, libedata-cal-$EDS_PACKAGE >= eds_minimum_version)
 PKG_CHECK_MODULES(LIBBOOK, libebook-$EDS_PACKAGE >= eds_minimum_version)
 PKG_CHECK_MODULES(LIBEDATABOOK, libedata-book-$EDS_PACKAGE >= eds_minimum_version)
 PKG_CHECK_MODULES(CAMEL, camel-provider-$EDS_PACKAGE >= eds_minimum_version)
+PKG_CHECK_MODULES(LIBEXCHANGE_STORAGE, libexchange-storage-$EDS_PACKAGE >= eds_minimum_version)
+
+dnl ***********
+dnl GConf stuff
+dnl ***********
+PKG_CHECK_MODULES(GCONF2, gconf-2.0)
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+AM_GCONF_SOURCE_2
+
+dnl ****************************
+dnl Check for LDAP 
+dnl ****************************
+	AC_ARG_WITH(openldap,     [  --with-openldap=[no/yes/PREFIX]      Enable LDAP support])
+	AC_ARG_WITH(static-ldap,  [  --with-static-ldap=[no/yes]          Link LDAP support statically])
+	AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}")
+	case $ac_cv_with_openldap in
+	no|"")
+		with_openldap=no
+		;;
+	yes)
+		with_openldap=/usr
+		;;
+	*)
+		with_openldap=$ac_cv_with_openldap
+		LDAP_CFLAGS="-I$ac_cv_with_openldap/include"
+		LDAP_LDFLAGS="-L$ac_cv_with_openldap/lib"
+		;;
+	esac
+
+	if test "$with_openldap" != no; then
+		AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
+
+		case $with_static_ldap in
+		no|"")
+			with_static_ldap=no
+			;;
+		*)
+			with_static_ldap=yes
+			;;
+		esac
+
+		AC_CACHE_CHECK(if OpenLDAP is version 2.x, ac_cv_openldap_version2, [
+			CPPFLAGS_save="$CPPFLAGS"
+			CPPFLAGS="$CPPFLAGS $LDAP_CFLAGS"
+			AC_EGREP_CPP(yes, [
+				#include "ldap.h"
+				#if LDAP_VENDOR_VERSION > 20000
+				yes
+				#endif
+			], ac_cv_openldap_version2=yes, ac_cv_openldap_version2=no)
+			CPPFLAGS="$CPPFLAGS_save"
+		])
+		if test "$ac_cv_openldap_version2" = no; then
+			AC_MSG_ERROR(evolution requires OpenLDAP version >= 2)
+		fi
+
+		AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="-lresolv")
+		AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
+		AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
+		AC_CHECK_LIB(lber, ber_get_tag, [
+			if test "$with_static_ldap" = "yes"; then
+				LDAP_LIBS="$with_openldap/lib/liblber.a $LDAP_LIBS"
+
+				# libldap might depend on OpenSSL... We need to pull
+				# in the dependency libs explicitly here since we're
+				# not using libtool for the configure test.
+				if test -f $with_openldap/lib/libldap.la; then
+					LDAP_LIBS="`. $with_openldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS"
+				fi
+			else
+				LDAP_LIBS="-llber $LDAP_LIBS"
+			fi
+			AC_CHECK_LIB(ldap, ldap_open, [
+					if test $with_static_ldap = "yes"; then
+						LDAP_LIBS="$with_openldap/lib/libldap.a $LDAP_LIBS"
+					else
+						LDAP_LIBS="-lldap $LDAP_LIBS"
+					fi],
+				LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS)
+			LDAP_LIBS="$LDAP_LDFLAGS $LDAP_LIBS"
+		], LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS)
+
+		if test -z "$LDAP_LIBS"; then
+			AC_MSG_ERROR(could not find OpenLDAP libraries)
+		fi
+
+		AC_SUBST(LDAP_CFLAGS)
+		AC_SUBST(LDAP_LIBS)
+	fi
 
 dnl ****************************
 dnl Check for evolution plugins 
@@ -122,6 +211,9 @@ dnl ****************************
 API_VERSION=$EDS_PACKAGE
 AC_SUBST(API_VERSION)
 
+BASE_VERSION=`pkg-config --variable=execversion evolution-shell`
+AC_SUBST(BASE_VERSION)
+
 EDS_REQUIRED=eds_minimum_version
 AC_SUBST(EDS_REQUIRED)
 
@@ -173,6 +265,7 @@ src/account-setup-eplugin/Makefile
 src/addressbook/Makefile
 src/calendar/Makefile
 src/camel/Makefile
+src/galldap/Makefile
 src/libexchangemapi/Makefile
 src/libexchangemapi/libexchangemapi-]EVO_MAPI_API_VERSION_MACRO[.pc:src/libexchangemapi/libexchangemapi.pc.in
 po/Makefile.in
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e02ee8..f5635a1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS=libexchangemapi calendar addressbook camel account-setup-eplugin
-DIST_SUBDIRS=libexchangemapi calendar addressbook camel account-setup-eplugin
+SUBDIRS=libexchangemapi calendar addressbook galldap camel account-setup-eplugin
+DIST_SUBDIRS=libexchangemapi calendar addressbook  galldap camel account-setup-eplugin
 -include $(top_srcdir)/git.mk
diff --git a/src/account-setup-eplugin/exchange-mapi-account-listener.c b/src/account-setup-eplugin/exchange-mapi-account-listener.c
index 206826c..45ed382 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-listener.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-listener.c
@@ -456,6 +456,26 @@ add_addressbook_sources (EAccount *account, GSList *folders)
 		g_object_unref (source);
 	}
 
+	//Add GAL
+	{
+		char *uri;
+		uri = g_strdup_printf("galldap://%s %s/;Global Address List", url->user, url->host);
+		source = e_source_new_with_absolute_uri ("Global Address List", uri);
+//		source = e_source_new ("Global Address List", g_strconcat (";","Global Address List" , NULL));
+		e_source_set_property (source, "auth", "plain/password");
+		e_source_set_property (source, "auth-domain", "GALLDAP");
+		e_source_set_property(source, "user", url->user);
+		e_source_set_property(source, "host", camel_url_get_param (url, "ad_server"));
+		e_source_set_property(source, "view-limit", camel_url_get_param (url, "ad_limit"));		
+		e_source_set_property(source, "profile", camel_url_get_param (url, "profile"));
+		e_source_set_property(source, "domain", camel_url_get_param (url, "domain"));
+//		e_source_set_property (source, "offline_sync", 
+//					       camel_url_get_param (url, "offline_sync") ? "1" : "0");
+		e_source_set_property(source, "offline_sync", "1");
+		e_source_set_property (source, "completion", "true");
+		e_source_group_add_source (group, source, -1);
+		g_object_unref (source);		
+	}
 	e_source_list_add_group (list, group, -1);
 	e_source_list_sync (list, NULL);
 	g_object_unref (group);
diff --git a/src/galldap/e-book-backend-galldap.c b/src/galldap/e-book-backend-galldap.c
index 75714a1..95f0290 100644
--- a/src/galldap/e-book-backend-galldap.c
+++ b/src/galldap/e-book-backend-galldap.c
@@ -69,6 +69,9 @@
 #define ENABLE_CACHE 1
 #endif
 
+/* FIXME: Without this, build breaks */
+#define ENABLE_CACHE 0
+
 #if ENABLE_CACHE
 #include  <libedata-book/e-book-backend-db-cache.h>
 /* #include "db.h" */



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