Do not recreate the uri. Instead strip the uri part after a ';'. The
authorSarfraaz Ahmed <asarfraaz@novell.com>
Wed, 28 Sep 2005 13:18:01 +0000 (13:18 +0000)
committerAhmed Sarfraaz <sarfraaz@src.gnome.org>
Wed, 28 Sep 2005 13:18:01 +0000 (13:18 +0000)
2005-09-27  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
        * libedata-cal/e-data-cal-factory.c (impl_CalFactory_getCal) : Use the
        esource uri instead of the euri string to identify the calendar.
        Fixes #314746

calendar/ChangeLog
calendar/libecal/e-cal.c
calendar/libedata-cal/e-data-cal-factory.c

index e4202c5..866aeba 100644 (file)
@@ -1,3 +1,12 @@
+2005-09-27  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
+       * libedata-cal/e-data-cal-factory.c (impl_CalFactory_getCal) : Use the
+       esource uri instead of the euri string to identify the calendar.
+       Fixes #314746
+
 2005-09-26  Wang Xin  <jedy.wang@sun.com>
 
        Fixes #317226
index 93f495e..e3a942c 100644 (file)
@@ -1583,50 +1583,17 @@ e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data)
 }
 
 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);
+       g_free (uri);
+       return euri_str;
 }
 
 static gboolean
index 223a77c..4de4b34 100644 (file)
@@ -197,14 +197,12 @@ impl_CalFactory_getCal (PortableServer_Servant servant,
 
        /* Parse the uri */
        uri = e_uri_new (str_uri);
-       g_free (str_uri);
-
        if (!uri) {
                bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CalFactory_InvalidURI);
 
                return CORBA_OBJECT_NIL;
        }
-       str_uri = e_uri_to_string(uri, FALSE);
+
        uri_type_string = g_strdup_printf ("%s:%d", str_uri, (int)calobjtype_to_icalkind (type));
        g_free(str_uri);