[evolution-patches] patch for addressbook.c



Hi,
The attached patch has the following changes 
1) in addressbook_authenicate function auth value is compared with one
more type auth method "Password"  defined for  groupwise.
2) Groupwise uris has the book name as part of it.The uri format is
groupwise://server:port/soap?book_name. In functions
addressbook_authenicate and load_source_auth_cb functions the book_name
part is removed from the uri before passing it to e_password_* apis so
that user need to enter the password just once instead of for each book.

Thanks,
Sivaiah
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1644
diff -u -r1.1644 ChangeLog
--- ChangeLog	10 Apr 2004 17:23:16 -0000	1.1644
+++ ChangeLog	11 Apr 2004 12:03:26 -0000
@@ -1,3 +1,12 @@
+2004-04-11  Sivaiah Nallagatla <snallagatla novell com>
+
+	* gui/component/addressbook.c  (addressbook_authenicate)
+         (load_source_auth_cb) : remove the book name part of groupwise uri
+	 before calling e_password_* apis. Also added a check for new auth type "Password"
+	 for groupwise in addressbook_authenicate function
+	 (remove_book_name_from_uri ) : new function added to remove book name from 
+	 uri 
+	
 2004-04-10  Chris Toshok  <toshok ximian com>
 
 	* gui/widgets/eab-gui-util.h: add prototypes for
Index: gui/component/addressbook.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook.c,v
retrieving revision 1.230
diff -u -r1.230 addressbook.c
--- gui/component/addressbook.c	10 Apr 2004 17:23:16 -0000	1.230
+++ gui/component/addressbook.c	11 Apr 2004 12:03:26 -0000
@@ -89,7 +89,7 @@
 static void book_open_cb (EBook *book, EBookStatus status, gpointer closure);
 static void set_status_message (EABView *eav, const char *message, AddressbookView *view);
 static void search_result (EABView *eav, EBookViewStatus status, AddressbookView *view);
-
+static gchar*  remove_book_name_from_uri (gchar *uri);
 static EABView *
 get_current_view (AddressbookView *view)
 {
@@ -601,6 +601,22 @@
 	g_free (data);
 }
 
+/* removes book name from the groupwise uri 
+ uri format is groupwise://servername:port/soap?address_book_name*/
+
+static gchar*
+remove_book_name_from_uri (gchar *uri)
+{
+  gchar **components;
+  gchar *new_uri = NULL;
+  
+  components = g_strsplit (uri, "?", 2);
+  if (components[0])
+	new_uri = g_strdup (components[0]);
+   g_strfreev (components);
+   return new_uri;
+}
+
 static void
 load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
 {
@@ -627,7 +643,13 @@
 			return;
 		}
 		else {
+			gchar *temp_uri;
 			gchar *uri = e_source_get_uri (data->source);
+			 if (g_str_has_prefix (uri, "groupwise://")) {
+		                temp_uri = remove_book_name_from_uri (uri);
+                		g_free (uri);
+                		uri = temp_uri;		
+        		}
 
 			e_passwords_forget_password ("Addressbook", uri);
 			addressbook_authenticate (book, TRUE, data->source, load_source_auth_cb, closure);
@@ -669,14 +691,22 @@
 	char *pass_dup = NULL;
 	const gchar *auth;
 	const gchar *user;
+	gchar *temp_uri;
 	gchar *uri = e_source_get_uri (source);
-
+	
+	if (g_str_has_prefix (uri, "groupwise://")) {
+		temp_uri = remove_book_name_from_uri (uri);  
+		g_free (uri);
+		uri = temp_uri;
+	}
 	password = e_passwords_get_password ("Addressbook", uri);
 
 	auth = e_source_get_property (source, "auth");
 
 	if (auth && !strcmp ("ldap/simple-binddn", auth))
 		user = e_source_get_property (source, "binddn");
+	else if(auth && !strcmp ("Password", auth))
+		user = e_source_get_property (source, "user");
 	else
 		user = e_source_get_property (source, "email_addr");
 	if (!user)


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