[Evolution-hackers] Terrible hack to allow read-only access to secure Google Calendars

2007-08-19 Thread Benjamin Kahn
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.0 -0400
+++ evolution-data-server-1.10.2-gmail/calendar/backends/http/e-cal-backend-http.c	2007-08-17 16:31:26.0 -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


Re: [Evolution-hackers] Terrible hack to allow read-only access to secure Google Calendars

2007-08-19 Thread Benjamin Kahn
On Mon, 2007-08-20 at 00:20 +0530, Srinivasa Ragavan wrote:
> 
> Thanks for your patch. But we have a summer of code student, Ebby
> Wiselyn working on a Google calendar backend for Evolution/EDS.
> 
> He had great successes recently
> (http://mail.gnome.org/archives/gnome-soc-list/2007-August/msg00035.html)
> 
> Some screen shots at http://edsgcal.wordpress.com/screenshots-2/
> 
> It would be a clean approach and would provide  a read-write access to
> Google calendars and will have a better sync mechanisms.
> 
> I was hoping to add this to 2.12, but we realized that it is not
> feasible and is now targeted for 2.14. 
> 
> So I really don't want to take your patch.
> 
Yup.  I don't recommend that my patch be applied:

> > 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.  

And I know about the other project.  And it'll be great -- next year
when I can use it.  For now, this gets me close to what I need, so I
thought others might be interested as well.

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Terrible hack to allow read-only access to secure Google Calendars

2007-08-19 Thread Srinivasa Ragavan
Hi xkahn,

Thanks for your patch. But we have a summer of code student, Ebby
Wiselyn working on a Google calendar backend for Evolution/EDS.

He had great successes recently
(http://mail.gnome.org/archives/gnome-soc-list/2007-August/msg00035.html)

Some screen shots at http://edsgcal.wordpress.com/screenshots-2/

It would be a clean approach and would provide  a read-write access to
Google calendars and will have a better sync mechanisms.

I was hoping to add this to 2.12, but we realized that it is not
feasible and is now targeted for 2.14. 

So I really don't want to take your patch.

-Srini.

On Sat, 2007-08-18 at 11:09 -0400, Benjamin Kahn wrote:
> 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_OR_GOOGLE -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-hackers mailing list
> Evolution-hackers@gnome.org
> http://mail.gnome.org/mailman/listinfo/evolution-hackers

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


[Evolution-hackers] Terrible hack to allow read-only access to secure Google Calendars

2007-08-18 Thread Benjamin Kahn
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_OR_GOOGLE -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.0 -0400
+++ evolution-data-server-1.10.2-gmail/calendar/backends/http/e-cal-backend-http.c	2007-08-17 16:31:26.0 -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