[evolution/kill-bonobo] Store username in a source URL in CalDAV



commit fd94ba8cde63d761fc84a3724874529caa266f09
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 28 17:02:53 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 5f28deb..9a9bae7 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-04-24  Milan Crha  <mcrha redhat com>
 
 	** Part of fix for bug #569652
diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c
index 46e5103..5df807a 100644
--- a/plugins/caldav/caldav-source.c
+++ b/plugins/caldav/caldav-source.c
@@ -124,11 +124,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);
@@ -163,6 +174,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]