[evolution-patches] fix for bug#73198 (shared-folder plugin)



Hi,

The attached patch fixes http://bugzilla.ximian.com/show_bug.cgi?
id=73198

Changes are made in shared-folder plugin (share-folder-common.c)

Thanks,

Vivek Jain
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/shared-folder/ChangeLog,v
retrieving revision 1.12
diff -u -p -r1.12 ChangeLog
--- ChangeLog	10 Mar 2005 09:19:48 -0000	1.12
+++ ChangeLog	10 Mar 2005 09:29:58 -0000
@@ -1,5 +1,15 @@
 2005-03-10  Vivek Jain <jvivek novell com>
 	
+	**Fixes #73198
+	* share-folder-common.c : 
+	(org_gnome_shared_folder_factory):
+	(create_folder__created) : pass the full name in get_conatiner_id
+	(get_container_id) : break the full name and start looking for the
+	name from the top most parent. This will give proper container id
+	even in the case of the duplicate names at different hierarchies
+
+2005-03-10  Vivek Jain <jvivek novell com>
+	
 	**Fixes #73201
 	* share-folder-common.c : (org_gnome_shared_folder_factory)
 	 use full_name given by CamelFolder to get the selected folder name 
Index: share-folder-common.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/shared-folder/share-folder-common.c,v
retrieving revision 1.12
diff -u -p -r1.12 share-folder-common.c
--- share-folder-common.c	10 Mar 2005 09:19:48 -0000	1.12
+++ share-folder-common.c	10 Mar 2005 09:29:58 -0000
@@ -164,7 +164,7 @@ create_folder__created (struct _mail_msg
 		if(E_IS_GW_CONNECTION (ccnc)) {
 			(ssi->sf)->cnc = ccnc;
 
-			(ssi->sf)->container_id = g_strdup (get_container_id ((ssi->sf)->cnc, m->name));
+			(ssi->sf)->container_id = g_strdup (get_container_id ((ssi->sf)->cnc, m->full_name));
 			share_folder(ssi->sf);
 		}
 
@@ -379,7 +379,7 @@ org_gnome_shared_folder_factory (EPlugin
 	else
 		sub = folder_name;	
 
-	/* This is kind of bad..but we don't have types for all these folders.*/
+	 /* This is kind of bad..but we don't have types for all these folders.*/
 
 	if ( !( strcmp (sub, "Mailbox") && strcmp (sub, "Calendar") && strcmp (sub, "Contacts") && strcmp (sub, "Documents") && strcmp (sub, "Authored") && strcmp (sub, "Default Library") && strcmp (sub, "Work In Progress") && strcmp (sub, "Cabinet") && strcmp (sub, "Sent Items") && strcmp (sub, "Trash") && strcmp (sub, "Checklist"))) {
 		g_free (folderuri);
@@ -391,7 +391,7 @@ org_gnome_shared_folder_factory (EPlugin
 		cnc = get_cnc (store);	
 	
 		if (E_IS_GW_CONNECTION (cnc)) 
-			id = get_container_id (cnc, sub);
+			id = get_container_id (cnc, folder_name);
 		else
 			g_warning("Could not Connnect\n");
 		
@@ -456,7 +456,17 @@ get_container_id(EGwConnection *cnc, gch
 {
 	GList *container_list = NULL;	
 	gchar *id = NULL;
-	const char *name;
+	gchar *name;
+	gchar **names;
+	int i = 0, parts = 0;
+
+	names = g_strsplit (fname, "/", -1);
+	if(names){
+		while (names [parts])
+			parts++;
+		fname = names[i]; 
+	}
+
 	/* get list of containers */
 	if (e_gw_connection_get_container_list (cnc, "folders", &(container_list)) == E_GW_CONNECTION_STATUS_OK) {
 		GList *container = NULL;
@@ -468,12 +478,17 @@ get_container_id(EGwConnection *cnc, gch
 				id = g_strdup (e_gw_container_get_id (container->data));
 				break;
 			} else if (!strcmp (name, fname)) {
-				id = g_strdup (e_gw_container_get_id (container->data));
-				break;
+				if (i == parts - 1) {
+					id = g_strdup (e_gw_container_get_id (container->data));
+					break;
+				} else
+					fname = names[++i];
 			}
 			g_free (name);
 		}
 		e_gw_connection_free_container_list (container_list);
+		if (names)
+		g_strfreev(names);
 	}
 	return id;
 }


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