[evolution/gnome-2-26] Store username in a source URL in CalDAV



commit 26fb7a610c9a0b34f0d37a50ec4acab823b920ee
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 28 17:05:20 2009 +0200

    Store username in a source URL in CalDAV
    
            ** Fix for bug #578335
    
            * caldav-source.c: (user_changed), (location_changed):
            Revert part of bug #562990, as EPassword requires username
            as part of an URL to store passwords properly to a keyring.
---
 plugins/caldav/ChangeLog       |    8 ++++++++
 plugins/caldav/caldav-source.c |   14 +++++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/plugins/caldav/ChangeLog b/plugins/caldav/ChangeLog
index 256dc03..d49edea 100644
--- a/plugins/caldav/ChangeLog
+++ b/plugins/caldav/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-28  Milan Crha  <mcrha redhat com>
+
+	** Fix for bug #578335
+
+	* caldav-source.c: (user_changed), (location_changed):
+	Revert part of bug #562990, as EPassword requires username
+	as part of an URL to store passwords properly to a keyring.
+
 2009-02-26  Matthew Barnes  <mbarnes redhat com>
 
 	** Fixes part of bug #572950
diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c
index 6fb7ea3..b7ba2b5 100644
--- a/plugins/caldav/caldav-source.c
+++ b/plugins/caldav/caldav-source.c
@@ -154,11 +154,22 @@ location_changed (GtkEntry *editable, ESource *source)
 {
 	EUri       *euri;
 	char       *ruri;
-	const char *uri;
+	const char *uri, *username;
 
 	uri = gtk_entry_get_text (GTK_ENTRY (editable));
 
 	euri = e_uri_new (uri);
+	g_return_if_fail (euri != NULL);
+
+	username = e_source_get_property (source, "username");
+	if (username && !*username)
+		username = NULL;
+
+	if ((!euri->user && username) || (euri->user && username && !g_str_equal (euri->user, username))) {
+		g_free (euri->user);
+		euri->user = g_strdup (username);
+	}
+
 	ruri = print_uri_noproto (euri);
 	e_source_set_relative_uri (source, ruri);
 	g_free (ruri);
@@ -193,6 +204,7 @@ user_changed (GtkEntry *editable, ESource *source)
 	euri->user = NULL;
 
 	if (user != NULL && *user) {
+		euri->user = g_strdup (user);
 		e_source_set_property (source, "auth", "1");
 	} else {
 		e_source_set_property (source, "auth", NULL);



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