evolution-data-server r9000 - in branches/camel-db-summary: . addressbook addressbook/backends/ldap addressbook/libebook addressbook/libedata-book calendar calendar/backends/file calendar/backends/google calendar/backends/groupwise calendar/backends/http calendar/backends/weather camel libedataserver libedataserverui po servers/exchange servers/exchange/lib servers/google/libgdata servers/google/libgdata-google servers/groupwise



Author: sragavan
Date: Tue Jun 17 16:03:55 2008
New Revision: 9000
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9000&view=rev

Log:
Merge branch 'master' into disk-summary


Modified:
   branches/camel-db-summary/ChangeLog
   branches/camel-db-summary/NEWS
   branches/camel-db-summary/addressbook/ChangeLog
   branches/camel-db-summary/addressbook/backends/ldap/Makefile.am
   branches/camel-db-summary/addressbook/backends/ldap/e-book-backend-ldap.c
   branches/camel-db-summary/addressbook/libebook/e-vcard.c
   branches/camel-db-summary/addressbook/libedata-book/e-book-backend-sexp.c
   branches/camel-db-summary/calendar/ChangeLog
   branches/camel-db-summary/calendar/backends/file/e-cal-backend-file.c
   branches/camel-db-summary/calendar/backends/google/Makefile.am
   branches/camel-db-summary/calendar/backends/google/e-cal-backend-google.c
   branches/camel-db-summary/calendar/backends/groupwise/Makefile.am
   branches/camel-db-summary/calendar/backends/http/Makefile.am
   branches/camel-db-summary/calendar/backends/weather/Makefile.am
   branches/camel-db-summary/camel/ChangeLog
   branches/camel-db-summary/camel/camel-msgport.c
   branches/camel-db-summary/camel/camel-stream-vfs.c
   branches/camel-db-summary/configure.in
   branches/camel-db-summary/libedataserver/e-proxy.c
   branches/camel-db-summary/libedataserverui/ChangeLog
   branches/camel-db-summary/libedataserverui/e-passwords.c
   branches/camel-db-summary/po/ChangeLog
   branches/camel-db-summary/po/ar.po
   branches/camel-db-summary/servers/exchange/ChangeLog
   branches/camel-db-summary/servers/exchange/lib/e2k-autoconfig.c
   branches/camel-db-summary/servers/google/libgdata-google/ChangeLog
   branches/camel-db-summary/servers/google/libgdata-google/gdata-google-service.c
   branches/camel-db-summary/servers/google/libgdata/ChangeLog
   branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.c
   branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.h
   branches/camel-db-summary/servers/groupwise/ChangeLog
   branches/camel-db-summary/servers/groupwise/Makefile.am
   branches/camel-db-summary/servers/groupwise/e-gw-item.c

Modified: branches/camel-db-summary/NEWS
==============================================================================
--- branches/camel-db-summary/NEWS	(original)
+++ branches/camel-db-summary/NEWS	Tue Jun 17 16:03:55 2008
@@ -1,3 +1,25 @@
+Evolution-Data-Server 2.23.4 2008-06-16
+----------------------------------------
+
+Bug Fixes:
+	#394654: (Novell Bugzilla) Fix for Groupwise crasher (Chenthill Palanisamy)
+	#304029: Improve LDAP addressbook search filter (Milan Crha)
+	#509721: Do not delete original message if exception occurred (Milan Crha)
+	#521921: Handle redirects in a way that works with Google API. Fixes some cases of entries not being created or deleted (Sebastian Keller)
+	#527544: Added support for proxy (Wang Xin)
+	#530241: Recognize no-flag situation properly and in that case use two commands (Milan Crha)
+	#534080: Use g_output_stream_write_all instead of g_output_stream_write (Milan Crha)
+	#534111: Copying past the end of the buffer can cause core dumps (Paul Smith)
+	#536154: Camel sends bracketed hostname in SMTP HELO (Tor Lillqvist)
+	#536636: Allow e-d-s to build with G_DISABLE_SINGLE_INCLUDES and GTK_DISABLE_SINGLE_INCLUDES defined. (Matthew Barnes)
+
+Other Contributors:
+	Multiple fixes to build evolution on Windows (Tor Lillqvist)
+
+Updated Translations:
+	Djihed Afifi (ar)
+	Hedayat Vatankhah (fa)
+
 Evolution-Data-Server 2.23.3 2008-06-02
 ----------------------------------------
 

Modified: branches/camel-db-summary/addressbook/backends/ldap/Makefile.am
==============================================================================
--- branches/camel-db-summary/addressbook/backends/ldap/Makefile.am	(original)
+++ branches/camel-db-summary/addressbook/backends/ldap/Makefile.am	Tue Jun 17 16:03:55 2008
@@ -18,6 +18,7 @@
 	$(top_builddir)/addressbook/libebook/libebook-1.2.la		\
 	$(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la	\
 	$(top_builddir)/libedataserver/libedataserver-1.2.la		\
+	$(top_builddir)/libebackend/libebackend-1.2.la			\
 	$(EVOLUTION_ADDRESSBOOK_LIBS)					\
 	$(LDAP_LIBS)
 

Modified: branches/camel-db-summary/addressbook/backends/ldap/e-book-backend-ldap.c
==============================================================================
--- branches/camel-db-summary/addressbook/backends/ldap/e-book-backend-ldap.c	(original)
+++ branches/camel-db-summary/addressbook/backends/ldap/e-book-backend-ldap.c	Tue Jun 17 16:03:55 2008
@@ -3373,6 +3373,42 @@
 	}
 }
 
+/** for each first space in a sequence of spaces in @param str it will exchange
+ * that first with a '*' character, but only if that space is
+ * not at the beginning or at the end of the str.
+ * Return value is changed @param str. (ie. this function is changeing
+ * str itself, didn't alocate new memory.)
+ */
+static char *
+extend_query_value (char *str)
+{
+	if(str && g_utf8_strlen (str, -1) > 0){
+		char *next;
+		char *last_star = NULL;
+		gboolean have_nonspace = FALSE;
+
+		for (next = str; next && *next; next = g_utf8_next_char (next) ){
+			if (*next == ' '){
+				if (have_nonspace && !last_star){
+					/* exchange only first space after nonspace character */
+					*next = '*';
+					last_star = next;
+				}
+			}else{
+				have_nonspace = TRUE;
+				last_star = NULL;
+			}
+		}
+
+		if (last_star){
+			/* we placed a star at the end of str, so make it back a space */
+			*last_star = ' ';
+		}
+	}
+
+	return str;
+}
+
 static ESExpResult *
 func_and(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
 {
@@ -3476,7 +3512,7 @@
 	    && argv[0]->type == ESEXP_RES_STRING
 	    && argv[1]->type == ESEXP_RES_STRING) {
 		char *propname = argv[0]->value.string;
-		char *str = rfc2254_escape(argv[1]->value.string);
+		char *str = extend_query_value( rfc2254_escape (argv[1]->value.string));
 		gboolean one_star = FALSE;
 
 		if (strlen(str) == 0)
@@ -3488,6 +3524,8 @@
 			char *big_query;
 			char *match_str;
 			if (one_star) {
+				g_free (str);
+
 				/* ignore NULL query */
 				r = e_sexp_result_new (f, ESEXP_RES_BOOL);
 				r->value.bool = FALSE;
@@ -3582,6 +3620,8 @@
 		char *ldap_attr = query_prop_to_ldap(propname);
 
 		if (strlen (str) == 0) {
+			g_free (str);
+
 			r = e_sexp_result_new (f, ESEXP_RES_BOOL);
 			r->value.bool = FALSE;
 			return r;

Modified: branches/camel-db-summary/addressbook/libebook/e-vcard.c
==============================================================================
--- branches/camel-db-summary/addressbook/libebook/e-vcard.c	(original)
+++ branches/camel-db-summary/addressbook/libebook/e-vcard.c	Tue Jun 17 16:03:55 2008
@@ -906,13 +906,17 @@
 			gchar *pos1 = attr_str->str;
 			gchar *pos2 = pos1;
 			pos2 = g_utf8_offset_to_pointer (pos2, 75);
+			len -= 75;
 
-			do {
+			while (1) {
 				g_string_append_len (fold_str, pos1, pos2 - pos1);
 				g_string_append (fold_str, CRLF " ");
 				pos1 = pos2;
+				if (len <= 74)
+					break;
 				pos2 = g_utf8_offset_to_pointer (pos2, 74);
-			} while (pos2 < attr_str->str + attr_str->len);
+				len -= 74;
+			}
 			g_string_append (fold_str, pos1);
 			g_string_free (attr_str, TRUE);
 			attr_str = fold_str;

Modified: branches/camel-db-summary/addressbook/libedata-book/e-book-backend-sexp.c
==============================================================================
--- branches/camel-db-summary/addressbook/libedata-book/e-book-backend-sexp.c	(original)
+++ branches/camel-db-summary/addressbook/libedata-book/e-book-backend-sexp.c	Tue Jun 17 16:03:55 2008
@@ -377,12 +377,168 @@
 	return r;
 }
 
+static void
+contains_helper_free_word (gpointer data, gpointer user_data)
+{
+	if (data){
+		g_string_free ((GString *)data, TRUE);
+	}
+}
+
+static char *
+try_contains_word (const gchar *s1, GSList *word)
+{
+	const gchar *o, *p;
+	gunichar unival, first_w_char;
+	GString *w;
+
+	if (s1 == NULL) return NULL;
+	if (word == NULL) return (char*)s1; /* previous was last word */
+	if (word->data == NULL) return NULL; /* illegal structure */
+
+	w = word->data;
+	first_w_char = g_utf8_get_char (w->str);
+
+	o  = s1;
+	for (p = e_util_unicode_get_utf8 (o, &unival); p && unival; p = e_util_unicode_get_utf8 (p, &unival)) {
+		if (unival == first_w_char) {
+			gunichar unival2;
+			const gchar *q = p;
+			const gchar *r = e_util_unicode_get_utf8 (w->str, &unival2);
+			while (q && r && unival && unival2) {
+				q = e_util_unicode_get_utf8 (q, &unival);
+				if (!q) break;
+				r = e_util_unicode_get_utf8 (r, &unival2);
+				if (!r) break;
+				if (unival != unival2) break;
+			}
+			if (!unival2 && r && q) {
+				/* we read whole word and no illegal character has been found */
+				if (word->next == NULL ||
+				    try_contains_word ( e_util_unicode_get_utf8 (o, &unival), word->next)){
+					return (char*)o;
+				}
+			}
+		}
+		o = p;
+	}
+
+	return NULL;
+}
+
+/* converts str into utf8 GString in lowercase;
+   returns NULL if str is invalid utf8 string otherwise
+   returns newly allocated GString
+*/
+static GString *
+chars_to_unistring_lowercase (const char *str)
+{
+	GString *res;
+	gunichar unich;
+	gchar *p;
+
+	if (str == NULL) return NULL;
+
+	res = g_string_new ("");
+
+	for (p = e_util_unicode_get_utf8 (str,&unich); p && unich; p = e_util_unicode_get_utf8 (p,&unich)){
+		g_string_append_unichar (res, g_unichar_tolower (unich));
+	}
+
+	/* it was invalid unichar string */
+	if (p == NULL){
+		g_string_free (res, TRUE);
+		return NULL;
+	}
+
+	return res;
+}
+
+/* first space between words is treated as wildcard character;
+   we are looking for s2 in s1, so s2 will be breaked into words
+*/
+static char *
+contains_helper (const char *s1, const char *s2)
+{
+	GString *s1uni;
+	GString *s2uni;
+	GSList *words;
+	char *next;
+	gboolean have_nonspace;
+	gboolean have_space;
+	GString *last_word, *w;
+	char *res = NULL;
+	gunichar unich;
+
+	s1uni = chars_to_unistring_lowercase (s1);
+	if (s1 == NULL) return NULL;
+
+	s2uni = chars_to_unistring_lowercase (s2);
+	if (s2 == NULL){
+		g_string_free (s1uni, TRUE);
+		return NULL;
+	}
+
+	if (g_utf8_strlen (s1uni->str, -1) == 0 ||
+	    g_utf8_strlen (s2uni->str, -1) == 0){
+		g_string_free (s1uni, TRUE);
+		g_string_free (s2uni, TRUE);
+		return NULL;
+	}
+
+	/* breaking s2 into words */
+        words = NULL;
+	have_nonspace = FALSE;
+	have_space = FALSE;
+	last_word = NULL;
+	w = g_string_new ("");
+	for (next = e_util_unicode_get_utf8 (s2uni->str, &unich); next && unich; next = e_util_unicode_get_utf8 (next, &unich) ){
+		if (unich == ' '){
+			if (have_nonspace && !have_space){
+				/* treat only first space after nonspace character as wildcard,
+				   so we will start new word here
+				*/
+				have_space = TRUE;
+				words = g_slist_append (words, w);
+				last_word = w;
+				w = g_string_new ("");
+			}else{
+				g_string_append_unichar (w, unich);
+			}
+		}else{
+			have_nonspace = TRUE;
+			have_space = FALSE;
+			g_string_append_unichar (w, unich);
+		}
+	}
+
+	if (have_space){
+		/* there was one or more spaces at the end of string,
+		   concat actual word with that last one
+		*/
+		g_string_append_len (last_word, w->str, w->len);
+		g_string_free (w, TRUE);
+	}else{
+		/* append actual word into words list */
+		words = g_slist_append (words, w);
+	}
+
+	res = try_contains_word (s1uni->str, words);
+
+	g_string_free (s1uni, TRUE);
+	g_string_free (s2uni, TRUE);
+	g_slist_foreach (words, contains_helper_free_word, NULL);
+	g_slist_free (words);
+
+	return res;
+}
+
 static ESExpResult *
 func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
 {
 	SearchContext *ctx = data;
 
-	return entry_compare (ctx, f, argc, argv, (char *(*)(const char*, const char*)) e_util_utf8_strstrcase);
+	return entry_compare (ctx, f, argc, argv, contains_helper);
 }
 
 static char *
@@ -405,12 +561,13 @@
 static char *
 endswith_helper (const char *s1, const char *s2)
 {
-	char *p;
-	if ((p = (char*) e_util_utf8_strstrcase(s1, s2))
-	    && (strlen(p) == strlen(s2)))
-		return p;
-	else
+	glong s1len = g_utf8_strlen (s1, -1);
+	glong s2len = g_utf8_strlen (s2, -1);
+
+	if (s1len < s2len)
 		return NULL;
+
+	return (char *)e_util_utf8_strstrcase (g_utf8_offset_to_pointer (s1, s1len - s2len), s2);
 }
 
 static ESExpResult *

Modified: branches/camel-db-summary/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- branches/camel-db-summary/calendar/backends/file/e-cal-backend-file.c	(original)
+++ branches/camel-db-summary/calendar/backends/file/e-cal-backend-file.c	Tue Jun 17 16:03:55 2008
@@ -173,7 +173,7 @@
 	}
 
 	buf = icalcomponent_as_ical_string (priv->icalcomp);
-	g_output_stream_write (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (char), NULL, &e);
+	g_output_stream_write_all (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (char), NULL, NULL, &e);
 	g_free (buf);
 
 	if (e) {

Modified: branches/camel-db-summary/calendar/backends/google/Makefile.am
==============================================================================
--- branches/camel-db-summary/calendar/backends/google/Makefile.am	(original)
+++ branches/camel-db-summary/calendar/backends/google/Makefile.am	Tue Jun 17 16:03:55 2008
@@ -30,6 +30,7 @@
 	$(top_builddir)/calendar/libecal/libecal-1.2.la				\
 	$(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la		\
 	$(top_builddir)/libedataserver/libedataserver-1.2.la			\
+	$(top_builddir)/libebackend/libebackend-1.2.la				\
 	$(top_builddir)/servers/google/libgdata/libgdata-1.2.la			\
 	$(top_builddir)/servers/google/libgdata-google/libgdata-google-1.2.la	\
 	$(EVOLUTION_CALENDAR_LIBS)						\

Modified: branches/camel-db-summary/calendar/backends/google/e-cal-backend-google.c
==============================================================================
--- branches/camel-db-summary/calendar/backends/google/e-cal-backend-google.c	(original)
+++ branches/camel-db-summary/calendar/backends/google/e-cal-backend-google.c	Tue Jun 17 16:03:55 2008
@@ -39,6 +39,7 @@
 
 #include <libedataserver/e-data-server-util.h>
 #include <libedataserver/e-xml-hash-utils.h>
+#include <libedataserver/e-proxy.h>
 
 
 #include <libedata-cal/e-cal-backend-util.h>
@@ -82,6 +83,7 @@
 	gboolean read_only;
 	gboolean mode_changed;
 
+	EProxy *proxy;
 };
 
 gint compare_ids (gconstpointer cache_id, gconstpointer modified_cache_id);
@@ -1292,6 +1294,11 @@
 		priv->timeout_id = 0;
 	}
 
+	if (priv->proxy) {
+		g_object_unref (priv->proxy);
+		priv->proxy = NULL;
+	}
+
 	g_free (priv);
 	cbgo->priv = NULL;
 
@@ -1300,6 +1307,22 @@
 	}
 }
 
+static void
+proxy_settings_changed (EProxy *proxy, gpointer user_data)
+{
+	SoupURI *proxy_uri = NULL;
+
+	ECalBackendGooglePrivate *priv = (ECalBackendGooglePrivate *)user_data;
+	if (!priv || !priv->uri)
+		return;
+
+	/* use proxy if necessary */
+	if (e_proxy_require_proxy_for_uri (proxy, priv->uri)) {
+		proxy_uri = e_proxy_peek_uri (proxy);
+	}
+	gdata_service_set_proxy (GDATA_SERVICE (priv->service), proxy_uri);
+}
+ 
 /* Object initialisation function for google backend */
 static void
 e_cal_backend_google_init (ECalBackendGoogle *cbgo, ECalBackendGoogleClass *class)
@@ -1316,6 +1339,10 @@
 	priv->timeout_id = 0;
 	cbgo->priv = priv;
 
+	priv->proxy = e_proxy_new ();
+	e_proxy_setup_proxy (priv->proxy);
+	g_signal_connect (priv->proxy, "changed", G_CALLBACK (proxy_settings_changed), priv);
+
 	/* FIXME set a lock */
 	e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbgo), TRUE);
 }
@@ -1479,6 +1506,13 @@
 
 	priv = cbgo->priv;
 	priv->uri = uri;
+
+	/* use proxy if necessary */
+	if (e_proxy_require_proxy_for_uri (priv->proxy, priv->uri)) {
+		SoupURI *proxy_uri = e_proxy_peek_uri (priv->proxy);
+
+		gdata_service_set_proxy (GDATA_SERVICE (priv->service), proxy_uri);
+	}
 }
 
 /**

Modified: branches/camel-db-summary/calendar/backends/groupwise/Makefile.am
==============================================================================
--- branches/camel-db-summary/calendar/backends/groupwise/Makefile.am	(original)
+++ branches/camel-db-summary/calendar/backends/groupwise/Makefile.am	Tue Jun 17 16:03:55 2008
@@ -29,6 +29,7 @@
 	$(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la	\
 	$(top_builddir)/servers/groupwise/libegroupwise-1.2.la		\
 	$(top_builddir)/libedataserver/libedataserver-1.2.la		\
+	$(top_builddir)/libebackend/libebackend-1.2.la			\
 	$(EVOLUTION_CALENDAR_LIBS)					\
 	$(SOUP_LIBS)
 

Modified: branches/camel-db-summary/calendar/backends/http/Makefile.am
==============================================================================
--- branches/camel-db-summary/calendar/backends/http/Makefile.am	(original)
+++ branches/camel-db-summary/calendar/backends/http/Makefile.am	Tue Jun 17 16:03:55 2008
@@ -23,6 +23,7 @@
 	$(top_builddir)/calendar/libecal/libecal-1.2.la			\
 	$(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la	\
 	$(top_builddir)/libedataserver/libedataserver-1.2.la		\
+	$(top_builddir)/libebackend/libebackend-1.2.la			\
 	$(EVOLUTION_CALENDAR_LIBS)					\
 	$(SOUP_LIBS)
 

Modified: branches/camel-db-summary/calendar/backends/weather/Makefile.am
==============================================================================
--- branches/camel-db-summary/calendar/backends/weather/Makefile.am	(original)
+++ branches/camel-db-summary/calendar/backends/weather/Makefile.am	Tue Jun 17 16:03:55 2008
@@ -31,6 +31,7 @@
 	$(top_builddir)/calendar/libecal/libecal-1.2.la				\
 	$(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la		\
 	$(top_builddir)/libedataserver/libedataserver-1.2.la			\
+	$(top_builddir)/libebackend/libebackend-1.2.la			\
 	$(EVOLUTION_CALENDAR_LIBS)						\
 	$(SOUP_LIBS)
 

Modified: branches/camel-db-summary/camel/camel-msgport.c
==============================================================================
--- branches/camel-db-summary/camel/camel-msgport.c	(original)
+++ branches/camel-db-summary/camel/camel-msgport.c	Tue Jun 17 16:03:55 2008
@@ -29,7 +29,10 @@
 #include <nspr.h>
 #endif
 
+#include <glib.h>
+
 #ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
 #include <winsock2.h>
 #endif
 

Modified: branches/camel-db-summary/camel/camel-stream-vfs.c
==============================================================================
--- branches/camel-db-summary/camel/camel-stream-vfs.c	(original)
+++ branches/camel-db-summary/camel/camel-stream-vfs.c	Tue Jun 17 16:03:55 2008
@@ -217,7 +217,7 @@
 
 	g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream_vfs->stream), 0);
 
-	nwritten = g_output_stream_write (G_OUTPUT_STREAM (stream_vfs->stream), buffer, n, NULL, &error);
+	nwritten = g_output_stream_write_all (G_OUTPUT_STREAM (stream_vfs->stream), buffer, n, NULL, NULL, &error);
 
 	if (error) {
 		g_warning ("%s", error->message);

Modified: branches/camel-db-summary/configure.in
==============================================================================
--- branches/camel-db-summary/configure.in	(original)
+++ branches/camel-db-summary/configure.in	Tue Jun 17 16:03:55 2008
@@ -4,7 +4,7 @@
 # Evolution-Data-Server version */
 m4_define([eds_major_version], [2])
 m4_define([eds_minor_version], [23])
-m4_define([eds_micro_version], [4])
+m4_define([eds_micro_version], [5])
 
 m4_define([eds_version],
           [eds_major_version.eds_minor_version.eds_micro_version])

Modified: branches/camel-db-summary/libedataserver/e-proxy.c
==============================================================================
--- branches/camel-db-summary/libedataserver/e-proxy.c	(original)
+++ branches/camel-db-summary/libedataserver/e-proxy.c	Tue Jun 17 16:03:55 2008
@@ -26,10 +26,16 @@
 #include <config.h>
 #endif
 
-#include <netinet/in.h>
-#include <sys/socket.h>
 #include <string.h>
 #include <stdlib.h>
+
+#ifdef _WIN32
+#include <winsock2.h>
+#else
+#include <netinet/in.h>
+#include <sys/socket.h>
+#endif
+
 #include <glib.h>
 #include <glib-object.h>
 

Modified: branches/camel-db-summary/libedataserverui/e-passwords.c
==============================================================================
--- branches/camel-db-summary/libedataserverui/e-passwords.c	(original)
+++ branches/camel-db-summary/libedataserverui/e-passwords.c	Tue Jun 17 16:03:55 2008
@@ -91,6 +91,10 @@
 static gint idle_id;
 static gint ep_online_state = TRUE;
 
+#ifdef WITH_GNOME_KEYRING
+static char *default_keyring = NULL;
+#endif
+
 #define KEY_FILE_GROUP_PREFIX "Passwords-"
 static GKeyFile *key_file = NULL;
 
@@ -811,6 +815,13 @@
 		while (iter != NULL) {
 			GnomeKeyringFound *found = iter->data;
 
+			if (default_keyring && strcmp(default_keyring, found->keyring) != 0) {
+				g_message ("Received a password from keyring '%s'. But looking for the password from '%s' keyring\n", found->keyring, default_keyring);
+				iter = g_list_next (iter);
+				continue;			
+			}
+				
+
 			if (ep_keyring_validate (uri->user, uri->host, uri->protocol, found->attributes)) {
 				msg->password = g_strdup (found->secret);
 				break;
@@ -1183,6 +1194,10 @@
 			GTK_TABLE (container), widget,
 			1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
 	}
+#ifdef WITH_GNOME_KEYRING
+	if (gnome_keyring_is_available ())
+		gnome_keyring_get_default_keyring_sync (&default_keyring); 
+#endif
 
 	msg->noreply = noreply;
 
@@ -1256,6 +1271,9 @@
 		g_hash_table_destroy (password_cache);
 		password_cache = NULL;
 	}
+#ifdef WITH_GNOME_KEYRING
+	g_free (default_keyring);
+#endif	
 }
 
 /**

Modified: branches/camel-db-summary/servers/exchange/lib/e2k-autoconfig.c
==============================================================================
--- branches/camel-db-summary/servers/exchange/lib/e2k-autoconfig.c	(original)
+++ branches/camel-db-summary/servers/exchange/lib/e2k-autoconfig.c	Tue Jun 17 16:03:55 2008
@@ -1506,15 +1506,21 @@
 		euri = e2k_uri_new (ac->home_uri);
 		path = g_strdup (euri->path + 1);
 		e2k_uri_free (euri);
-		mailbox = strrchr (path, '/');
-		if (mailbox && !mailbox[1]) {
-			*mailbox = '\0';
+
+		/* change a mailbox only if not set by the caller */
+		if (!exchange_params->mailbox || !*exchange_params->mailbox) {
 			mailbox = strrchr (path, '/');
+			if (mailbox && !mailbox[1]) {
+				*mailbox = '\0';
+				mailbox = strrchr (path, '/');
+			}
+			if (mailbox)
+				*mailbox++ = '\0';
+
+			g_free (exchange_params->mailbox);
+			exchange_params->mailbox  = g_strdup (mailbox);
 		}
-		if (mailbox)
-			*mailbox++ = '\0';
 
-		exchange_params->mailbox  = g_strdup (mailbox);
 		exchange_params->owa_path = g_strdup_printf ("%s%s", "/", path);
 		g_free (path);
 		exchange_params->host = g_strdup (ac->pf_server);

Modified: branches/camel-db-summary/servers/google/libgdata-google/gdata-google-service.c
==============================================================================
--- branches/camel-db-summary/servers/google/libgdata-google/gdata-google-service.c	(original)
+++ branches/camel-db-summary/servers/google/libgdata-google/gdata-google-service.c	Tue Jun 17 16:03:55 2008
@@ -37,6 +37,7 @@
 static GDataFeed  * gdata_google_service_get_feed (GDataService *service, const gchar *feed_url, GError **error);
 static GDataEntry * gdata_google_service_update_entry (GDataService *service, GDataEntry *entry, GError **error);
 static void         gdata_google_service_set_credentials (GDataService *service, const gchar *username, const gchar *password);
+static void         gdata_google_service_set_proxy (GDataService *service, SoupURI *proxy);
 
 typedef struct _GDataGoogleServiceAuth GDataGoogleServiceAuth;
 struct _GDataGoogleServiceAuth {
@@ -75,7 +76,50 @@
 	return error ? error : (error = g_quark_from_static_string ("gdata_google_error_quark"));
 }
 
-void
+static void
+gdata_google_service_set_proxy (GDataService *service, SoupURI *proxy)
+{
+	GDataGoogleServicePrivate *priv;
+
+	g_return_if_fail (service != NULL);
+	g_return_if_fail (GDATA_IS_GOOGLE_SERVICE(service));
+
+	priv = GDATA_GOOGLE_SERVICE_GET_PRIVATE(GDATA_GOOGLE_SERVICE(service));
+	if (proxy && priv && priv->soup_session)
+		g_object_set (priv->soup_session, SOUP_SESSION_PROXY_URI, proxy, NULL);
+}
+
+/* send a message without redirection and if it was required, then redirects itself */
+static void
+send_and_handle_google_redirection (SoupSession *soup_session, SoupMessage *msg)
+{
+	soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
+	soup_session_send_message (soup_session, msg);
+	soup_message_set_flags (msg, 0);
+
+	if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
+		SoupURI *new_uri;
+		const char *new_loc;
+
+		new_loc = soup_message_headers_get (msg->response_headers, "Location");
+		g_return_if_fail (new_loc != NULL);
+
+		new_uri = soup_uri_new_with_base (soup_message_get_uri (msg), new_loc);
+		if (!new_uri) {
+			soup_message_set_status_full (msg,
+						      SOUP_STATUS_MALFORMED,
+						      "Invalid Redirect URL");
+			return;
+		}
+
+		soup_message_set_uri (msg, new_uri);
+		soup_uri_free (new_uri);
+
+		soup_session_send_message (soup_session, msg);
+	}
+}
+
+static void
 gdata_google_service_set_credentials (GDataService *service, const gchar *username, const gchar *password)
 {
 	GDataGoogleServicePrivate *priv;
@@ -115,7 +159,6 @@
 	GHashTable *request_form;
 	gchar *request_body;
 	gchar *token = NULL;
-	int  http_status;
 
 	priv = GDATA_GOOGLE_SERVICE_GET_PRIVATE(service);
 	auth = (GDataGoogleServiceAuth *)priv->auth;
@@ -135,11 +178,11 @@
 				  SOUP_MEMORY_TAKE,
 				  request_body, strlen(request_body));
 
-	http_status = soup_session_send_message (priv->soup_session, msg);
+	soup_session_send_message (priv->soup_session, msg);
 
-    	if (http_status != 200) {
+    	if (msg->status_code != 200) {
 		g_set_error (error, SOUP_HTTP_ERROR,
-					 http_status, soup_status_get_phrase (http_status));
+					 msg->status_code, msg->reason_phrase);
 		g_object_unref(msg);
 		return (NULL != token);
 	}
@@ -180,7 +223,7 @@
  *
  **/
 
-GDataFeed *
+static GDataFeed *
 gdata_google_service_get_feed (GDataService *service, const gchar *feed_url, GError **error)
 {
 	GDataFeed *feed = NULL;
@@ -188,7 +231,6 @@
 	GDataGoogleServiceAuth *auth;
 	SoupSession *soup_session;
 	SoupMessage *msg;
-	int http_status;
 
 	g_return_val_if_fail(service != NULL, NULL);
 	g_return_val_if_fail(GDATA_IS_GOOGLE_SERVICE(service),NULL);
@@ -207,10 +249,10 @@
 	soup_message_headers_append(msg->request_headers,
 			"Authorization", (gchar *)g_strdup_printf("GoogleLogin auth=%s", auth->token));
 
-	http_status = soup_session_send_message(soup_session, msg);
-	if (http_status != 200) {
+	soup_session_send_message (soup_session, msg);
+	if (msg->status_code != 200) {
 		g_set_error (error, SOUP_HTTP_ERROR,
-					 http_status, soup_status_get_phrase (http_status));
+					 msg->status_code, msg->reason_phrase);
 		g_object_unref (msg);
 		return NULL;
 	}
@@ -240,7 +282,7 @@
  * returns the newly inserted entry
  *
  **/
-GDataEntry *
+static GDataEntry *
 gdata_google_service_insert_entry (GDataService *service, const gchar *feed_url, GDataEntry *entry, GError **error)
 {
 	GDataGoogleServicePrivate *priv;
@@ -249,7 +291,6 @@
 	SoupSession *soup_session;
 	SoupMessage *msg;
 	gchar *entry_xml;
-	int http_status;
 
 	g_return_val_if_fail(service != NULL, NULL);
 	g_return_val_if_fail(GDATA_IS_GOOGLE_SERVICE(service), NULL);
@@ -278,10 +319,12 @@
 				entry_xml,
 				strlen(entry_xml));
 
-	http_status = soup_session_send_message(soup_session, msg);
-    	if (http_status != 201) {
+	/* Handle redirects ourself, since soup does not behave like google-api expects */
+	send_and_handle_google_redirection (soup_session, msg);
+
+	if (msg->status_code != 201) {
 		g_set_error (error, SOUP_HTTP_ERROR,
-					 http_status, soup_status_get_phrase (http_status));
+					 msg->status_code, msg->reason_phrase);
 		g_object_unref (msg);
 		return NULL;
 	}
@@ -309,7 +352,7 @@
  * Removes the entry
  *
  **/
-gboolean
+static gboolean
 gdata_google_service_delete_entry (GDataService *service, GDataEntry *entry, GError **error)
 {
 	GDataGoogleServiceAuth *auth;
@@ -317,7 +360,6 @@
 	SoupSession *soup_session;
 	SoupMessage *msg;
 	const gchar *entry_edit_url;
-	int http_status;
 	gboolean retval = FALSE;
 
 	g_return_val_if_fail (service !=NULL, FALSE);
@@ -338,11 +380,13 @@
 				     "Authorization",
 				     (gchar *)g_strdup_printf ("GoogleLogin auth=%s",
 				     auth->token));
-	http_status = soup_session_send_message (soup_session, msg);
 
-    	if (http_status != 200) {
+	/* Handle redirects ourself */
+	send_and_handle_google_redirection (soup_session, msg);
+
+    	if (msg->status_code != 200) {
 		g_set_error (error, SOUP_HTTP_ERROR,
-					 http_status, soup_status_get_phrase (http_status));
+					 msg->status_code, msg->reason_phrase);
 	} else {
 		retval = TRUE;
 	}
@@ -392,7 +436,6 @@
 	SoupSession *soup_session;
 	SoupMessage *msg;
 	gchar *entry_xml;
-	int http_status;
 	GDataEntry *updated_entry = NULL;
 
 	g_return_val_if_fail (service !=NULL, FALSE);
@@ -422,11 +465,12 @@
 				entry_xml,
 				strlen(entry_xml));
 
-	http_status = soup_session_send_message (soup_session, msg);
+	/* Handle redirects ourself */
+	send_and_handle_google_redirection (soup_session, msg);
 
-    	if (http_status != 200) {
+    	if (msg->status_code != 200) {
 		g_set_error (error, SOUP_HTTP_ERROR,
-					 http_status, soup_status_get_phrase (http_status));
+					 msg->status_code, msg->reason_phrase);
 		g_object_unref (msg);
 		return updated_entry;
 	}
@@ -448,6 +492,7 @@
 {
 	GDataServiceIface *iface = (GDataServiceIface *)g_iface;
 
+	iface->set_proxy = gdata_google_service_set_proxy;
 	iface->set_credentials = gdata_google_service_set_credentials;
 	iface->get_feed = gdata_google_service_get_feed;
 	iface->insert_entry = gdata_google_service_insert_entry;

Modified: branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.c
==============================================================================
--- branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.c	(original)
+++ branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.c	Tue Jun 17 16:03:55 2008
@@ -26,6 +26,12 @@
 #include <gdata-service-iface.h>
 
 void
+gdata_service_set_proxy (GDataService *self, SoupURI *proxy)
+{
+	GDATA_SERVICE_GET_IFACE(self)->set_proxy(self, proxy);
+}
+
+void
 gdata_service_set_credentials (GDataService *self, const char *username, const gchar *password)
 {
 	GDATA_SERVICE_GET_IFACE(self)->set_credentials(self, username, password);

Modified: branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.h
==============================================================================
--- branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.h	(original)
+++ branches/camel-db-summary/servers/google/libgdata/gdata-service-iface.h	Tue Jun 17 16:03:55 2008
@@ -27,6 +27,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <libsoup/soup.h>
 
 #include "gdata-feed.h"
 #include "gdata-entry.h"
@@ -48,6 +49,7 @@
   GTypeInterface parent;
 
   /* Public Methods */
+  void         (*set_proxy) (GDataService *self, SoupURI *proxy);
   void         (*set_credentials)(GDataService *self, const gchar *username, const gchar *password);
   GDataFeed *  (*get_feed)    (GDataService *self, const gchar *feed_getURL, GError **error);
   GDataEntry*  (*insert_entry)(GDataService *self, const gchar *feed_postURL, GDataEntry *entry, GError **error);
@@ -60,6 +62,7 @@
 GType gdata_service_get_type(void);
 
 /* Function Prototypes */
+void        gdata_service_set_proxy (GDataService *self, SoupURI *proxy);
 void        gdata_service_set_credentials(GDataService *self, const gchar *username, const gchar *password);
 
 GDataFeed*  gdata_service_get_feed(GDataService *self, const gchar *feed_getURL, GError **error);

Modified: branches/camel-db-summary/servers/groupwise/Makefile.am
==============================================================================
--- branches/camel-db-summary/servers/groupwise/Makefile.am	(original)
+++ branches/camel-db-summary/servers/groupwise/Makefile.am	Tue Jun 17 16:03:55 2008
@@ -52,6 +52,7 @@
 	build-timestamp.h
 
 libegroupwise_1_2_la_LIBADD =						\
+	../../libedataserver/libedataserver-1.2.la			\
 	$(E_DATA_SERVER_LIBS)						\
 	$(SOUP_LIBS)
 

Modified: branches/camel-db-summary/servers/groupwise/e-gw-item.c
==============================================================================
--- branches/camel-db-summary/servers/groupwise/e-gw-item.c	(original)
+++ branches/camel-db-summary/servers/groupwise/e-gw-item.c	Tue Jun 17 16:03:55 2008
@@ -543,7 +543,7 @@
 	priv->attach_list = NULL ;
 	priv->simple_fields = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
 	priv->full_name = g_new0(FullName, 1);
-	priv->addresses = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_postal_address);
+	priv->addresses = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, free_postal_address);
 	priv->additions = g_hash_table_new(g_str_hash, g_str_equal);
 	priv->updates =   g_hash_table_new (g_str_hash, g_str_equal);
 	priv->deletions = g_hash_table_new (g_str_hash, g_str_equal);
@@ -1277,7 +1277,7 @@
 				add = "Other";
 
 			if (value)
-				g_hash_table_insert (item->priv->addresses, (char*)add, address);
+				g_hash_table_insert (item->priv->addresses, (char *) add, address);
 			else
 				free_postal_address (address);
 			g_free (value);
@@ -1411,7 +1411,7 @@
 	if (subparam) {
 		address = g_new0 (PostalAddress, 1);
 		set_postal_address_from_soap_parameter (address, subparam);
-		g_hash_table_insert (item->priv->addresses, g_strdup ("Office"), address);
+		g_hash_table_insert (item->priv->addresses, "Office", address);
 
 	}
 



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