So I've created a horrible, ugly patch which makes Evolution able to
display the Google Calendars.  The problem is that you may want to view
your calendar without using the private URL.  (For example, the hosted
version of the Google Calendar will only deliver the ics file if you
have authenticated.)  But Evolution doesn't know how to authenticate to
Google.

The attached patch adds the ability to store an authentication token in
GConf which seem not to expire.

In other words, you apply this patch to evolution-data-server, run the
commands that follow, and you'll have READ ONLY access to your Google
Calendar that only updates every 30 minutes or so.  Yes, it's just as
fun and easy to use as it sounds.

First, run:

curl -D - https://www.google.com/accounts/ClientLogin -d accountType=HOSTED -d 
Email='||username||%40||domain||' -d Passwd='||password||' -d service=cl -d 
source=evolution-testing-0.0.0

You'll need to replace ||username||, ||domain||, and ||password|| to
match your email username (domain will likely be google.com) and google
password.

This command will return three lines.  The third line will start with
"auth=".  

Then call:

gconftool-2 --type string -s /apps/evolution/calendar/gauth ||authstring||

You'll need to replace ||authstring|| with the 180+ character string
returned by the previous command.

You should only have to do the above once.  Or whenever the auth string
expires which seems to be very rare, if at all.

Then quit Evolution and kill the data server with this command:

evolution --force-shutdown

Start evolution after applying the attached patch.

Go to the calendar component and add:

        
webcal://www.google.com/calendar/ical/||username||@||domain||/private/full.ics

as a web calendar.  You'll need to replace ||username|| with your email
username and ||domain|| with your email domain, usually gmail.com.
You'll need to check "Use Secure Connection" and I recommend
that you cache the calendar locally.

Anyway, there are some problems:

      * Seriously, it's an ugly patch
      * You have to recompile evolution-data-server
      * Adding an auth token to GConf?!  What are you, nuts?
      * Evolution may not be able to understand the appointments set by
        Google's calendar
      * The calendar only updates every once in a while
      * You can't edit the calendar in Evolution

Probably other problems.  :)  I don't recommend this be applied to
Evolution, but I do think it might be an interesting jumping off point
for someone else.  For the moment, it solves my problem.  

I'm not subscribed to e-h, so please include me in any replies.

--- evolution-data-server-1.10.2/calendar/backends/http/e-cal-backend-http.c	2007-04-09 08:43:00.000000000 -0400
+++ evolution-data-server-1.10.2-gmail/calendar/backends/http/e-cal-backend-http.c	2007-08-17 16:31:26.000000000 -0400
@@ -381,6 +381,7 @@
 {
 	ECalBackendHttpPrivate *priv;
 	SoupMessage *soup_message;
+	GConfClient *conf_client;
 
 	priv = cbhttp->priv;
 
@@ -396,14 +397,14 @@
 
 	priv->is_loading = TRUE;
 
+	conf_client = gconf_client_get_default ();
+
 	/* create the Soup session if not already created */
 	if (!priv->soup_session) {
-		GConfClient *conf_client;
 
 		priv->soup_session = soup_session_async_new ();
 
 		/* set the HTTP proxy, if configuration is set to do so */
-		conf_client = gconf_client_get_default ();
 		if (gconf_client_get_bool (conf_client, "/system/http_proxy/use_http_proxy", NULL)) {
 			char *server, *proxy_uri;
 			int port;
@@ -454,6 +455,24 @@
 	soup_message = soup_message_new (SOUP_METHOD_GET, priv->uri);
 	soup_message_add_header (soup_message->request_headers, "User-Agent",
 				 "Evolution/" VERSION);
+
+	if (strstr (priv->uri, "google.com/calendar")) {
+		char *auth;
+
+		auth = gconf_client_get_string (conf_client,
+						"/apps/evolution/calendar/gauth", NULL);
+		if (auth) {
+			char *auth_header = g_strdup_printf ("GoogleLogin auth=%s", auth);
+			
+			soup_message_add_header (soup_message->request_headers, 
+						 "Authorization",
+						 auth_header);
+
+			g_free (auth_header);
+			g_free (auth);
+		}
+	}
+
 	soup_message_set_flags (soup_message, SOUP_MESSAGE_NO_REDIRECT);
 
 	soup_session_queue_message (priv->soup_session, soup_message,
_______________________________________________
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers

Reply via email to