Re: [evolution-patches] Addressbook, calendar and exchange patch



[Resending to the new mailing address]

Hi,


On Fri, 2005-08-26 at 10:38 -0700, Christian Kellner wrote:
> Hi!
> 
> (WARNING, rant mode is on)
> 
> I totally appreciate the efforts to unify the password handling across
> components, but again I think implementing quick and dirty URI parsing
> in various places is the damn wrong way. Please look at my comment on
> this thread [1] and NotZed's follow up. Despite the fact that I think
> using g_strsplit for that is not The Right Way[tm] it's duplicated code
> all over the place, might not catch all cases. Why don't you just use
> EUri. That's what it's for. 

Yup, you are right. I should have used EUri instead. All i wanted to do
was to make the password keys across components the same. Camel uses the
EAccount uri to generate the password key. So, i thought of having the
same uri string in other components as well. EUri does just that. So, i
have created a new patch which uses the EUri. Please let me know if this
is right.


Thanks
-- Sarfraaz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.510
diff -u -p -u -p -r1.510 ChangeLog
--- ChangeLog	25 Aug 2005 12:20:43 -0000	1.510
+++ ChangeLog	27 Aug 2005 12:15:41 -0000
@@ -1,3 +1,9 @@
+2005-08-26  Sarfraaz Ahmed <asarfraaz novell com>
+
+	* libecal/e-cal.c (build_pass_key) : Do not recreate the uri. Instead
+	strip the uri part after a ';'. The backend can now set its uri
+	accordingly to have a consistent password key across multiple calendars
+
 2005-08-25  Chenthill Palanisamy  <pchenthill novell com>
 
 	Fixes #312853
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.112
diff -u -p -u -p -r1.112 e-cal.c
--- libecal/e-cal.c	24 Aug 2005 02:32:56 -0000	1.112
+++ libecal/e-cal.c	27 Aug 2005 12:15:42 -0000
@@ -1583,50 +1583,17 @@ e_cal_set_auth_func (ECal *ecal, ECalAut
 }
 
 static char *
-get_host_from_uri (const char *uri)
-{
-	char *at = strchr (uri, '@');
-	char *slash;
-	int length;
-
-	if (!at)
-		return NULL;
-	at++; /* Parse over the @ symbol */
-	slash = strchr (at, '/');
-	if (!slash)
-		return NULL;
-	slash --; /* Walk back */
-
-	length = slash - at;
-
-	return g_strndup (at, length);
-}
-
-static char *
 build_pass_key (ESource *source)
 {
-	const char *base_uri, *user_name, *auth_type, *rel_uri;
-	char *uri, *new_uri, *host_name;
-	ESourceGroup *es_grp;
-
-	es_grp = e_source_peek_group (source);
-	base_uri = e_source_group_peek_base_uri (es_grp);
-	if (base_uri) {
-		user_name = e_source_get_property (source, "username");
-		auth_type = e_source_get_property (source, "auth-type");
-		rel_uri = e_source_peek_relative_uri (source);
-		host_name = get_host_from_uri (rel_uri);
-		if (host_name) {
-			new_uri = g_strdup_printf ("%s%s;%s %s/", base_uri, user_name, auth_type, host_name);
-			g_free (host_name);
-
-			return new_uri;
-		}
-	}
+	char *uri, *euri_str;
+	EUri *euri;
 
 	uri = e_source_get_uri (source);
-
-	return uri;
+	euri = e_uri_new (uri);
+	euri_str = e_uri_to_string (euri, FALSE);
+	printf ("euri_str : %s\n", euri_str);
+	g_free (uri);
+	return euri_str;
 }
 
 static gboolean


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