Re: [evolution-patches] Fix for scalix provider in e-cal.c



Rodrigo Moya wrote:

On Wed, 2005-04-06 at 11:56 +0530, Harish Krishnaswamy wrote:
The current approach is ugly :(. This was meant to be a temporary hack
as we did not want to add a  gconf entry and preferred backends to have
flexibility in choosing the store. This patch looks good for now - the code does not allow backends to do
better. I will rework it at the earliest.

there is one thing though, which is all those 'if' statements should
probably be better 'if/else if' statements, so that we don't do all
comparisons in all cases.
Good point, I also added a g_free for the mangled_uri string. Patch attached.

Carsten
Index: e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.94.2.2
diff -u -p -r1.94.2.2 e-cal.c
--- e-cal.c	15 Mar 2005 01:33:53 -0000	1.94.2.2
+++ e-cal.c	6 Apr 2005 16:42:41 -0000
@@ -1341,18 +1341,22 @@ set_local_attachment_store (ECal *ecal)
 	}
 
 	/* the file backend uses its uri as the attachment store*/
-	if (g_str_has_prefix (priv->uri, "file://"))
+	if (g_str_has_prefix (priv->uri, "file://")) {
 		priv->local_attachment_store = g_strdup (priv->uri);
-	if (g_str_has_prefix (priv->uri, "groupwise://")) {
+	} else if (g_str_has_prefix (priv->uri, "groupwise://")) {
 		/* points to the location of the cache*/
 		priv->local_attachment_store = 
 			g_strconcat ("file://", g_get_home_dir (), "/", ".evolution/cache/calendar",
 				     "/", mangled_uri, NULL);
-	}
-	if (g_str_has_prefix (priv->uri, "exchange://")) {
+	} else if (g_str_has_prefix (priv->uri, "exchange://")) {
 		priv->local_attachment_store = g_strdup_printf ("file://%s/.evolution/exchange/%s", 
 					g_get_home_dir (), mangled_uri);
-	}
+	} else if (g_str_has_prefix (priv->uri, "scalix://")) {
+                priv->local_attachment_store = g_strdup_printf ("file://%s/.evolution/cache/scalix/%s/attach",
+                                        g_get_home_dir (), mangled_uri);
+        }
+
+	g_free (mangled_uri);
 }
 
 /**
begin:vcard
fn:<b>Carsten Guenther</b>
n:Guenther;Carsten
org:<center><a href="http://www.scalix.com";><img border="0" src="http://www.scalix.com/images/logo.gif"/></a></center>
adr:Suite 602;;1400 Fashion Island Blvd;San Mateo;CA;94404;USA
email;internet:carsten guenther scalix com
x-mozilla-html:TRUE
url:http://www.scalix.com
version:2.1
end:vcard



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